From 7a72fc2605c3db7ce3fcdd81e3144ebe3dbee630 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sat, 19 Dec 2020 05:35:57 -0600 Subject: [PATCH 1/8] WIP --- org-ql.el | 110 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 96 insertions(+), 14 deletions(-) diff --git a/org-ql.el b/org-ql.el index 90586c3..1ea7152 100644 --- a/org-ql.el +++ b/org-ql.el @@ -1818,20 +1818,30 @@ the end of the entry, i.e. the position returned by bound to a different positiion, e.g. for planning lines, the end of the line after the heading." ;; MAYBE: Define active/inactive ones separately? - :normalizers ((`(,(or 'ts-active 'ts-a) . ,rest) `(ts :type active ,@rest)) - (`(,(or 'ts-inactive 'ts-i) . ,rest) `(ts :type inactive ,@rest))) - :preambles ((`(,predicate-names . ,rest) - (list :regexp (pcase (plist-get rest :type) - ((or 'nil 'both) org-tsr-regexp-both) - ('active org-tsr-regexp) - ('inactive org-ql-tsr-regexp-inactive)) - ;; Predicate needs testing only when args are present. - :query (-let (((&keys :from :to :on) rest)) - ;; FIXME: This used to be (when (or from to on) query), but that doesn't seem right, so I - ;; changed it to this if, and the tests pass either way. Might deserve a little scrutiny. - (if (or from to on) - query - t))))) + :normalizers + ((`(,(or 'ts-active 'ts-a) . ,rest) `(ts :type active ,@rest)) + (`(,(or 'ts-inactive 'ts-i) . ,rest) `(ts :type inactive ,@rest))) + :preambles + ((`(,predicate-names . ,(and rest (guard (or (plist-get rest :from) + (plist-get rest :to))))) + (-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))))) + (org-ql--ts-range-to-regexp from to)) + :query query))) + (`(,predicate-names . ,rest) + (list :regexp (pcase (plist-get rest :type) + ((or 'nil 'both) org-tsr-regexp-both) + ('active org-tsr-regexp) + ('inactive org-ql-tsr-regexp-inactive)) + ;; Predicate needs testing only when args are present. + :query (-let (((&keys :from :to :on) rest)) + ;; FIXME: This used to be (when (or from to on) query), but that doesn't seem right, so I + ;; changed it to this if, and the tests pass either way. Might deserve a little scrutiny. + (if (or from to on) + query + t))))) ;; TODO: DRY this with the clocked predicate. :body (cl-macrolet ((next-timestamp () @@ -1847,6 +1857,78 @@ of the line after the heading." (from (test-timestamps (ts<= from next-ts))) (to (test-timestamps (ts<= next-ts to))))))) +(defcustom org-ql-ts-days-to-default 365 + "Search up to this many days after now by default when using a timestamp predicate. +When a timestamp predicate is used without specifying a \"to\" +timestamp, search for timestamps that are up to this many days +from now. + +Since most searches are probably not for timestamps far into the +future, this helps optimize timestamp-related searches." + :type 'integer) + +(defcustom org-ql-ts-days-from-default (* 5 365) + "Search up to this many days before now by default when using a timestamp predicate. +When a timestamp predicate is used without specifying a \"from\" +timestamp, search for timestamps that are up to this many days +before now. + +Since most searches are probably not for timestamps far into the +past, this helps optimize timestamp-related searches. But unlike +`org-ql-ts-days-to-default', this defaults to a 5-year range, +because it's assumed that users are more likely to search an +archive of notes from years past." + :type 'integer) + +(cl-defun org-ql--ts-range-to-regexp (from to &key type require-time) + ;; Let's start with the plainest implementation: brute-force + ;; marching through all of the dates. + ;; MAYBE: Handle given hour/minute/second? + ;; FIXME: Docstring. + "Return a regexp matching timestamps in the range FROM-TO. +FROM and TO should be `ts' structs. TYPE may be `active', +`inactive', or nil to match both types." + ;; Set the H:M:S of each timestamp to the beginning/end of the day. + (setf from (ts-apply 'hour 0 'minute 0 'second 0 from) + to (ts-apply 'hour 23 'minute 59 'second 59 to)) + (let* ((type-prefix (pcase type + ((or 'nil 'both) (rx (any "<["))) + ('active (rx "<")) + ('inactive (rx "[")))) + (type-suffix (if require-time + (pcase type + ((or 'nil 'both) (rx (any ">]"))) + ('active (rx ">")) + ('inactive (rx "]"))) + "")) + (time-regexp (rx (1+ blank) + (repeat 1 2 (any "0-9")) ":" (= 2 (any "0-9")) + (0+ (any "0-9" " +.:dhmwy-")))) + (suffix (if require-time + (rx-to-string `(seq (regexp ,time-regexp) + (regexp ,type-suffix))) + (rx-to-string `(seq (0+ (regexp ,time-regexp)) + (regexp ,type-suffix))))) + years months days) + (cl-loop do (progn + (cl-pushnew (ts-year from) years) + (cl-pushnew (ts-month from) months) + (cl-pushnew (ts-day from) days)) + until (and (eql (ts-year from) (ts-year to)) + (eql (ts-month from) (ts-month to)) + (eql (ts-day from) (ts-day to))) + do (ts-incf (ts-day from))) + (cl-flet ((format-number + (number) (format "%02d" number))) + (rx-to-string `(seq (or bol space) + (regexp ,type-prefix) + (or ,@(mapcar #'format-number years)) "-" + (or ,@(mapcar #'format-number months)) "-" + (or ,@(mapcar #'format-number days)) + (regexp ,suffix) + (or eol space)) + t)))) + ;; NOTE: Predicates defined: stop deferring and define normalizer and ;; preamble functions now. Reversing preserves the order in which ;; they were defined. Generally it shouldn't matter, but it might... From 22b066ad8cdee41b06a5d65d07eba2cde01e532e Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sat, 19 Dec 2020 05:37:09 -0600 Subject: [PATCH 2/8] WIP --- org-ql.el | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/org-ql.el b/org-ql.el index 1ea7152..4b1e950 100644 --- a/org-ql.el +++ b/org-ql.el @@ -157,6 +157,29 @@ See Info node `(org-ql)Queries'." :type 'boolean :risky t) +(defcustom org-ql-ts-days-to-default 365 + "Search up to this many days after now by default when using a timestamp predicate. +When a timestamp predicate is used without specifying a \"to\" +timestamp, search for timestamps that are up to this many days +from now. + +Since most searches are probably not for timestamps far into the +future, this helps optimize timestamp-related searches." + :type 'integer) + +(defcustom org-ql-ts-days-from-default (* 5 365) + "Search up to this many days before now by default when using a timestamp predicate. +When a timestamp predicate is used without specifying a \"from\" +timestamp, search for timestamps that are up to this many days +before now. + +Since most searches are probably not for timestamps far into the +past, this helps optimize timestamp-related searches. But unlike +`org-ql-ts-days-to-default', this defaults to a 5-year range, +because it's assumed that users are more likely to search an +archive of notes from years past." + :type 'integer) + ;;;; Macros ;;;###autoload @@ -1823,7 +1846,8 @@ of the line after the heading." (`(,(or 'ts-inactive 'ts-i) . ,rest) `(ts :type inactive ,@rest))) :preambles ((`(,predicate-names . ,(and rest (guard (or (plist-get rest :from) - (plist-get rest :to))))) + (plist-get rest :to) + (plist-get rest :on))))) (-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)))) @@ -1857,29 +1881,6 @@ of the line after the heading." (from (test-timestamps (ts<= from next-ts))) (to (test-timestamps (ts<= next-ts to))))))) -(defcustom org-ql-ts-days-to-default 365 - "Search up to this many days after now by default when using a timestamp predicate. -When a timestamp predicate is used without specifying a \"to\" -timestamp, search for timestamps that are up to this many days -from now. - -Since most searches are probably not for timestamps far into the -future, this helps optimize timestamp-related searches." - :type 'integer) - -(defcustom org-ql-ts-days-from-default (* 5 365) - "Search up to this many days before now by default when using a timestamp predicate. -When a timestamp predicate is used without specifying a \"from\" -timestamp, search for timestamps that are up to this many days -before now. - -Since most searches are probably not for timestamps far into the -past, this helps optimize timestamp-related searches. But unlike -`org-ql-ts-days-to-default', this defaults to a 5-year range, -because it's assumed that users are more likely to search an -archive of notes from years past." - :type 'integer) - (cl-defun org-ql--ts-range-to-regexp (from to &key type require-time) ;; Let's start with the plainest implementation: brute-force ;; marching through all of the dates. From 73828a2543fd819720471a87cd8b7a80c76e13b8 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sun, 20 Dec 2020 07:30:09 -0600 Subject: [PATCH 3/8] WIP --- org-ql.el | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/org-ql.el b/org-ql.el index 4b1e950..79a4a1f 100644 --- a/org-ql.el +++ b/org-ql.el @@ -1805,8 +1805,19 @@ parseable by `parse-time-string' which may omit the time value." (ts-adjust 'day num-days) (ts-apply :hour 23 :minute 59 :second 59)))) `(scheduled :to ,to)))) - :preambles ((`(,predicate-names . ,_) - (list :regexp org-scheduled-time-regexp :query query))) + :preambles + ((`(,predicate-names . ,(and rest (guard (or (plist-get rest :from) + (plist-get rest :to) + (plist-get rest :on))))) + (-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) "SCHEDULED:" (1+ blank) (regexp ,ts-regexp)))) + :query query))) + (`(,predicate-names . ,_) + (list :regexp org-scheduled-time-regexp :query query))) :body (org-ql--predicate-ts :from from :to to :regexp org-scheduled-time-regexp :match-group 1 :limit (line-end-position 2))) @@ -1896,19 +1907,22 @@ FROM and TO should be `ts' structs. TYPE may be `active', ((or 'nil 'both) (rx (any "<["))) ('active (rx "<")) ('inactive (rx "[")))) - (type-suffix (if require-time - (pcase type - ((or 'nil 'both) (rx (any ">]"))) - ('active (rx ">")) - ('inactive (rx "]"))) - "")) + (type-suffix (pcase type + ((or 'nil 'both) (rx (any ">]"))) + ('active (rx ">")) + ('inactive (rx "]")))) (time-regexp (rx (1+ blank) (repeat 1 2 (any "0-9")) ":" (= 2 (any "0-9")) - (0+ (any "0-9" " +.:dhmwy-")))) + (0+ (not (any ">]"))) + ;; NOTE: We don't need to test for a + ;; repeater at this time, but it might be + ;; useful in the future, so leaving this + ;; commented: (0+ (any "0-9" " +.:dhmwy-")) + )) (suffix (if require-time (rx-to-string `(seq (regexp ,time-regexp) (regexp ,type-suffix))) - (rx-to-string `(seq (0+ (regexp ,time-regexp)) + (rx-to-string `(seq (repeat 0 1 (regexp ,time-regexp)) (regexp ,type-suffix))))) years months days) (cl-loop do (progn @@ -1921,13 +1935,14 @@ FROM and TO should be `ts' structs. TYPE may be `active', do (ts-incf (ts-day from))) (cl-flet ((format-number (number) (format "%02d" number))) - (rx-to-string `(seq (or bol space) - (regexp ,type-prefix) + (rx-to-string `(seq (regexp ,type-prefix) (or ,@(mapcar #'format-number years)) "-" (or ,@(mapcar #'format-number months)) "-" (or ,@(mapcar #'format-number days)) - (regexp ,suffix) - (or eol space)) + ;; Day of week. + (optional (1+ blank) + (1+ alpha)) + (regexp ,suffix)) t)))) ;; NOTE: Predicates defined: stop deferring and define normalizer and From eedbb60a776990e57ee0b80c59166aba98502383 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sun, 20 Dec 2020 08:01:51 -0600 Subject: [PATCH 4/8] WIP --- org-ql.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/org-ql.el b/org-ql.el index 79a4a1f..c57cb07 100644 --- a/org-ql.el +++ b/org-ql.el @@ -1908,12 +1908,14 @@ FROM and TO should be `ts' structs. TYPE may be `active', ('active (rx "<")) ('inactive (rx "[")))) (type-suffix (pcase type - ((or 'nil 'both) (rx (any ">]"))) - ('active (rx ">")) - ('inactive (rx "]")))) + ((or 'nil 'both) (rx (0+ (not (any ">]"))) + (any ">]"))) + ('active (rx (0+ (not (any ">"))) + ">")) + ('inactive (rx (0+ (not (any "]"))) + "]")))) (time-regexp (rx (1+ blank) (repeat 1 2 (any "0-9")) ":" (= 2 (any "0-9")) - (0+ (not (any ">]"))) ;; NOTE: We don't need to test for a ;; repeater at this time, but it might be ;; useful in the future, so leaving this From d0c3472de69d1e1dd3d1b2041b38d23005208156 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sun, 20 Dec 2020 08:51:39 -0600 Subject: [PATCH 5/8] WIP --- org-ql.el | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/org-ql.el b/org-ql.el index c57cb07..9b94a05 100644 --- a/org-ql.el +++ b/org-ql.el @@ -1772,13 +1772,27 @@ If ON, return non-nil if entry has a timestamp on date ON. FROM, TO, and ON should be either `ts' structs, or strings parseable by `parse-time-string' which may omit the time value." - :normalizers ((`(,predicate-names ,(and num-days (pred numberp))) - (let ((to (->> (ts-now) - (ts-adjust 'day num-days) - (ts-apply :hour 23 :minute 59 :second 59)))) - `(planning :to ,to)))) - :preambles ((`(,predicate-names . ,_) - (list :regexp org-ql-planning-regexp :query query))) + :normalizers + ((`(,predicate-names ,(and num-days (pred numberp))) + (let ((to (->> (ts-now) + (ts-adjust 'day num-days) + (ts-apply :hour 23 :minute 59 :second 59)))) + `(planning :to ,to)))) + :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))) + (rx-to-string `(seq bow (0+ blank) (or "CLOSED" "DEADLINE" "SCHEDULED") ":" + (1+ blank) (regexp ,ts-regexp)))) + :query query))) + (`(,predicate-names . ,_) + (list :regexp org-ql-planning-regexp :query query))) :body (org-ql--predicate-ts :from from :to to :regexp org-ql-planning-regexp :match-group 1 :limit (line-end-position 2))) @@ -1809,6 +1823,7 @@ parseable by `parse-time-string' which may omit the time value." ((`(,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)))) @@ -1859,6 +1874,7 @@ of the line after the heading." ((`(,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)))) From 353237e726b2799862270024af227771a4c49fbe Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sun, 20 Dec 2020 08:58:10 -0600 Subject: [PATCH 6/8] WIP --- org-ql.el | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/org-ql.el b/org-ql.el index 9b94a05..7c890c6 100644 --- a/org-ql.el +++ b/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 parseable by `parse-time-string' which may omit the time value." - :normalizers ((`(,predicate-names auto) - ;; Use `org-deadline-warning-days' as the :to arg. - (let ((to (->> (ts-now) - (ts-adjust 'day org-deadline-warning-days) - (ts-apply :hour 23 :minute 59 :second 59)))) - `(deadline-warning :to ,to))) - (`(,predicate-names ,(and num-days (pred numberp))) - (let ((to (->> (ts-now) - (ts-adjust 'day num-days) - (ts-apply :hour 23 :minute 59 :second 59)))) - `(deadline :to ,to)))) + :normalizers + ((`(,predicate-names auto) + ;; Use `org-deadline-warning-days' as the :to arg. + (let ((to (->> (ts-now) + (ts-adjust 'day org-deadline-warning-days) + (ts-apply :hour 23 :minute 59 :second 59)))) + `(deadline-warning :to ,to))) + (`(,predicate-names ,(and num-days (pred numberp))) + (let ((to (->> (ts-now) + (ts-adjust 'day num-days) + (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.) - :preambles ((`(,predicate-names . ,_) - (list :regexp org-deadline-time-regexp :query query))) + :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 '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 (org-ql--predicate-ts :from from :to to :regexp org-deadline-time-regexp :match-group 1 :limit (line-end-position 2))) From dd287beca07bca7a43575f7e927905cfa3cde0fc Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sun, 20 Dec 2020 09:05:31 -0600 Subject: [PATCH 7/8] WIP --- org-ql.el | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/org-ql.el b/org-ql.el index 7c890c6..1d733d5 100644 --- a/org-ql.el +++ b/org-ql.el @@ -1679,15 +1679,28 @@ If ON, return non-nil if entry has a timestamp on date ON. FROM, TO, and ON should be either `ts' structs, or strings parseable by `parse-time-string' which may omit the time value." - :normalizers ((`(,predicate-names ,(and num-days (pred numberp))) - ;; (clocked) and (closed) implicitly look into the past. - (let ((from (->> (ts-now) - (ts-adjust 'day (* -1 num-days)) - (ts-apply :hour 0 :minute 0 :second 0)))) - `(closed :from ,from)))) - :preambles ((`(,predicate-names . ,_) - ;; Predicate still needs testing. - (list :regexp org-closed-time-regexp :query query))) + :normalizers + ((`(,predicate-names ,(and num-days (pred numberp))) + ;; (clocked) and (closed) implicitly look into the past. + (let ((from (->> (ts-now) + (ts-adjust 'day (* -1 num-days)) + (ts-apply :hour 0 :minute 0 :second 0)))) + `(closed :from ,from)))) + :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. + (list :regexp org-closed-time-regexp :query query))) :body (org-ql--predicate-ts :from from :to to :regexp org-closed-time-regexp :match-group 1 :limit (line-end-position 2))) From 1396c6f964486e4109e66d5d333331c438198161 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sun, 20 Dec 2020 09:37:23 -0600 Subject: [PATCH 8/8] WIP --- org-ql.el | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/org-ql.el b/org-ql.el index 1d733d5..7e3766b 100644 --- a/org-ql.el +++ b/org-ql.el @@ -1649,16 +1649,29 @@ If ON, return non-nil if entry has a timestamp on date ON. FROM, TO, and ON should be either `ts' structs, or strings parseable by `parse-time-string' which may omit the time value." - :normalizers ((`(,predicate-names ,(and num-days (pred numberp))) - ;; (clocked) and (closed) implicitly look into the past. - (let ((from (->> (ts-now) - (ts-adjust 'day (* -1 num-days)) - (ts-apply :hour 0 :minute 0 :second 0)))) - `(clocked :from ,from)))) - :preambles ((`(,predicate-names ,(pred numberp)) - (list :regexp org-ql-clock-regexp :query t)) - (`(,predicate-names) - (list :regexp org-ql-clock-regexp :query t))) + :normalizers + ((`(,predicate-names ,(and num-days (pred numberp))) + ;; (clocked) and (closed) implicitly look into the past. + (let ((from (->> (ts-now) + (ts-adjust 'day (* -1 num-days)) + (ts-apply :hour 0 :minute 0 :second 0)))) + `(clocked :from ,from)))) + :preambles + ((`(,predicate-names ,(pred numberp)) + (list :regexp org-ql-clock-regexp :query t)) + (`(,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 bol (0+ blank) "CLOCK:" (1+ blank) (0+ not-newline) (regexp ,ts-regexp)))) + :query query))) + (`(,predicate-names) + (list :regexp org-ql-clock-regexp :query t))) :body (org-ql--predicate-ts :from from :to to :regexp org-ql-clock-regexp :match-group 1))