Bypass narrowing when calculating inherited tags in narrowed buffer
Otherwise, children queries may generate wrong tags and pollute tag cache.
This commit is contained in:
parent
9b30c4139b
commit
3e6818d819
1 changed files with 20 additions and 19 deletions
39
org-ql.el
39
org-ql.el
|
|
@ -565,25 +565,26 @@ Returns cons (INHERITED-TAGS . LOCAL-TAGS)."
|
|||
'org-ql-nil))
|
||||
(inherited-tags (or (when org-use-tag-inheritance
|
||||
(save-excursion
|
||||
(if (org-up-heading-safe)
|
||||
;; Return parent heading's tags.
|
||||
(-let* (((inherited local) (org-ql--tags-at (point)))
|
||||
(tags (when (or inherited local)
|
||||
(cond ((and (listp inherited)
|
||||
(listp local))
|
||||
(->> (append inherited local)
|
||||
-non-nil -uniq))
|
||||
((listp inherited) inherited)
|
||||
((listp local) local)))))
|
||||
(cl-typecase org-use-tag-inheritance
|
||||
(list (setf tags (-intersection tags org-use-tag-inheritance)))
|
||||
(string (setf tags (--select (string-match org-use-tag-inheritance it)
|
||||
tags))))
|
||||
(pcase org-tags-exclude-from-inheritance
|
||||
('nil tags)
|
||||
(_ (-difference tags org-tags-exclude-from-inheritance))))
|
||||
;; Top-level heading: use file tags.
|
||||
org-file-tags)))
|
||||
(org-with-wide-buffer
|
||||
(if (org-up-heading-safe)
|
||||
;; Return parent heading's tags.
|
||||
(-let* (((inherited local) (org-ql--tags-at (point)))
|
||||
(tags (when (or inherited local)
|
||||
(cond ((and (listp inherited)
|
||||
(listp local))
|
||||
(->> (append inherited local)
|
||||
-non-nil -uniq))
|
||||
((listp inherited) inherited)
|
||||
((listp local) local)))))
|
||||
(cl-typecase org-use-tag-inheritance
|
||||
(list (setf tags (-intersection tags org-use-tag-inheritance)))
|
||||
(string (setf tags (--select (string-match org-use-tag-inheritance it)
|
||||
tags))))
|
||||
(pcase org-tags-exclude-from-inheritance
|
||||
('nil tags)
|
||||
(_ (-difference tags org-tags-exclude-from-inheritance))))
|
||||
;; Top-level heading: use file tags.
|
||||
org-file-tags))))
|
||||
'org-ql-nil))
|
||||
(all-tags (list inherited-tags local-tags)))
|
||||
;; Check caches again, because they may have been set now.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue