[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 37dca91643 2/3: CHANGE how Org filetags are form
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 37dca91643 2/3: CHANGE how Org filetags are formatted by default |
Date: |
Mon, 1 Aug 2022 02:57:32 -0400 (EDT) |
branch: externals/denote
commit 37dca916435849e5307025197eee21c39d5d821b
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
CHANGE how Org filetags are formatted by default
Before, we would separate them by two spaces:
filetags: tag1 tag2
Now we do:
filetags: :tag1:tag2:
Technically, our space-separated format was correct though it could
confuse users, as the Org manual only mentions the colon-separated
format. To avoid potential conflicts, we now do what Org and its users
expect.
Thanks to Jean-Philippe Gagné Guay for commenting on this change:
<https://github.com/protesilaos/denote/commit/ea7d079c2d2f1d1ab932c5b1147a8492a703ddc1>.
Also thanks to Alan Schmitt and Peter Prevos for mentioning this topic
on different mailing list threads:
-
<https://lists.sr.ht/~protesilaos/denote/%3C875yk1x8en.fsf@m4x.org%3E#%3C87mtd8m82n.fsf@m4x.org%3E>
-
<https://lists.sr.ht/~protesilaos/denote/%3C87k081l6vw.fsf@silverstone.mail-host-address-is-not-set%3E#%3Cecd9f72563bbe41db77291a050b3de38@prevos.net%3E>
---
denote.el | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/denote.el b/denote.el
index 3fde6125e3..f68f6d9a7e 100644
--- a/denote.el
+++ b/denote.el
@@ -656,6 +656,12 @@ which include the starting dot or the return value of
(format "%S" (downcase k)))
keywords ", ")))
+(defun denote--format-org-keywords (keywords)
+ "Quote, downcase, and colon-separate elements in KEYWORDS."
+ (format ":%s:" (mapconcat (lambda (k)
+ (downcase k))
+ keywords ":")))
+
(defun denote--file-meta-keywords (keywords &optional type)
"Prepare KEYWORDS for inclusion in the file's front matter.
Parse the output of `denote--keywords-prompt', using `downcase'
@@ -666,9 +672,13 @@ With optional TYPE, format the keywords accordingly (this
might
be `toml' or, in the future, some other spec that needss special
treatment)."
(let ((kw (denote--sluggify-keywords keywords)))
- (if (or (eq type 'markdown-toml) (eq type 'markdown-yaml) (eq type 'md))
- (denote--format-markdown-keywords kw)
- (mapconcat #'downcase kw " "))))
+ (cond
+ ((or (eq type 'markdown-toml) (eq type 'markdown-yaml) (eq type 'md))
+ (denote--format-markdown-keywords kw))
+ ((eq type 'text)
+ (mapconcat #'downcase kw " "))
+ (t
+ (denote--format-org-keywords kw)))))
(defun denote--extract-keywords-from-front-matter (file &optional type)
"Extract keywords from front matter of FILE with TYPE.