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

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

[elpa] externals/denote 49c4e4e094 1/7: Simplify denote--format-file


From: ELPA Syncer
Subject: [elpa] externals/denote 49c4e4e094 1/7: Simplify denote--format-file
Date: Tue, 2 Aug 2022 23:57:30 -0400 (EDT)

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

    Simplify denote--format-file
---
 denote.el | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/denote.el b/denote.el
index 48043d83ee..1905266afa 100644
--- a/denote.el
+++ b/denote.el
@@ -639,16 +639,12 @@ which include the starting dot or the return value of
 `denote--file-extension'."
   (let ((kws (denote--keywords-combine keywords))
         (ext (or extension (denote--file-extension)))
-        (empty-title (string-empty-p title-slug)))
-    (cond
-     ((and keywords title-slug (not empty-title))
-      (format "%s%s--%s__%s%s" path id title-slug kws ext))
-     ((and keywords empty-title)
-      (format "%s%s__%s%s" path id kws ext))
-     ((and title-slug (not empty-title))
-      (format "%s%s--%s%s" path id title-slug ext))
-     (t
-      (format "%s%s%s" path id ext)))))
+        (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
+      (setq file-name (concat file-name "__" kws)))
+    (concat file-name ext)))
 
 (defun denote--format-markdown-keywords (keywords)
   "Quote, downcase, and comma-separate elements in KEYWORDS."



reply via email to

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