branch: externals/denote
commit 2021999f82bf35579e6cc5d72618167e1f6ce9f7
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Fix case where denote-rename-file-using-front-matter finds no signature
    
    The idea is that we want the command to behave the way it always did
    when the file has no signature and to preserve the signature when it
    is present.
    
    Thanks to relict for reporting the issue on the mailing list:
    <https://lists.sr.ht/~protesilaos/denote/%3C87zg86lru9.fsf%40kotlak.com%3E>.
---
 denote.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/denote.el b/denote.el
index 9573540c36..ca997c5a4f 100644
--- a/denote.el
+++ b/denote.el
@@ -2323,10 +2323,13 @@ proceed with the renaming."
             (keywords (denote-retrieve-keywords-value file file-type))
             (extension (file-name-extension file t))
             (id (denote-retrieve-or-create-file-identifier file))
-            (signature (denote-retrieve-filename-signature file))
             (dir (file-name-directory file))
             (new-name (denote-format-file-name
-                       dir id keywords (denote-sluggify title) extension 
signature)))
+                       dir id keywords (denote-sluggify title) extension
+                       ;; The `denote-retrieve-filename-signature' is
+                       ;; not inside the `if-let*' because we do not
+                       ;; want to throw an exception if it is nil.
+                       (or (denote-retrieve-filename-signature file) nil))))
       (when (or auto-confirm
                 (denote-rename-file-prompt file new-name))
         (denote-rename-file-and-buffer file new-name)

Reply via email to