WIP
This commit is contained in:
parent
d0c3472de6
commit
353237e726
1 changed files with 26 additions and 13 deletions
39
org-ql.el
39
org-ql.el
|
|
@ -1709,20 +1709,33 @@ 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 auto)
|
:normalizers
|
||||||
;; Use `org-deadline-warning-days' as the :to arg.
|
((`(,predicate-names auto)
|
||||||
(let ((to (->> (ts-now)
|
;; Use `org-deadline-warning-days' as the :to arg.
|
||||||
(ts-adjust 'day org-deadline-warning-days)
|
(let ((to (->> (ts-now)
|
||||||
(ts-apply :hour 23 :minute 59 :second 59))))
|
(ts-adjust 'day org-deadline-warning-days)
|
||||||
`(deadline-warning :to ,to)))
|
(ts-apply :hour 23 :minute 59 :second 59))))
|
||||||
(`(,predicate-names ,(and num-days (pred numberp)))
|
`(deadline-warning :to ,to)))
|
||||||
(let ((to (->> (ts-now)
|
(`(,predicate-names ,(and num-days (pred numberp)))
|
||||||
(ts-adjust 'day num-days)
|
(let ((to (->> (ts-now)
|
||||||
(ts-apply :hour 23 :minute 59 :second 59))))
|
(ts-adjust 'day num-days)
|
||||||
`(deadline :to ,to))))
|
(ts-apply :hour 23 :minute 59 :second 59))))
|
||||||
|
`(deadline :to ,to))))
|
||||||
;; NOTE: Does this normalizer cause the preamble to not be used? (Adding one to the deadline-warning definition to be sure.)
|
;; NOTE: Does this normalizer cause the preamble to not be used? (Adding one to the deadline-warning definition to be sure.)
|
||||||
:preambles ((`(,predicate-names . ,_)
|
:preambles
|
||||||
(list :regexp org-deadline-time-regexp :query query)))
|
((`(,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 'active)))
|
||||||
|
(rx-to-string `(seq bow (0+ blank) "DEADLINE:" (1+ blank) (regexp ,ts-regexp))))
|
||||||
|
:query query)))
|
||||||
|
(`(,predicate-names . ,_)
|
||||||
|
(list :regexp org-deadline-time-regexp :query query)))
|
||||||
:body
|
:body
|
||||||
(org-ql--predicate-ts :from from :to to :regexp org-deadline-time-regexp :match-group 1
|
(org-ql--predicate-ts :from from :to to :regexp org-deadline-time-regexp :match-group 1
|
||||||
:limit (line-end-position 2)))
|
:limit (line-end-position 2)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue