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

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

[elpa] externals/denote c2049fa527 1/2: Fix how strings are sluggified i


From: ELPA Syncer
Subject: [elpa] externals/denote c2049fa527 1/2: Fix how strings are sluggified in all scenaria
Date: Tue, 5 Jul 2022 10:57:30 -0400 (EDT)

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

    Fix how strings are sluggified in all scenaria
    
    Before a nil value for 'denote-allow-multi-word-keywords' would have the
    adverse effect of joining all the strings in the title field of the file
    name.  The intent always was to do that only for multi-word keywords,
    not the title.
---
 denote.el | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/denote.el b/denote.el
index 12abafb0ab..d07d7306c3 100644
--- a/denote.el
+++ b/denote.el
@@ -305,18 +305,26 @@ trailing hyphen."
 
 (defun denote--sluggify (str)
   "Make STR an appropriate slug for file names and related."
+  (downcase (denote--slug-hyphenate (denote--slug-no-punct str))))
+
+(defun denote--sluggify-and-join (str)
+  "Sluggify STR while joining separate words."
   (downcase
-   (if denote-allow-multi-word-keywords
-       (denote--slug-hyphenate (denote--slug-no-punct str))
-     (replace-regexp-in-string
-      "-" ""
-      (denote--slug-hyphenate (denote--slug-no-punct str))))))
+   (replace-regexp-in-string
+    "-" ""
+    (denote--slug-hyphenate (denote--slug-no-punct str)))))
 
 (defun denote--sluggify-keywords (keywords)
   "Sluggify KEYWORDS."
-  (if (listp keywords)
-      (mapcar #'denote--sluggify keywords)
-    (denote--sluggify keywords)))
+  (cond
+   ((listp keywords)
+    (if denote-allow-multi-word-keywords
+        (mapcar #'denote--sluggify keywords)
+      (mapcar #'denote--sluggify-and-join keywords)))
+   (t
+    (if denote-allow-multi-word-keywords
+        (denote--sluggify keywords)
+      (denote--sluggify-and-join keywords)))))
 
 (defun denote--file-empty-p (file)
   "Return non-nil if FILE is empty."



reply via email to

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