diff --git a/README.org b/README.org index e137b66..0235712 100644 --- a/README.org +++ b/README.org @@ -192,6 +192,7 @@ Arguments are listed next to predicate names, where applicable. + =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)~. + =regexp (&rest regexps)= :: Return non-nil if current entry matches all of ~REGEXPS~ (regexp strings). Matches against entire entry, from beginning of its heading to the next heading. + - Aliases: =r=. + ~src (&key lang regexps)~ :: Return non-nil if current entry contains an Org Babel source block. If ~LANG~ is non-nil, match blocks of that language. If ~REGEXPS~ is non-nil, require that block's contents match all regexps. + =tags (&optional tags)= :: Return non-nil if current heading has one or more of ~TAGS~ (a list of strings). Tests both inherited and local tags. + =tags-inherited (&optional tags)= :: Return non-nil if current heading's inherited tags include one or more of ~TAGS~ (a list of strings). If ~TAGS~ is nil, return non-nil if heading has any inherited tags. @@ -386,6 +387,7 @@ Expands into a call to ~org-ql-select~ with the same arguments. For convenience - Predicates =outline-path= (alias =olp=) and =outline-path-segment= (alias =olps=). - Predicate ~src~, which matches Org Babel source blocks. - Alias =h= for =heading= predicate. + - Alias =r= for =regexp= predicate. (Thanks to [[https://github.com/tumashu][Feng Shu]].) + Info manual. + Function ~helm-org-ql-source~, which returns a Helm source that searches given buffers/files with ~helm-org-ql~. It can be used for custom Helm commands that search certain files. diff --git a/org-ql.el b/org-ql.el index 7e15cc0..1f39d3f 100644 --- a/org-ql.el +++ b/org-ql.el @@ -575,6 +575,11 @@ Replaces bare strings with (regexp) selectors, and appropriate ;; "h" alias. `(heading ,@args)) + ;; Regexps. + (`(r . ,args) + ;; "r" alias. + `(regexp ,@args)) + ;; Outline paths. (`(,(or 'outline-path 'olp) . ,strings) ;; Regexp quote headings. @@ -1127,7 +1132,7 @@ priority B)." "Return non-nil if entry is a habit." (org-is-habit-p)) -(org-ql--defpred regexp (&rest regexps) +(org-ql--defpred (regexp r) (&rest regexps) "Return non-nil if current entry matches all of REGEXPS (regexp strings)." (let ((end (or (save-excursion (outline-next-heading)) diff --git a/org-ql.info b/org-ql.info index 29e105d..329057f 100644 --- a/org-ql.info +++ b/org-ql.info @@ -415,6 +415,7 @@ Arguments are listed next to predicate names, where applicable. Return non-nil if current entry matches all of ‘REGEXPS’ (regexp strings). Matches against entire entry, from beginning of its heading to the next heading. + • Aliases: r. ‘‘src (&key lang regexps)’’ Return non-nil if current entry contains an Org Babel source block. If ‘LANG’ is non-nil, match blocks of that language. If ‘REGEXPS’ @@ -714,6 +715,8 @@ File: README.info, Node: 04-pre, Next: 032, Up: Changelog (alias olps). • Predicate ‘src’, which matches Org Babel source blocks. • Alias h for heading predicate. + • Alias r for regexp predicate. (Thanks to Feng Shu + (https://github.com/tumashu).) • Info manual. • Function ‘helm-org-ql-source’, which returns a Helm source that searches given buffers/files with ‘helm-org-ql’. It can be used @@ -1012,24 +1015,24 @@ Node: org-ql-sparse-tree6951 Node: Queries7751 Node: Non-sexp query syntax8593 Node: Predicates10292 -Node: Date/time predicates15430 -Node: Functions / Macros18065 -Node: Agenda-like views18252 -Node: Listing / acting-on results19657 -Node: Changelog24259 -Node: 04-pre24796 -Node: 03226384 -Node: 03126765 -Node: 0326960 -Node: 02329933 -Node: 02230159 -Node: 02130425 -Node: 0230622 -Node: 0134655 -Node: Notes34754 -Node: Comparison with Org Agenda searches34916 -Node: org-sidebar35787 -Node: License36066 +Node: Date/time predicates15454 +Node: Functions / Macros18089 +Node: Agenda-like views18276 +Node: Listing / acting-on results19681 +Node: Changelog24283 +Node: 04-pre24820 +Node: 03226512 +Node: 03126893 +Node: 0327088 +Node: 02330061 +Node: 02230287 +Node: 02130553 +Node: 0230750 +Node: 0134783 +Node: Notes34882 +Node: Comparison with Org Agenda searches35044 +Node: org-sidebar35915 +Node: License36194  End Tag Table