[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 165ef38a9b 4/6: Add denote--generate-date-for-re
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 165ef38a9b 4/6: Add denote--generate-date-for-rename |
Date: |
Sat, 14 Dec 2024 03:57:58 -0500 (EST) |
branch: externals/denote
commit 165ef38a9b6910eca5477c0a0e298e97de7dca11
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Add denote--generate-date-for-rename
---
denote.el | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/denote.el b/denote.el
index 1ec6b117c1..a62a6d82df 100644
--- a/denote.el
+++ b/denote.el
@@ -3412,6 +3412,16 @@ If `denote-rename-confirmations' does not contain
(defvar denote-rename-max-mini-window-height 0.33
"How much to enlarge `max-mini-window-height' for renaming operations.")
+(defun denote--generate-date-for-rename (file)
+ "Generate a date for FILE.
+
+Respect `denote-generate-identifier-automatically'."
+ (if (or (eq denote-generate-identifier-automatically t)
+ (eq denote-generate-identifier-automatically 'on-rename))
+ (or (file-attribute-modification-time (file-attributes file))
+ (current-time))
+ nil))
+
(defun denote--rename-file (file title keywords signature date)
"Rename FILE according to the other parameters.
Parameters TITLE, KEYWORDS, SIGNATURE and DATE are as described
@@ -3431,12 +3441,7 @@ Respect `denote-rename-confirmations',
`denote-save-buffers' and
(keywords (denote-keywords-sort keywords))
(directory (file-name-directory file))
(extension (file-name-extension file :include-period))
- ;; Handle nil date
- (date (cond (date date)
- ((or (eq denote-generate-identifier-automatically t)
- (eq denote-generate-identifier-automatically
'on-rename))
- (or (file-attribute-modification-time (file-attributes
file))
- (current-time)))))
+ (date (or date (denote--generate-date-for-rename file)))
(old-id (or (denote-retrieve-filename-identifier file) ""))
(id (denote-get-identifier date))
(id (cond ((or (string-empty-p id) (string= old-id id))
@@ -3473,9 +3478,8 @@ It is meant to be combined with `denote--rename-file' to
create
renaming commands."
(let* ((file-in-prompt (propertize (file-relative-name file) 'face
'denote-faces-prompt-current-name))
(file-type (denote-filetype-heuristics file))
- (date (denote-valid-date-p (or (denote-retrieve-filename-identifier
file)
- (file-attribute-modification-time
(file-attributes file))
- (current-time))))
+ (id (or (denote-retrieve-filename-identifier file) ""))
+ (date (or (denote-valid-date-p id) (denote--generate-date-for-rename
file)))
(title (or (denote-retrieve-title-or-filename file file-type) ""))
(keywords (denote-extract-keywords-from-path file))
(signature (or (denote-retrieve-filename-signature file) "")))
- [elpa] externals/denote updated (6613d3903d -> 2ab74c1d47), ELPA Syncer, 2024/12/14
- [elpa] externals/denote 0a5c142287 1/6: Refactor denote--date-convert, ELPA Syncer, 2024/12/14
- [elpa] externals/denote 779fe017dc 3/6: Validate the presence of at least one file name component, ELPA Syncer, 2024/12/14
- [elpa] externals/denote 5d4b9f9089 5/6: Merge pull request #496 from jeanphilippegg/fix-tests, ELPA Syncer, 2024/12/14
- [elpa] externals/denote 8f3e5dd407 2/6: Fix tests, ELPA Syncer, 2024/12/14
- [elpa] externals/denote 2ab74c1d47 6/6: Merge pull request #495 from jeanphilippegg/denote--date-convert, ELPA Syncer, 2024/12/14
- [elpa] externals/denote 165ef38a9b 4/6: Add denote--generate-date-for-rename,
ELPA Syncer <=