Fix: (--tags-at) Respect tag inheritance options
Respect org-use-tag-inheritance and org-tags-exclude-from-inheritance. Fixes #43. Thanks to Josiah Schwab (@jschwab) for reporting.
This commit is contained in:
parent
bf20251e93
commit
8a812323fc
1 changed files with 18 additions and 10 deletions
28
org-ql.el
28
org-ql.el
|
|
@ -652,16 +652,24 @@ Returns cons (INHERITED-TAGS . LOCAL-TAGS)."
|
||||||
;; Not found in cache: get tags and cache them.
|
;; Not found in cache: get tags and cache them.
|
||||||
(let* ((local-tags (or (org-ql--get-tags position 'local)
|
(let* ((local-tags (or (org-ql--get-tags position 'local)
|
||||||
'org-ql-nil))
|
'org-ql-nil))
|
||||||
(inherited-tags (or (save-excursion
|
(inherited-tags (or (when org-use-tag-inheritance
|
||||||
(when (org-up-heading-safe)
|
(save-excursion
|
||||||
(-let* (((inherited local) (org-ql--tags-at (point))))
|
(when (org-up-heading-safe)
|
||||||
(when (or inherited local)
|
(-let* (((inherited local) (org-ql--tags-at (point)))
|
||||||
(cond ((and (listp inherited)
|
(tags (when (or inherited local)
|
||||||
(listp local))
|
(cond ((and (listp inherited)
|
||||||
(->> (append inherited local)
|
(listp local))
|
||||||
-non-nil -uniq))
|
(->> (append inherited local)
|
||||||
((listp inherited) inherited)
|
-non-nil -uniq))
|
||||||
((listp local) local))))))
|
((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)))))))
|
||||||
'org-ql-nil))
|
'org-ql-nil))
|
||||||
(all-tags (list inherited-tags local-tags)))
|
(all-tags (list inherited-tags local-tags)))
|
||||||
;; Check caches again, because they may have been set now.
|
;; Check caches again, because they may have been set now.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue