Fix: Define own get-tags function for compatibility
In Org <9.2, both org-get-tags and org-get-tags-at are functions, and we must not clobber org-get-tags. In Org 9.2+, org-get-tags replaces org-get-tags-at, but org-get-tags-at remains defined as an obsolete alias. Thanks to Chris Rayner (@riscy).
This commit is contained in:
parent
25f964dfcb
commit
c31f873625
1 changed files with 8 additions and 4 deletions
12
org-ql.el
12
org-ql.el
|
|
@ -43,9 +43,13 @@
|
||||||
|
|
||||||
;;;; Compatibility
|
;;;; Compatibility
|
||||||
|
|
||||||
(when (version< org-version "9.2")
|
(if (version< org-version "9.2")
|
||||||
(defalias 'org-get-tags #'org-get-tags-at)
|
(progn
|
||||||
(defalias 'org-timestamp-to-time #'org-timestamp--to-internal-time))
|
(defalias 'org-timestamp-to-time #'org-timestamp--to-internal-time)
|
||||||
|
(defun org-ql--get-tags (&optional pos local)
|
||||||
|
(org-get-tags-at pos local)))
|
||||||
|
(defun org-ql--get-tags (&optional pos local)
|
||||||
|
(org-get-tags pos local)))
|
||||||
|
|
||||||
;;;; Variables
|
;;;; Variables
|
||||||
|
|
||||||
|
|
@ -477,7 +481,7 @@ With KEYWORDS, return non-nil if its keyword is one of KEYWORDS (a list of strin
|
||||||
"Return non-nil if current heading has one or more of TAGS (a list of strings)."
|
"Return non-nil if current heading has one or more of TAGS (a list of strings)."
|
||||||
;; TODO: Try to use `org-make-tags-matcher' to improve performance. It would be nice to not have
|
;; TODO: Try to use `org-make-tags-matcher' to improve performance. It would be nice to not have
|
||||||
;; to run `org-get-tags' for every heading, especially with inheritance.
|
;; to run `org-get-tags' for every heading, especially with inheritance.
|
||||||
(when-let ((tags-at (org-get-tags (point) (not org-use-tag-inheritance))))
|
(when-let ((tags-at (org-ql--get-tags (point) (not org-use-tag-inheritance))))
|
||||||
(cl-typecase tags
|
(cl-typecase tags
|
||||||
(null t)
|
(null t)
|
||||||
(otherwise (seq-intersection tags tags-at)))))
|
(otherwise (seq-intersection tags tags-at)))))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue