From c31f8736255583588624deec2a502d1285e1a70e Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Thu, 18 Jul 2019 01:20:25 -0500 Subject: [PATCH] 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). --- org-ql.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/org-ql.el b/org-ql.el index 0360a28..78abc4e 100644 --- a/org-ql.el +++ b/org-ql.el @@ -43,9 +43,13 @@ ;;;; Compatibility -(when (version< org-version "9.2") - (defalias 'org-get-tags #'org-get-tags-at) - (defalias 'org-timestamp-to-time #'org-timestamp--to-internal-time)) +(if (version< org-version "9.2") + (progn + (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 @@ -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)." ;; 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. - (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 (null t) (otherwise (seq-intersection tags tags-at)))))