From 29c3cdd3606c2da627f62a16a151e46cba3c590f Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Mon, 9 Sep 2019 13:41:31 -0500 Subject: [PATCH] Add: (heading) Preambles --- org-ql.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/org-ql.el b/org-ql.el index 85d33c9..e4a3ff7 100644 --- a/org-ql.el +++ b/org-ql.el @@ -447,6 +447,22 @@ replace the clause with a preamble." (setq org-ql-preamble (rx-to-string `(seq bol (0+ space) ":STYLE:" (1+ space) "habit" (0+ space) eol))) nil) + + ;; Heading text. + (`(heading ,regexp) + ;; Only one regexp: match with preamble only. + (setq org-ql-preamble (rx-to-string `(seq bol (1+ "*") (1+ blank) (0+ nonl) + ,regexp) + 'no-group)) + nil) + (`(heading . ,regexps) + ;; Multiple regexps: use preamble to match against first + ;; regexp, then let the predicate match the rest. + (setq org-ql-preamble (rx-to-string `(seq bol (1+ "*") (1+ blank) (0+ nonl) + ,(car regexps)) + 'no-group)) + element) + ;; Heading levels. (`(level ,comparator-or-num ,num) (let ((repeat (pcase comparator-or-num