org.el: Fix regression in handling of empty #+TAGS
* lisp/org.el (org-set-regexps-and-options): Allow an empty #+TAGS
value to override org-tag-alist, as it did before v9.4.
* testing/lisp/test-org.el (test-org/set-regexps-and-options): Add
test.
As of b4e91b7e9
(New function: org-collect-keywords, 2020-04-26), a
"#+TAGS" header can no longer be used to override a value of
org-tag-alist. This breaks the workflow where a set of tags for most
files is defined via org-file-tags and then, in a particular file, an
empty #+TAGS header is used to ignore org-file-tags and trigger
collecting tags from the buffer instead. Rework the handling to
restore this behavior.
Reported-by: Allen Li <darkfeline@felesatra.moe>
Ref: https://orgmode.org/list/80y2laly9v.fsf@felesatra.moe
This commit is contained in:
parent
114229da6e
commit
3eccc537cd
|
@ -4279,10 +4279,10 @@ related expressions."
|
|||
(setq org-current-tag-alist
|
||||
(org--tag-add-to-alist
|
||||
org-tag-persistent-alist
|
||||
(let ((tags (mapconcat #'identity
|
||||
(cdr (assoc "TAGS" alist))
|
||||
"\n")))
|
||||
(if (org-string-nw-p tags) (org-tag-string-to-alist tags)
|
||||
(let ((tags (cdr (assoc "TAGS" alist))))
|
||||
(if tags
|
||||
(org-tag-string-to-alist
|
||||
(mapconcat #'identity tags "\n"))
|
||||
org-tag-alist))))
|
||||
(setq org-tag-groups-alist
|
||||
(org-tag-alist-to-groups org-current-tag-alist))
|
||||
|
|
|
@ -2457,6 +2457,11 @@ SCHEDULED: <2014-03-04 tue.>"
|
|||
(org-test-with-temp-text "#+TAGS: [ A : B C ]"
|
||||
(org-mode-restart)
|
||||
org-tag-groups-alist))))
|
||||
(should-not
|
||||
(let ((org-tag-alist '(("A"))))
|
||||
(org-test-with-temp-text "#+TAGS:"
|
||||
(org-mode-restart)
|
||||
org-current-tag-alist)))
|
||||
;; FILETAGS keyword.
|
||||
(should
|
||||
(equal '("A" "B" "C")
|
||||
|
|
Loading…
Reference in New Issue