Add: Convert bare strings to (regexp) predicates

This commit is contained in:
Adam Porter 2019-07-24 20:15:52 -05:00
parent 7c4297b667
commit 70176d9c5f
3 changed files with 60 additions and 3 deletions

View file

@ -103,6 +103,10 @@ Here's an example of using it to generate an agenda-like view for certain files
A query is a lisp form which may contain arbitrary lisp forms, as well as certain built-in predicates. It is byte-compiled into a predicate function which is tested with point on each heading in an Org buffer; when it returns non-nil, the heading matches the query.
*Notes:*
+ Bare strings like ~"string"~ are automatically converted to ~(regexp "string")~ predicates.
+ Standard numeric comparator function symbols (~<~, ~<=~, ~>~, ~>=~, ~=~ ) need not be quoted when passed as an argument to these predicates. The resemblance to infix notation is coincidental. See examples in documentation.
*** Predicates
:PROPERTIES:
:TOC: ignore
@ -110,8 +114,6 @@ A query is a lisp form which may contain arbitrary lisp forms, as well as certai
Arguments are listed next to predicate names, where applicable.
Note that, for convenience, standard numeric comparator function symbols (~<~, ~=~, etc.) do not need to be quoted when passed as an argument to these predicates. The resemblance to infix notation is coincidental. See examples in documentation.
+ ~category (&optional categories)~ :: Return non-nil if current heading is in one or more of ~CATEGORIES~ (a list of strings).
+ ~clocked (&key from to on)~ :: Return non-nil if current entry was clocked in given period. If no arguments are specified, return non-nil if entry was clocked at any time. If ~FROM~, return non-nil if entry was clocked on or after ~FROM~. If ~TO~, return non-nil if entry was clocked on or before ~TO~. If ~ON~, return non-nil if entry was clocked on date ~ON~. ~FROM~, ~TO~, and ~ON~ should be strings parseable by ~parse-time-string~ but may omit the time value. Note: Clock entries are expected to be clocked out. Currently clocked entries (i.e. with unclosed timestamp ranges) are ignored.
+ ~closed (&optional comparator target-date)~ :: Return non-nil if entry's closed date compares with ~TARGET-DATE~ using ~COMPARATOR~. ~TARGET-DATE~ should be a string parseable by ~date-to-day~. ~COMPARATOR~ should be a function (like ~<=~).
@ -309,6 +311,7 @@ Expands into a call to ~org-ql-select~ with the same arguments. For convenience
*Added*
+ Function ~org-ql-query~, like ~org-ql-select~ but with arguments named more like a SQL query.
+ Bare strings like ~"string"~ can be used in queries, which are converted to ~(regexp "string")~ automatically.
*Changed*
+ Function ~org-ql-query~ renamed to ~org-ql-select~.