[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 722c1f3934 14/17: Add variable denote-generate-i
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 722c1f3934 14/17: Add variable denote-generate-identifier-automatically |
Date: |
Sun, 10 Nov 2024 00:57:53 -0500 (EST) |
branch: externals/denote
commit 722c1f3934046860727d53862db53cd7bb0d07c4
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Add variable denote-generate-identifier-automatically
---
denote.el | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/denote.el b/denote.el
index 74d6baf45c..80236bb479 100644
--- a/denote.el
+++ b/denote.el
@@ -985,6 +985,20 @@ to override what this function returns."
(denote--make-denote-directory)
denote-directory)))
+;; TODO: Review and fix the features listed in the docstring below before
+;; making this a user option.
+(defvar denote-generate-identifier-automatically t
+ "Make creation and renaming commands automatically create and identifier.
+
+This applies when a note is created or renamed. The default is to
+always create an identifier automatically.
+
+Valid values are: t, nil, `on-creation', and `on-rename'.
+
+IMPORTANT: Some features are not working with notes that do not have an
+identifier. Among them are the Dired fontification, identifier and date
+lines updated in front matter, linking (backlinks).")
+
;;;;; Sluggification functions
(defun denote-slug-keep-only-ascii (str)
@@ -2491,7 +2505,10 @@ instead of that of the parameter."
(file-type (denote--valid-file-type (or file-type denote-file-type)))
(keywords (denote-keywords-sort keywords))
(date (denote-valid-date-p date))
- (date (or date (current-time)))
+ (date (cond (date date)
+ ((or (eq denote-generate-identifier-automatically t)
+ (eq denote-generate-identifier-automatically
'on-creation))
+ (current-time))))
(id (denote-get-identifier date))
(id (if (string-empty-p id) id (denote--find-first-unused-id id)))
(date (if (string-empty-p id) nil (date-to-time id)))
@@ -3162,12 +3179,11 @@ renaming commands."
;; condition).
(unless (denote-file-has-identifier-p file)
(setq date (denote-valid-date-p (denote-date-prompt)))))))
- ;; TODO: If the date is still nil, use the modification time of the file
or the current time.
- ;; This is done because the absence of an identifier is not supported yet.
- ;; Once we do, this should be removed or made optional with a user option.
- (setq date (or date
- (file-attribute-modification-time (file-attributes file))
- (current-time)))
+ (when (and (null date)
+ (or (eq denote-generate-identifier-automatically t)
+ (eq denote-generate-identifier-automatically 'on-rename)))
+ (setq date (or (file-attribute-modification-time (file-attributes file))
+ (current-time))))
(list title keywords signature date)))
;;;###autoload
- [elpa] externals/denote cf4ce27580 01/17: Do not check identifier format in retrieval functions of file name components, (continued)
- [elpa] externals/denote cf4ce27580 01/17: Do not check identifier format in retrieval functions of file name components, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 7cd1461e4b 03/17: Add comment in denote-valid-date-p, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 19164364a8 06/17: Obsolete denote-create-unique-file-identifier, ELPA Syncer, 2024/11/10
- [elpa] externals/denote a204554b8d 05/17: denote-get-identifier returns an empty string when date is nil, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 89b0525475 07/17: Do not check nil identifier in denote-format-file-name, ELPA Syncer, 2024/11/10
- [elpa] externals/denote b0b19b9ad1 08/17: Allow empty identifier in denote-format-file-name, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 4a2caa43ef 13/17: Handle id in denote--creation-prepare-note-data, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 8f8026bf56 11/17: Change denote and denote-org-capture to make them ready to handle empty identifiers, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 5e21143e22 10/17: Update docstring of denote-format-file-name, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 344e1a65bb 17/17: Merge pull request #476 from jeanphilippegg/date-functions, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 722c1f3934 14/17: Add variable denote-generate-identifier-automatically,
ELPA Syncer <=
- [elpa] externals/denote 8b005edd2d 12/17: Make some front matter functions ready to handle nil dates and empty identifiers, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 427ebfed8e 15/17: Add date parameter to denote--add-front-matter, ELPA Syncer, 2024/11/10