This commit is contained in:
Adam Porter 2020-12-20 09:05:31 -06:00
parent 353237e726
commit dd287beca0

View file

@ -1679,13 +1679,26 @@ If ON, return non-nil if entry has a timestamp on date ON.
FROM, TO, and ON should be either `ts' structs, or strings FROM, TO, and ON should be either `ts' structs, or strings
parseable by `parse-time-string' which may omit the time value." parseable by `parse-time-string' which may omit the time value."
:normalizers ((`(,predicate-names ,(and num-days (pred numberp))) :normalizers
((`(,predicate-names ,(and num-days (pred numberp)))
;; (clocked) and (closed) implicitly look into the past. ;; (clocked) and (closed) implicitly look into the past.
(let ((from (->> (ts-now) (let ((from (->> (ts-now)
(ts-adjust 'day (* -1 num-days)) (ts-adjust 'day (* -1 num-days))
(ts-apply :hour 0 :minute 0 :second 0)))) (ts-apply :hour 0 :minute 0 :second 0))))
`(closed :from ,from)))) `(closed :from ,from))))
:preambles ((`(,predicate-names . ,_) :preambles
((`(,predicate-names . ,(and rest (guard (or (plist-get rest :from)
(plist-get rest :to)
(plist-get rest :on)))))
;; Use date-optimized timestamp regexp.
(-let (((&plist :from :to :on :type) rest))
(org-ql--from-to-on)
(list :regexp (-let* ((from (or from (ts-adjust 'day (- org-ql-ts-days-from-default) (ts-now))))
(to (or to (ts-adjust 'day org-ql-ts-days-to-default (ts-now))))
(ts-regexp (org-ql--ts-range-to-regexp from to :type 'inactive)))
(rx-to-string `(seq bow (0+ blank) "CLOSED:" (1+ blank) (regexp ,ts-regexp))))
:query query)))
(`(,predicate-names . ,_)
;; Predicate still needs testing. ;; Predicate still needs testing.
(list :regexp org-closed-time-regexp :query query))) (list :regexp org-closed-time-regexp :query query)))
:body :body