[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 916344321a 01/14: Support permutations of file n
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 916344321a 01/14: Support permutations of file names |
Date: |
Sat, 9 Jul 2022 02:57:35 -0400 (EDT) |
branch: externals/denote
commit 916344321a59b0e350fade5963aa3049733b2bbe
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Support permutations of file names
Testing with these:
;; Identifier only: 20220707T172335.txt
(denote nil nil)
;; No title field, but with keywords: 20220707T172349__test.txt
(denote nil '("test"))
(denote nil '("test" "two"))
;; Title, no keywords: 20220707T172458--test.txt
(denote "test" nil)
;; Title and keywords (what we always had):
20220707T172525--test__test.txt
(denote "test" '("test"))
(denote "test" '("test" "two"))
---
denote.el | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/denote.el b/denote.el
index 9729286b91..eb5aec037a 100644
--- a/denote.el
+++ b/denote.el
@@ -466,16 +466,25 @@ output is sorted with `string-lessp'."
('text ".txt")
(_ ".org")))
-(defun denote--format-file (path id keywords slug extension)
+(defun denote--format-file (path id keywords title-slug extension)
"Format file name.
-PATH, ID, KEYWORDS, SLUG are expected to be supplied by `denote'
-or equivalent: they will all be converted into a single string.
-EXTENSION is the file type extension, either a string which
-include the starting dot or the return value of
+PATH, ID, KEYWORDS, TITLE-SLUG are expected to be supplied by
+`denote' or equivalent: they will all be converted into a single
+string. EXTENSION is the file type extension, either a string
+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))))
- (format "%s%s--%s__%s%s" path id slug kws ext)))
+ (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)))))
(defun denote--map-quote-downcase (seq)
"Quote and downcase elements in SEQ."
- [elpa] externals/denote updated (1075cbb65f -> 39d85280ee), ELPA Syncer, 2022/07/09
- [elpa] externals/denote 564c139c78 04/14: Rework denote-faces-file-name-keywords, ELPA Syncer, 2022/07/09
- [elpa] externals/denote bde1e0f36e 07/14: Fontify all file type extensions, ELPA Syncer, 2022/07/09
- [elpa] externals/denote 29a5a2d966 09/14: Remove face override from keywords separator, ELPA Syncer, 2022/07/09
- [elpa] externals/denote 9dbfd371ff 02/14: Refactor of denote--inferred-keywords, ELPA Syncer, 2022/07/09
- [elpa] externals/denote 627df2e311 06/14: Remove dev notice about performance, ELPA Syncer, 2022/07/09
- [elpa] externals/denote 5abcd2fe87 08/14: Remove needless face override from delimiter, ELPA Syncer, 2022/07/09
- [elpa] externals/denote f1e08702e5 11/14: Make fontification more robust (revise f13fdd4), ELPA Syncer, 2022/07/09
- [elpa] externals/denote 39d85280ee 14/14: Define obsolete alias of fontification var, ELPA Syncer, 2022/07/09
- [elpa] externals/denote 916344321a 01/14: Support permutations of file names,
ELPA Syncer <=
- [elpa] externals/denote 3f51ba3b79 03/14: Rework denote--only-note-p, ELPA Syncer, 2022/07/09
- [elpa] externals/denote ab18e32e1b 05/14: Merge pull request #38 from jeanphilippegg/file-name-permutations, ELPA Syncer, 2022/07/09
- [elpa] externals/denote f13fdd439c 10/14: Fix false positives in fontification regexp, ELPA Syncer, 2022/07/09
- [elpa] externals/denote 3f2e0788a9 12/14: Adjust fontification, ELPA Syncer, 2022/07/09
- [elpa] externals/denote e7de7baaa4 13/14: Merge pull request #40 from jeanphilippegg/file-name-permutations, ELPA Syncer, 2022/07/09