Merge 277218ee88 into 98c62ab0a6
This commit is contained in:
commit
9439f5c291
1 changed files with 23 additions and 0 deletions
23
org-ql.el
23
org-ql.el
|
|
@ -64,6 +64,11 @@
|
||||||
Like `org-clock-line-re', but matches the timestamp range in a
|
Like `org-clock-line-re', but matches the timestamp range in a
|
||||||
match group.")
|
match group.")
|
||||||
|
|
||||||
|
(defconst org-ql-log-done-regexp
|
||||||
|
(rx bol "- State \"DONE\"" (1+ blank) "from \"WAITING\"" (1+ blank) (group (1+ not-newline)))
|
||||||
|
;; TODO: Remove hardcoded states, i.e DONE & WAITING
|
||||||
|
"Regular expression matching state changes")
|
||||||
|
|
||||||
(defconst org-ql-planning-regexp
|
(defconst org-ql-planning-regexp
|
||||||
(rx bol (0+ blank) (or "CLOSED" "DEADLINE" "SCHEDULED") ":" (1+ blank) (group (1+ not-newline)))
|
(rx bol (0+ blank) (or "CLOSED" "DEADLINE" "SCHEDULED") ":" (1+ blank) (group (1+ not-newline)))
|
||||||
"Regular expression matching Org \"planning\" lines.
|
"Regular expression matching Org \"planning\" lines.
|
||||||
|
|
@ -2242,6 +2247,24 @@ ignored."
|
||||||
:body
|
:body
|
||||||
(org-ql--predicate-ts :from from :to to :regexp org-ql-clock-regexp :match-group 1))
|
(org-ql--predicate-ts :from from :to to :regexp org-ql-clock-regexp :match-group 1))
|
||||||
|
|
||||||
|
(org-ql-defpred log-done (&key from to _on)
|
||||||
|
"Return non-nil if current entry contains DONE state change in given period."
|
||||||
|
:normalizers ((`(,predicate-names ,(and num-days (pred numberp)))
|
||||||
|
;; (clocked) and (closed) implicitly look into the past.
|
||||||
|
(let* ((from-day (* -1 num-days))
|
||||||
|
(rest (list :from from-day)))
|
||||||
|
(org-ql--normalize-from-to-on
|
||||||
|
`(log-done :from ,from))))
|
||||||
|
(`(,predicate-names . ,rest)
|
||||||
|
(org-ql--normalize-from-to-on
|
||||||
|
`(log-done :from ,from :to ,to))))
|
||||||
|
:preambles ((`(,predicate-names ,(pred numberp))
|
||||||
|
(list :regexp org-ql-log-done-regexp :query t))
|
||||||
|
(`(,predicate-names)
|
||||||
|
(list :regexp org-ql-log-done-regexp :query t)))
|
||||||
|
:body
|
||||||
|
(org-ql--predicate-ts :from from :to to :regexp org-ql-log-done-regexp :match-group 1))
|
||||||
|
|
||||||
(org-ql-defpred closed (&key from to _on)
|
(org-ql-defpred closed (&key from to _on)
|
||||||
;; MAYBE: Use the new org-ql-regexps?
|
;; MAYBE: Use the new org-ql-regexps?
|
||||||
"Return non-nil if current entry was closed in given period.
|
"Return non-nil if current entry was closed in given period.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue