diff --git a/notes.org b/notes.org index f7f2d75..7f834e0 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 +*** =deadline= + +#+BEGIN_SRC elisp + (org-ql-preamble-bench :times 1 + :file "~/org/inbox.org" + :query (deadline)) +#+END_SRC + +#+RESULTS: +| Form | x faster than next | Total runtime | # of GCs | Total GC runtime | +|-------------------------+--------------------+---------------+----------+------------------| +| preamble: (deadline) | 27.63 | 0.014656 | 0 | 0 | +| no preamble: (deadline) | slowest | 0.404952 | 0 | 0 | + +#+BEGIN_SRC elisp + (org-ql-preamble-bench :times 1 + :file "~/org/inbox.org" + :query (deadline <= "2019-01-01")) +#+END_SRC + +#+RESULTS: +| Form | x faster than next | Total runtime | # of GCs | Total GC runtime | +|-----------------------------------------+--------------------+---------------+----------+------------------| +| preamble: (deadline <= "2019-01-01") | 27.91 | 0.014606 | 0 | 0 | +| no preamble: (deadline <= "2019-01-01") | slowest | 0.407682 | 0 | 0 | + *** =level= #+BEGIN_SRC elisp diff --git a/org-ql.el b/org-ql.el index 58a3286..0a9f431 100644 --- a/org-ql.el +++ b/org-ql.el @@ -316,6 +316,15 @@ replace the clause with a preamble." element) (pcase element (`(or _) element) + (`(deadline . ,_) + (setq org-ql-preamble + (rx-to-string `(seq bol (0+ (any " ")) "DEADLINE" ":" (1+ space) (1+ not-newline)) t)) + ;; Return element, because the predicate still needs testing. + element) + (`(deadline) + (setq org-ql-preamble (rx-to-string `(seq bol (0+ (any " ")) "DEADLINE" ":") t)) + ;; Return element, because the predicate still needs testing. + element) (`(regexp . ,regexps) (setq org-ql-preamble (rx-to-string `(or ,@regexps) t)) ;; Return nil, because we don't need to test the predicate.