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:
<ea7d079c2d>.

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>
This commit is contained in:
Protesilaos Stavrou 2022-08-01 09:37:44 +03:00
parent ea7d079c2d
commit 37dca91643
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA

View file

@ -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.