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 a3a1acb5c3
2 changed files with 15 additions and 13 deletions

View file

@ -363,6 +363,11 @@ Expands into a call to ~org-ql-select~ with the same arguments. For convenience
/Note:/ Breaking changes may be made before version 1.0, but in the event of major changes, attempts at backward compatibility will be made with obsolescence declarations, translation of arguments, etc. Users who need stability guarantees before 1.0 may choose to use tagged stable releases. /Note:/ Breaking changes may be made before version 1.0, but in the event of major changes, attempts at backward compatibility will be made with obsolescence declarations, translation of arguments, etc. Users who need stability guarantees before 1.0 may choose to use tagged stable releases.
** 0.3.1
*Fixed*
+ Compatibility with Org 9.2. Thanks to [[https://github.com/leungbk][Brian Leung]].
** 0.3 ** 0.3
*Added* *Added*

View file

@ -2,7 +2,7 @@
;; Author: Adam Porter <adam@alphapapa.net> ;; Author: Adam Porter <adam@alphapapa.net>
;; Url: https://github.com/alphapapa/org-ql ;; 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")) ;; 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 ;; Keywords: hypermedia, outlines, Org, agenda
@ -44,17 +44,6 @@
(require 'dash-functional) (require 'dash-functional)
(require 'ts) (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 ;;;; Constants
;; Note the use of the `rx' `blank' keyword, which matches "horizontal" whitespace. ;; Note the use of the `rx' `blank' keyword, which matches "horizontal" whitespace.
@ -76,6 +65,13 @@ match group.")
"Regular expression matching Org \"planning\" lines. "Regular expression matching Org \"planning\" lines.
That is, \"CLOSED:\", \"DEADLINE:\", or \"SCHEDULED:\".") 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 ;;;; Variables
(defvar org-ql--today nil) (defvar org-ql--today nil)
@ -383,7 +379,8 @@ Returns cons (INHERITED-TAGS . LOCAL-TAGS)."
('org-ql-nil nil) ('org-ql-nil nil)
(_ cached-result)) (_ cached-result))
;; 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 (when (looking-at org-ql-tag-line-re)
(split-string (match-string-no-properties 2) ":" t))
'org-ql-nil)) 'org-ql-nil))
(inherited-tags (or (when org-use-tag-inheritance (inherited-tags (or (when org-use-tag-inheritance
(save-excursion (save-excursion