From 6afe3be5721d6625eac5bc7c900d88d4ce1387c8 Mon Sep 17 00:00:00 2001 From: Akira Komamura Date: Wed, 28 Jul 2021 17:31:29 +0900 Subject: [PATCH 1/2] Add: (blocked) predicate --- README.org | 1 + org-ql.el | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/README.org b/README.org index 7b66d344..91278897 100644 --- a/README.org +++ b/README.org @@ -254,6 +254,7 @@ Arguments are listed next to predicate names, where applicable. + =tags-regexp (&rest regexps)= :: Return non-nil if current heading has tags matching one or more of ~REGEXPS~. Tests both inherited and local tags. - Aliases: ~tags*~. + =todo (&optional keywords)= :: Return non-nil if current heading is a ~TODO~ item. With ~KEYWORDS~, return non-nil if its keyword is one of ~KEYWORDS~ (a list of strings). When called without arguments, only matches non-done tasks (i.e. does not match keywords in ~org-done-keywords~). ++ =blocked= :: Return non-nil if current heading is blocked. *** Ancestor/descendant predicates diff --git a/org-ql.el b/org-ql.el index 3c70b34e..87a090c3 100644 --- a/org-ql.el +++ b/org-ql.el @@ -2377,6 +2377,11 @@ any planning prefix); it defaults to 0 (i.e. the whole regexp)." (from (test-timestamps (ts<= from next-ts))) (to (test-timestamps (ts<= next-ts to))))))) +(org-ql-defpred blocked () + "Return non-nil if the entry is blocked." + :body + (org-entry-blocked-p)) + ;; NOTE: Predicates defined: stop deferring and define normalizer and ;; preamble functions now. Reversing preserves the order in which ;; they were defined. Generally it shouldn't matter, but it might... From 902dad04c10e9215db3c49e33abb30b21e41f44e Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Fri, 10 Mar 2023 03:36:21 -0600 Subject: [PATCH 2/2] Docs/Tidy: Update readme, reorder forms --- README.org | 3 +- org-ql.el | 10 +++--- org-ql.info | 97 ++++++++++++++++++++++++++++------------------------- 3 files changed, 58 insertions(+), 52 deletions(-) diff --git a/README.org b/README.org index 91278897..e19b3d66 100644 --- a/README.org +++ b/README.org @@ -221,6 +221,7 @@ Note that the =effort=, =level=, and =priority= predicates do not support compar Arguments are listed next to predicate names, where applicable. ++ =blocked= :: Return non-nil if current heading is blocked. Calls ~org-entry-blocked-p~, which see. + =category (&optional categories)= :: Return non-nil if current heading is in one or more of ~CATEGORIES~ (a list of strings). + =done= :: Return non-nil if entry's ~TODO~ keyword is in ~org-done-keywords~. + =effort (&optional effort-or-comparator effort)= :: Return non-nil if current heading's effort property matches arguments. The following forms are accepted: ~(effort DURATION)~: Matches if effort is ~DURATION~. ~(effort DURATION DURATION)~: Matches if effort is between DURATIONs, inclusive. ~(effort COMPARATOR DURATION)~: Matches if effort compares to ~DURATION~ with ~COMPARATOR~. ~COMPARATOR~ may be ~<~, ~<=~, ~>~, or ~>=~. ~DURATION~ should be an Org effort string, like =5= or =0:05=. @@ -254,7 +255,6 @@ Arguments are listed next to predicate names, where applicable. + =tags-regexp (&rest regexps)= :: Return non-nil if current heading has tags matching one or more of ~REGEXPS~. Tests both inherited and local tags. - Aliases: ~tags*~. + =todo (&optional keywords)= :: Return non-nil if current heading is a ~TODO~ item. With ~KEYWORDS~, return non-nil if its keyword is one of ~KEYWORDS~ (a list of strings). When called without arguments, only matches non-done tasks (i.e. does not match keywords in ~org-done-keywords~). -+ =blocked= :: Return non-nil if current heading is blocked. *** Ancestor/descendant predicates @@ -552,6 +552,7 @@ Simple links may also be written manually in either sexp or non-sexp form, like: + Option ~org-ql-default-predicate~, applied to plain-string query tokens (before, the ~regexp~ predicate was always used, but now it may be customized). + Alias ~c~ for predicate ~category~. + Predicate ~property~ now accepts the argument ~:inherit~ to match entries with property inheritance, and when unspecified, the option ~org-use-property-inheritance~ controls whether inheritance is used. ++ Predicate ~blocked~. (Thanks to [[https://github.com/akirak][Akira Komamura]].) *Changed* + Give more useful error message for invalid queries. diff --git a/org-ql.el b/org-ql.el index 87a090c3..acfe8c0c 100644 --- a/org-ql.el +++ b/org-ql.el @@ -1333,6 +1333,11 @@ result form." ;; redefinitions until all of the predicates have been defined. (setf org-ql-defpred-defer t) +(org-ql-defpred blocked () + "Return non-nil if entry is blocked. +Calls `org-entry-blocked-p', which see." + :body (org-entry-blocked-p)) + (org-ql-defpred (category c) (&rest categories) "Return non-nil if current heading is in one or more of CATEGORIES." :normalizers ((`(,predicate-names . ,rest) @@ -2377,11 +2382,6 @@ any planning prefix); it defaults to 0 (i.e. the whole regexp)." (from (test-timestamps (ts<= from next-ts))) (to (test-timestamps (ts<= next-ts to))))))) -(org-ql-defpred blocked () - "Return non-nil if the entry is blocked." - :body - (org-entry-blocked-p)) - ;; NOTE: Predicates defined: stop deferring and define normalizer and ;; preamble functions now. Reversing preserves the order in which ;; they were defined. Generally it shouldn't matter, but it might... diff --git a/org-ql.info b/org-ql.info index 68572390..ec95d268 100644 --- a/org-ql.info +++ b/org-ql.info @@ -415,6 +415,9 @@ File: README.info, Node: General predicates, Next: Ancestor/descendant predica Arguments are listed next to predicate names, where applicable. +‘blocked’ + Return non-nil if current heading is blocked. Calls + ‘org-entry-blocked-p’, which see. ‘category (&optional categories)’ Return non-nil if current heading is in one or more of ‘CATEGORIES’ (a list of strings). @@ -1042,6 +1045,8 @@ File: README.info, Node: 07-pre, Next: 063, Up: Changelog entries with property inheritance, and when unspecified, the option ‘org-use-property-inheritance’ controls whether inheritance is used. + • Predicate ‘blocked’. (Thanks to Akira Komamura + (https://github.com/akirak).) *Changed* • Give more useful error message for invalid queries. @@ -1711,52 +1716,52 @@ Node: org-ql-sparse-tree8594 Node: Queries9394 Node: Non-sexp query syntax10511 Node: General predicates12270 -Node: Ancestor/descendant predicates19142 -Node: Date/time predicates20270 -Node: Functions / Macros23394 -Node: Agenda-like views23692 -Ref: Function ‘org-ql-block’23854 -Node: Listing / acting-on results25115 -Ref: Caching25323 -Ref: Function ‘org-ql-select’26236 -Ref: Function ‘org-ql-query’28662 -Ref: Macro ‘org-ql’ (deprecated)30436 -Node: Custom predicates30751 -Ref: Macro ‘org-ql-defpred’30975 -Node: Dynamic block34416 -Node: Links37140 -Node: Tips37827 -Node: Changelog38151 -Node: 07-pre38934 -Node: 06341436 -Node: 06241971 -Node: 06142276 -Node: 0642844 -Node: 05245898 -Node: 05146198 -Node: 0546621 -Node: 04948150 -Node: 04848430 -Node: 04748779 -Node: 04649188 -Node: 04549596 -Node: 04449957 -Node: 04350316 -Node: 04250519 -Node: 04150680 -Node: 0450927 -Node: 03255028 -Node: 03155431 -Node: 0355628 -Node: 02358928 -Node: 02259162 -Node: 02159442 -Node: 0259647 -Node: 0163725 -Node: Notes63826 -Node: Comparison with Org Agenda searches63988 -Node: org-sidebar64877 -Node: License65156 +Node: Ancestor/descendant predicates19257 +Node: Date/time predicates20385 +Node: Functions / Macros23509 +Node: Agenda-like views23807 +Ref: Function ‘org-ql-block’23969 +Node: Listing / acting-on results25230 +Ref: Caching25438 +Ref: Function ‘org-ql-select’26351 +Ref: Function ‘org-ql-query’28777 +Ref: Macro ‘org-ql’ (deprecated)30551 +Node: Custom predicates30866 +Ref: Macro ‘org-ql-defpred’31090 +Node: Dynamic block34531 +Node: Links37255 +Node: Tips37942 +Node: Changelog38266 +Node: 07-pre39049 +Node: 06341645 +Node: 06242180 +Node: 06142485 +Node: 0643053 +Node: 05246107 +Node: 05146407 +Node: 0546830 +Node: 04948359 +Node: 04848639 +Node: 04748988 +Node: 04649397 +Node: 04549805 +Node: 04450166 +Node: 04350525 +Node: 04250728 +Node: 04150889 +Node: 0451136 +Node: 03255237 +Node: 03155640 +Node: 0355837 +Node: 02359137 +Node: 02259371 +Node: 02159651 +Node: 0259856 +Node: 0163934 +Node: Notes64035 +Node: Comparison with Org Agenda searches64197 +Node: org-sidebar65086 +Node: License65365  End Tag Table