[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 8b005edd2d 12/17: Make some front matter functio
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 8b005edd2d 12/17: Make some front matter functions ready to handle nil dates and empty identifiers |
Date: |
Sun, 10 Nov 2024 00:57:52 -0500 (EST) |
branch: externals/denote
commit 8b005edd2d7b89b1bd00d861ab9cc71cb5a64a2d
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Make some front matter functions ready to handle nil dates and empty
identifiers
---
denote.el | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/denote.el b/denote.el
index 3f8092b670..c046df2842 100644
--- a/denote.el
+++ b/denote.el
@@ -1559,7 +1559,10 @@ Consult the `denote-file-types' for how this is used."
"Extract date object from front matter DATE-STRING.
Consult the `denote-file-types' for how this is used."
- (date-to-time (denote-trim-whitespace date-string)))
+ (let ((date-string (denote-trim-whitespace date-string)))
+ (if (string-empty-p date-string)
+ nil
+ (date-to-time date-string))))
(defvar denote-file-types
'((org
@@ -2125,6 +2128,8 @@ which case it is not added to the base file name."
"Expand DATE in an appropriate format for FILE-TYPE."
(let ((format denote-date-format))
(cond
+ ((null date)
+ "")
(format
(format-time-string format date))
((when-let* ((fn (denote--date-value-function file-type)))
@@ -2950,7 +2955,8 @@ If a buffer is visiting the file, its name is updated."
The TITLE, KEYWORDS, ID, SIGNATURE, and FILE-TYPE are passed from the
renaming command and are used to construct a new front matter block if
appropriate."
- (when-let* ((new-front-matter (denote--format-front-matter title
(date-to-time id) keywords id signature file-type)))
+ (when-let* ((date (if (string-empty-p id) nil (date-to-time id)))
+ (new-front-matter (denote--format-front-matter title date
keywords id signature file-type)))
(with-current-buffer (find-file-noselect file)
(goto-char (point-min))
(insert new-front-matter))))
- [elpa] externals/denote 7cd1461e4b 03/17: Add comment in denote-valid-date-p, (continued)
- [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, 2024/11/10
- [elpa] externals/denote 8b005edd2d 12/17: Make some front matter functions ready to handle nil dates and empty identifiers,
ELPA Syncer <=
- [elpa] externals/denote 427ebfed8e 15/17: Add date parameter to denote--add-front-matter, ELPA Syncer, 2024/11/10