Merge: 0.2.2

This commit is contained in:
Adam Porter 2019-10-02 16:09:31 -05:00
commit c9ad34c47f
2 changed files with 16 additions and 12 deletions

View file

@ -499,6 +499,11 @@ Expands into a call to ~org-ql-select~ with the same arguments. For convenience
*Internal* *Internal*
+ Refactored code from file =org-ql-agenda.el= into files =org-ql-search.el= and =org-ql-view.el=. Function and variable names have been changed accordingly. + Refactored code from file =org-ql-agenda.el= into files =org-ql-search.el= and =org-ql-view.el=. Function and variable names have been changed accordingly.
** 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*

View file

@ -1016,9 +1016,7 @@ parseable by `parse-time-string' which may omit the time value."
:limit (line-end-position 2))) :limit (line-end-position 2)))
(org-ql--defpred deadline-warning (&key from to) (org-ql--defpred deadline-warning (&key from to)
"Internal selector used to handle `org-deadline-warning-days' and deadlines with warning periods. "Internal selector used to handle `org-deadline-warning-days' and deadlines with warning periods."
Should be called on a planning line, because it does not search
past the end of the current line."
(save-excursion (save-excursion
(forward-line 1) (forward-line 1)
(when (re-search-forward org-deadline-time-regexp (line-end-position) t) (when (re-search-forward org-deadline-time-regexp (line-end-position) t)
@ -1031,15 +1029,16 @@ past the end of the current line."
(`(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))
(->> ts (ts-adjust unit (* -1 warning-value))))
('week (->> ts (ts-adjust 'day (* -7 warning-value)))))))
(cond ((and from to) (ts-in from to ts)) (cond ((and from to) (ts-in from to ts))
(from (ts<= from ts)) (from (ts<= from ts))
(to (ts<= ts to))))))) (to (ts<= ts to))))
;; Deadline has warning unit: compare with current time (`org-ql--today').
((and unit (or 'year 'month 'day))
(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"