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

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

[elpa] externals/denote b5ef3f5481 02/12: Simplify denote-convert-file-n


From: ELPA Syncer
Subject: [elpa] externals/denote b5ef3f5481 02/12: Simplify denote-convert-file-name-keywords-to-crm
Date: Thu, 4 Jan 2024 06:57:53 -0500 (EST)

branch: externals/denote
commit b5ef3f548175d7e45b6b3f6d42d19262260b8ddb
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>

    Simplify denote-convert-file-name-keywords-to-crm
---
 denote.el            | 8 +++-----
 tests/denote-test.el | 3 +--
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/denote.el b/denote.el
index 466d3faefd..df44325206 100644
--- a/denote.el
+++ b/denote.el
@@ -990,9 +990,7 @@ Inferred keywords are filtered by the user option
 STRING consists of underscore-separated words, as those appear in
 the keywords component of a Denote file name.  STRING is the same
 as the return value of `denote-retrieve-filename-keywords'."
-  (when (and string (not (string-empty-p string)))
-    (let ((list-of-strings (split-string string "_" :omit-nulls "_")))
-      (mapconcat #'identity list-of-strings ","))))
+  (string-join (split-string string "_" :omit-nulls "_") ","))
 
 (defvar denote--keyword-history nil
   "Minibuffer history of inputted keywords.")
@@ -2492,7 +2490,7 @@ file-naming scheme."
        (format "Rename `%s' with title (empty to remove)" file-in-prompt))
       (denote-keywords-prompt
        (format "Rename `%s' with keywords (empty to remove)" file-in-prompt)
-       (denote-convert-file-name-keywords-to-crm 
(denote-retrieve-filename-keywords file)))
+       (denote-convert-file-name-keywords-to-crm (or 
(denote-retrieve-filename-keywords file) "")))
       (denote-signature-prompt
        (string-replace "=" " " (or (denote-retrieve-filename-signature file) 
""))
        (format "Rename `%s' with signature (empty to remove)" file-in-prompt))
@@ -2535,7 +2533,7 @@ the changes made to the file: perform them outright."
                          (format "Rename `%s' with title (empty to remove)" 
file-in-prompt)))
                  (keywords (denote-keywords-prompt
                             (format "Rename `%s' with keywords (empty to 
remove)" file-in-prompt)
-                            (denote-convert-file-name-keywords-to-crm 
(denote-retrieve-filename-keywords file))))
+                            (denote-convert-file-name-keywords-to-crm (or 
(denote-retrieve-filename-keywords file) ""))))
                  (signature (denote-signature-prompt
                              (string-replace "=" " " (or 
(denote-retrieve-filename-signature file) ""))
                              (format "Rename `%s' with signature (empty to 
remove)" file-in-prompt)))
diff --git a/tests/denote-test.el b/tests/denote-test.el
index 074660a573..f61d9b9b68 100644
--- a/tests/denote-test.el
+++ b/tests/denote-test.el
@@ -393,8 +393,7 @@ Extend what we do in 
`denote-test--denote-file-type-extensions'."
   (should
    (and (equal (denote-convert-file-name-keywords-to-crm 
"_denote_keywords_testing") "denote,keywords,testing")
         (equal (denote-convert-file-name-keywords-to-crm "_denote") "denote")
-        (null (denote-convert-file-name-keywords-to-crm ""))
-        (null (denote-convert-file-name-keywords-to-crm nil)))))
+        (equal (denote-convert-file-name-keywords-to-crm "") ""))))
 
 ;;;; denote-journal-extras.el
 



reply via email to

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