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

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

[elpa] externals/denote 63a2b21453 2/2: Make renaming remove keywords if


From: ELPA Syncer
Subject: [elpa] externals/denote 63a2b21453 2/2: Make renaming remove keywords if empty
Date: Wed, 12 Oct 2022 00:57:38 -0400 (EDT)

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

    Make renaming remove keywords if empty
    
    The idea is an empty "keywords" entry in the front matter should mean
    that the "__KEYWORDS" component of the title should not be present.
    We already allow this, such as if the 'denote-prompts' is configured
    to not have a 'keywords' prompt (check its doc string).
    
    THIS NEEDS MORE TESTING TO BE SURE THERE ARE NO REGRESSIONS.
---
 denote.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/denote.el b/denote.el
index 816fc3cbf2..7776e12e75 100644
--- a/denote.el
+++ b/denote.el
@@ -826,8 +826,13 @@ for how this is used."
 
 (defun denote-extract-keywords-from-front-matter (keywords-string)
   "Extract keywords list from front matter KEYWORDS-STRING.
+Split KEYWORDS-STRING into a list of strings.  If KEYWORDS-STRING
+satisfies `string-blank-p', return an empty string.
+
 Consult the `denote-file-types' for how this is used."
-  (split-string keywords-string "[:,\s]+" t "[][ \"']+"))
+  (if (string-blank-p keywords-string)
+      ""
+    (split-string keywords-string "[:,\s]+" t "[][ \"']+")))
 
 (defvar denote-file-types
   ;; If denote-file-type is nil, we use the first element
@@ -1153,7 +1158,7 @@ string.  EXTENSION is the file type extension, as a 
string."
         (file-name (concat path id)))
     (when (and title-slug (not (string-empty-p title-slug)))
       (setq file-name (concat file-name "--" title-slug)))
-    (when keywords
+    (when (and keywords (not (string-blank-p kws)))
       (setq file-name (concat file-name "__" kws)))
     (concat file-name extension)))
 



reply via email to

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