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

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

[elpa] externals/denote 55e923ffc5 12/12: Make denote-format-file-name a


From: ELPA Syncer
Subject: [elpa] externals/denote 55e923ffc5 12/12: Make denote-format-file-name also accept nil TITLE and SIGNATURE
Date: Sun, 11 Feb 2024 03:57:54 -0500 (EST)

branch: externals/denote
commit 55e923ffc5e7a22b6cbc4dbbd5fb8a07121260eb
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Make denote-format-file-name also accept nil TITLE and SIGNATURE
    
    We do not want to limit this to empty strings, because there are cases
    we will need to arrange for the return value to be that. Whereas we
    get nil for free.
---
 denote.el            | 4 ++--
 tests/denote-test.el | 9 +++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/denote.el b/denote.el
index 17aa113cf6..ab791ed402 100644
--- a/denote.el
+++ b/denote.el
@@ -1757,9 +1757,9 @@ which case it is not added to the base file name."
    ((not (string-match-p denote-id-regexp id))
     (error "ID `%s' does not match `denote-id-regexp'" id)))
   (let ((file-name (concat dir-path id)))
-    (when (not (string-empty-p signature))
+    (when (and signature (not (string-empty-p signature)))
       (setq file-name (concat file-name "==" (denote-sluggify 'signature 
signature))))
-    (when (not (string-empty-p title))
+    (when (and title (not (string-empty-p title)))
       (setq file-name (concat file-name "--" (denote-sluggify 'title title))))
     (when keywords
       (setq file-name (concat file-name "__" (denote-keywords-combine 
(denote-sluggify-keywords keywords)))))
diff --git a/tests/denote-test.el b/tests/denote-test.el
index d46b57f2e0..41e5784798 100644
--- a/tests/denote-test.el
+++ b/tests/denote-test.el
@@ -356,6 +356,15 @@ Extend what we do in 
`denote-test--denote-file-type-extensions'."
                     "")
                    "/tmp/test-denote/20231128T055311.org"))
 
+    (should (equal (denote-format-file-name
+                    (denote-directory)
+                    id
+                    nil
+                    nil
+                    (denote--file-extension 'org)
+                    nil)
+                   "/tmp/test-denote/20231128T055311.org"))
+
     (should (equal (denote-format-file-name
                     (denote-directory)
                     id



reply via email to

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