diff --git a/notes.org b/notes.org index 8397172..fff5876 100644 --- a/notes.org +++ b/notes.org @@ -430,6 +430,32 @@ Not sure if clearing the cache is necessary here, because it seemed to make near :action '(org-get-heading t t)))))) #+END_SRC +*** =closed= + +#+BEGIN_SRC elisp + (org-ql-preamble-bench :times 1 + :file "~/org/inbox.org" + :query (closed)) +#+END_SRC + +#+RESULTS: +| Form | x faster than next | Total runtime | # of GCs | Total GC runtime | +|-----------------------+--------------------+---------------+----------+------------------| +| preamble: (closed) | 4.80 | 0.086553 | 0 | 0 | +| no preamble: (closed) | slowest | 0.415165 | 0 | 0 | + +#+BEGIN_SRC elisp + (org-ql-preamble-bench :times 1 + :file "~/org/inbox.org" + :query (closed <= "2019-01-01")) +#+END_SRC + +#+RESULTS: +| Form | x faster than next | Total runtime | # of GCs | Total GC runtime | +|---------------------------------------+--------------------+---------------+----------+------------------| +| preamble: (closed <= "2019-01-01") | 4.21 | 0.105782 | 0 | 0 | +| no preamble: (closed <= "2019-01-01") | slowest | 0.445374 | 0 | 0 | + *** =deadline= #+BEGIN_SRC elisp diff --git a/org-ql.el b/org-ql.el index 0cdaa2c..b66f0a3 100644 --- a/org-ql.el +++ b/org-ql.el @@ -316,6 +316,15 @@ replace the clause with a preamble." element) (pcase element (`(or _) element) + (`(closed . ,_) + (setq org-ql-preamble + (rx-to-string `(seq bol (0+ (any " ")) "CLOSED" ":" (1+ space) (1+ not-newline)) t)) + ;; Return element, because the predicate still needs testing. + element) + (`(closed) + (setq org-ql-preamble (rx-to-string `(seq bol (0+ (any " ")) "CLOSED" ":") t)) + ;; Return element, because the predicate still needs testing. + element) (`(deadline . ,_) (setq org-ql-preamble (rx-to-string `(seq bol (0+ (any " ")) "DEADLINE" ":" (1+ space) (1+ not-newline)) t))