Fix: (deadline-warning) Timestamp-local warning periods
When a deadline had its own warning period, it was compared with the org-deadline-warning-days adjusted timestamp rather than the current timestamp, which matched deadlines that should not yet be matched.
This commit is contained in:
parent
527c6f5123
commit
f469ddc04c
2 changed files with 16 additions and 10 deletions
|
|
@ -441,6 +441,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.2.2
|
||||||
|
|
||||||
|
*Fixed*
|
||||||
|
+ =(deadline auto)= selector matched entries whose deadlines had a warning period that had not yet been entered (=org-deadline-warning-days= too soon).
|
||||||
|
|
||||||
** 0.2.1
|
** 0.2.1
|
||||||
|
|
||||||
*Fixed*
|
*Fixed*
|
||||||
|
|
|
||||||
21
org-ql.el
21
org-ql.el
|
|
@ -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.2.1
|
;; Version: 0.2.2
|
||||||
;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.0") (s "1.12.0") (ts "0.2"))
|
;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.0") (s "1.12.0") (ts "0.2"))
|
||||||
;; Keywords: hypermedia, outlines, Org, agenda
|
;; Keywords: hypermedia, outlines, Org, agenda
|
||||||
|
|
||||||
|
|
@ -899,15 +899,16 @@ parseable by `parse-time-string' which may omit the time value."
|
||||||
(`(planning ,tss) (plist-get tss :deadline))
|
(`(planning ,tss) (plist-get tss :deadline))
|
||||||
(`(timestamp . ,_) context)))
|
(`(timestamp . ,_) context)))
|
||||||
((_timestamp (&keys :warning-value :warning-unit)) deadline-ts-element)
|
((_timestamp (&keys :warning-value :warning-unit)) deadline-ts-element)
|
||||||
(ts (ts-parse-org-element deadline-ts-element))
|
(ts (ts-parse-org-element deadline-ts-element)))
|
||||||
(ts (pcase warning-unit
|
(pcase warning-unit
|
||||||
('nil ts)
|
('nil ;; Deadline has no warning unit: compare with ts passed in.
|
||||||
((and unit (or 'year 'month 'day))
|
(cond ((and from to) (ts-in from to ts))
|
||||||
(->> ts (ts-adjust unit (* -1 warning-value))))
|
(from (ts<= from ts))
|
||||||
('week (->> ts (ts-adjust 'day (* -7 warning-value)))))))
|
(to (ts<= ts to))))
|
||||||
(cond ((and from to) (ts-in from to ts))
|
;; Deadline has warning unit: compare with current time (`org-ql--today').
|
||||||
(from (ts<= from ts))
|
((and unit (or 'year 'month 'day))
|
||||||
(to (ts<= ts to)))))))
|
(ts<= (->> ts (ts-adjust unit (- warning-value))) org-ql--today))
|
||||||
|
('week (ts<= (->> ts (ts-adjust 'day (* -7 warning-value))) org-ql--today)))))))
|
||||||
|
|
||||||
(org-ql--defpred planning (&key from to _on)
|
(org-ql--defpred planning (&key from to _on)
|
||||||
;; The underscore before `on' prevents "unused lexical variable"
|
;; The underscore before `on' prevents "unused lexical variable"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue