emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/denote 16fcac16ca 3/3: Merge pull request #478 from jea


From: ELPA Syncer
Subject: [elpa] externals/denote 16fcac16ca 3/3: Merge pull request #478 from jeanphilippegg/fix-denote-rename-file
Date: Mon, 11 Nov 2024 03:57:51 -0500 (EST)

branch: externals/denote
commit 16fcac16ca31f9195ce5378a555d037fc5af2e96
Merge: e5b574ec87 ebc31ee731
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #478 from jeanphilippegg/fix-denote-rename-file
    
    Fix denote-rename-file when called from lisp
---
 denote.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/denote.el b/denote.el
index 0f66779c0f..365a103e2b 100644
--- a/denote.el
+++ b/denote.el
@@ -3118,6 +3118,12 @@ 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)))))
          (old-id (or (denote-retrieve-filename-identifier file) ""))
          (id (denote-get-identifier date))
          (id (if (or (string-empty-p id) (string= old-id id))
@@ -3179,11 +3185,6 @@ renaming commands."
          ;; condition).
          (unless (denote-file-has-identifier-p file)
            (setq date (denote-valid-date-p (denote-date-prompt)))))))
-    (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
@@ -3316,8 +3317,9 @@ one-by-one, use `denote-dired-rename-files'."
          (signature (if (eq signature 'keep-current)
                         (or (denote-retrieve-filename-signature file) "")
                       signature))
-         ;; 'keep-current is the same as nil because we do not currently allow 
the modification of the identifier
-         (date (if (eq date 'keep-current) nil date))
+         (date (if (eq date 'keep-current)
+                   (denote-valid-date-p (denote-retrieve-filename-identifier 
file))
+                 date))
          (new-name (denote--rename-file file title keywords signature date)))
     (denote-update-dired-buffers)
     new-name))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]