Fix: Compatibility with Org 9.2

Thanks to Brian Leung (@leungbk).  See #49.

Released as 0.3.1.
This commit is contained in:
Adam Porter 2019-10-09 15:14:22 -05:00
parent 01a3bc0a1c
commit 60ebad21f4
2 changed files with 15 additions and 13 deletions

View file

@ -2,7 +2,7 @@
;; Author: Adam Porter <adam@alphapapa.net>
;; Url: https://github.com/alphapapa/org-ql
;; Version: 0.3
;; Version: 0.3.1
;; Package-Requires: ((emacs "26.1") (dash "2.13") (dash-functional "1.2.0") (org "9.0") (org-super-agenda "1.2-pre") (ov "1.0.6") (peg "0.6") (s "1.12.0") (ts "0.2-pre"))
;; Keywords: hypermedia, outlines, Org, agenda
@ -44,17 +44,6 @@
(require 'dash-functional)
(require 'ts)
;;;; Compatibility
(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 (&rest _ignore)
"Call `org-get-tags', ignoring arguments."
(org-get-tags)))
;;;; Constants
;; Note the use of the `rx' `blank' keyword, which matches "horizontal" whitespace.
@ -76,6 +65,13 @@ match group.")
"Regular expression matching Org \"planning\" lines.
That is, \"CLOSED:\", \"DEADLINE:\", or \"SCHEDULED:\".")
(defconst org-ql-tag-line-re
"^\\*+ \\(?:.*[ \t]\\)?\\(:\\([[:alnum:]_@#%:]+\\):\\)[ \t]*$"
;; Copied from `org-tag-line-re' from org.el.
"Regexp matching tags in a headline.
Tags are stored in match group 1. Match group 2 stores the tags
without the enclosing colons.")
;;;; Variables
(defvar org-ql--today nil)
@ -383,7 +379,8 @@ Returns cons (INHERITED-TAGS . LOCAL-TAGS)."
('org-ql-nil nil)
(_ cached-result))
;; Not found in cache: get tags and cache them.
(let* ((local-tags (or (org-ql--get-tags position 'local)
(let* ((local-tags (or (when (looking-at org-ql-tag-line-re)
(split-string (match-string-no-properties 2) ":" t))
'org-ql-nil))
(inherited-tags (or (when org-use-tag-inheritance
(save-excursion