From 5ac2b2291b0f7cdbeecc264c0e95ebc89d6ca2ef Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Fri, 21 Jan 2022 19:47:18 +0800 Subject: [PATCH] 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 --- lisp/org.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index cc21291e3..2d439cd05 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -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