Fix: (heading) Only match against heading text

It should not match against e.g. tags strings or to-do keywords.  Note
that the (regexp) predicate still matches against those, because it
searches entire entries, from heading stars to the next entry.
This commit is contained in:
Adam Porter 2019-09-11 22:02:14 -05:00
parent 5574f33682
commit f55fe7ef79
2 changed files with 7 additions and 2 deletions

View file

@ -448,12 +448,14 @@ replace the clause with a preamble."
nil)
;; Heading text.
;; MAYBE: Adjust regexp to avoid matching in tag list.
(`(heading ,regexp)
;; Only one regexp: match with preamble only.
;; Only one regexp: match with preamble, then let predicate confirm (because
;; the match could be in e.g. the tags rather than the heading text).
(setq org-ql-preamble (rx-to-string `(seq bol (1+ "*") (1+ blank) (0+ nonl)
,regexp)
'no-group))
nil)
element)
(`(heading . ,regexps)
;; Multiple regexps: use preamble to match against first
;; regexp, then let the predicate match the rest.