From 6a9f5cc37c44c16956de74dfda197b10a2647401 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Wed, 22 Aug 2018 14:41:00 -0500 Subject: [PATCH] Add: Heading matcher This should also be easy to optimize with a buffer-wide regexp search. --- org-ql.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/org-ql.el b/org-ql.el index 0ff06a2..4edca3f 100644 --- a/org-ql.el +++ b/org-ql.el @@ -172,6 +172,7 @@ If NARROW is non-nil, buffer will not be widened." (tags #'org-ql--tags-p) (property #'org-ql--property-p) (regexp #'org-ql--regexp-p) + (heading #'org-ql--heading-p) (level #'org-ql--level-p) (org-back-to-heading #'outline-back-to-heading)) (save-excursion @@ -378,6 +379,10 @@ comparator, PRIORITY should be a priority string." (goto-char (line-beginning-position)) (re-search-forward regexp end t)))) +(defun org-ql--heading-p (regexp) + "Return non-nil if current entry's heading matches REGEXP." + (string-match regexp (org-get-heading 'no-tags 'no-todo))) + (defun org-ql--property-p (property &optional value) "Return non-nil if current entry has PROPERTY, and optionally VALUE." (pcase property