branch: externals/denote commit 49c4e4e0940f42fbe959e05c801db1a02f96b604 Author: Jean-Philippe Gagné Guay <jeanphilippe...@gmail.com> Commit: Jean-Philippe Gagné Guay <jeanphilippe...@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."