From 2f9a7ab6b7eb7040dfc509ece316a138fab379ad Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Mon, 9 Sep 2019 13:40:56 -0500 Subject: [PATCH] Change: (heading) Match all regexps This makes more sense and should be more useful. --- README.org | 4 ++-- org-ql.el | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.org b/README.org index 6b60846..43b7239 100644 --- a/README.org +++ b/README.org @@ -211,7 +211,7 @@ Arguments are listed next to predicate names, where applicable. + ~descendants (&optional query)~ :: Return non-nil if current heading has descendant headings. If ~QUERY~, test it against descendant headings. This selector may be nested (if you can grok the nesting!). + ~done~ :: Return non-nil if entry's ~TODO~ keyword is in ~org-done-keywords~. + ~habit~ :: Return non-nil if entry is a habit. -+ ~heading (&rest regexps)~ :: Return non-nil if current entry's heading matches any of ~REGEXPS~ (regexp strings). ++ ~heading (&rest regexps)~ :: Return non-nil if current entry's heading matches all ~REGEXPS~ (regexp strings). + ~level (level-or-comparator &optional level)~ :: Return non-nil if current heading's outline level matches arguments. The following forms are accepted: ~(level NUMBER)~: Matches if heading level is ~NUMBER~. ~(level NUMBER NUMBER)~: Matches if heading level is equal to or between NUMBERs. ~(level COMPARATOR NUMBER)~: Matches if heading level compares to ~NUMBER~ with ~COMPARATOR~. ~COMPARATOR~ may be ~<~, ~<=~, ~>~, or ~>=~. + ~priority (&optional comparator-or-priority priority)~ :: Return non-nil if current heading has a certain priority. ~COMPARATOR-OR-PRIORITY~ should be either a comparator function, like ~<=~, or a priority string, like "A" (in which case (~=~ will be the comparator). If ~COMPARATOR-OR-PRIORITY~ is a comparator, ~PRIORITY~ should be a priority string. If both arguments are nil, return non-nil if heading has any defined priority. + ~property (property &optional value)~ :: Return non-nil if current entry has ~PROPERTY~ (a string), and optionally ~VALUE~ (a string). Note that property inheritance is currently /not/ enabled for this predicate. If you need to test with inheritance, you could use a custom predicate form, like ~(org-entry-get (point) "PROPERTY" 'inherit)~. @@ -470,7 +470,7 @@ Expands into a call to ~org-ql-select~ with the same arguments. For convenience + Variable =org-ql-block-header=, which overrides the default header in =org-ql-block= agenda blocks. *Changed* -+ Predicate =heading= now accepts multiple regexps. ++ Predicate =heading= now accepts multiple regexps, which are matched with boolean =AND=. ** 0.2.1 diff --git a/org-ql.el b/org-ql.el index f6185c0..85d33c9 100644 --- a/org-ql.el +++ b/org-ql.el @@ -903,10 +903,10 @@ priority." (re-search-forward regexp end t)))))) (org-ql--defpred heading (&rest regexps) - "Return non-nil if current entry's heading matches any of REGEXPS (regexp strings)." + "Return non-nil if current entry's heading matches all REGEXPS (regexp strings)." ;; TODO: In Org 9.2+, `org-get-heading' takes 2 more arguments. (let ((heading (org-get-heading 'no-tags 'no-todo))) - (--any (string-match it heading) regexps))) + (--all? (string-match it heading) regexps))) (org-ql--defpred property (property &optional value) "Return non-nil if current entry has PROPERTY (a string), and optionally VALUE (a string)."