Make sure that 'inherited text property in tags does not propagate to cache

* lisp/org.el (org--get-local-tags, org-get-tags): Explicitly copy
cached tag strings to make sure that modifications are not propagated
to cached tag values.

Fixes
https://list.orgmode.org/CAFyQvY2HkE5p00wQ1QycQCdtwy3drRB_naK8wenrKwVT-cbH7g@mail.gmail.com/T/#t
This commit is contained in:
Ihor Radchenko 2022-01-21 19:47:18 +08:00
parent 5d05f5911a
commit 5ac2b2291b
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 4 additions and 4 deletions

View File

@ -12609,9 +12609,9 @@ Assume point is at the beginning of the headline."
(let* ((cached (and (org-element--cache-active-p) (org-element-at-point nil 'cached)))
(cached-tags (org-element-property :tags cached)))
(if cached
;; If we do not wrap result into `cl-copy-list', reference would
;; If we do explicitly copy the result, reference would
;; be returned and cache element might be modified directly.
(cl-copy-list cached-tags)
(mapcar #'copy-sequence cached-tags)
;; Parse tags manually.
(and (looking-at org-tag-line-re)
(split-string (match-string-no-properties 2) ":" t)))))
@ -12655,9 +12655,9 @@ Inherited tags have the `inherited' text property."
(if cached
(while (setq cached (org-element-property :parent cached))
(setq itags (nconc (mapcar #'org-add-prop-inherited
;; If we do not wrap result into `cl-copy-list', reference would
;; If we do explicitly copy the result, reference would
;; be returned and cache element might be modified directly.
(cl-copy-list (org-element-property :tags cached)))
(mapcar #'copy-sequence (org-element-property :tags cached)))
itags)))
(while (org-up-heading-safe)
(setq itags (nconc (mapcar #'org-add-prop-inherited