WIP: Update docstrings, comments, and readme
This commit is contained in:
parent
8e93f4cbb3
commit
9e683e17c1
3 changed files with 146 additions and 200 deletions
24
README.org
24
README.org
|
|
@ -244,29 +244,30 @@ Arguments are listed next to predicate names, where applicable.
|
||||||
|
|
||||||
*** Date/time predicates
|
*** Date/time predicates
|
||||||
|
|
||||||
All of these predicates take optional keyword arguments ~:from~, ~:to:~, and ~:on~:
|
These predicates take optional keyword arguments:
|
||||||
|
|
||||||
+ If ~:from~, return non-nil if entry has a timestamp on or after ~:from~.
|
+ ~:from~: Match entries whose timestamp is on or after timestamp ~:from~.
|
||||||
+ If ~:to~, return non-nil if entry has a timestamp on or before ~:to~.
|
+ ~:to~: Match entries whose timestamp is on or before timestamp ~:to~.
|
||||||
+ If ~:on~, return non-nil if entry has a timestamp on date ~:on~.
|
+ ~:on~: Match entries whose timestamp is on date ~:on~.
|
||||||
|
+ ~:with-time~: If unspecified, match timestamps with or without times (i.e. HH:MM). If nil, match timestamps without times. If t, match timestamps with times.
|
||||||
|
|
||||||
Argument values should be either a number of days (positive to look forward, or negative to look backward), a ~ts~ struct, or a string parseable by ~parse-time-string~ (the string may omit the time value).
|
Timestamp/date arguments should be either a number of days (positive to look forward, or negative to look backward), a string parseable by ~parse-time-string~ (the string may omit the time value), or a ~ts~ struct.
|
||||||
|
|
||||||
+ *Predicates*
|
+ *Predicates*
|
||||||
- =ts= :: Return non-nil if current entry has a timestamp in given period. If no arguments are specified, return non-nil if entry has any timestamp.
|
- =ts= :: Return non-nil if current entry has a timestamp in given period. Without arguments, return non-nil if entry has a timestamp.
|
||||||
- =ts-active=, =ts-a= :: Like =ts=, but only matches active timestamps.
|
- =ts-active=, =ts-a= :: Like =ts=, but only matches active timestamps.
|
||||||
- =ts-inactive=, =ts-i= :: Like =ts=, but only matches inactive timestamps.
|
- =ts-inactive=, =ts-i= :: Like =ts=, but only matches inactive timestamps.
|
||||||
|
|
||||||
The following predicates, in addition to the keyword arguments, can also take a single argument, a number, which looks backward or forward a number of days. The number can be negative to invert the direction.
|
The following predicates, in addition to the keyword arguments, can also take a single argument, a number, which looks backward or forward a number of days. The number can be negative to invert the direction.
|
||||||
|
|
||||||
+ *Backward-looking*
|
+ *Backward-looking*
|
||||||
- =clocked= :: 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. Note: Clock entries are expected to be clocked out. Currently clocked entries (i.e. with unclosed timestamp ranges) are ignored.
|
- =clocked= :: Return non-nil if current entry was clocked in given period. Without arguments, return non-nil if entry was ever clocked. Note: Clock entries are expected to be clocked out. Currently clocked entries (i.e. with unclosed timestamp ranges) are ignored.
|
||||||
- =closed= :: Return non-nil if current entry was closed in given period. If no arguments are specified, return non-nil if entry was closed at any time.
|
- =closed= :: Return non-nil if current entry was closed in given period. Without arguments, return non-nil if entry is closed.
|
||||||
|
|
||||||
+ *Forward-looking*
|
+ *Forward-looking*
|
||||||
- =deadline= :: Return non-nil if current entry has deadline in given period. If argument is =auto=, return non-nil if entry has deadline within =org-deadline-warning-days=. If no arguments are specified, return non-nil if entry has any deadline.
|
- =deadline= :: Return non-nil if current entry has deadline in given period. If argument is =auto=, return non-nil if entry has deadline within =org-deadline-warning-days=. Without arguments, return non-nil if entry has any deadline.
|
||||||
- =planning= :: Return non-nil if current entry has planning timestamp in given period (i.e. its deadline, scheduled, or closed timestamp). If no arguments are specified, return non-nil if entry is scheduled at any time.
|
- =planning= :: Return non-nil if current entry has planning timestamp (i.e. its deadline, scheduled, or closed timestamp) in given period. Without arguments, return non-nil if entry has any planning timestamp.
|
||||||
- =scheduled= :: Return non-nil if current entry is scheduled in given period. If no arguments are specified, return non-nil if entry is scheduled at any time.
|
- =scheduled= :: Return non-nil if current entry is scheduled in given period. Without arguments, return non-nil if entry is scheduled.
|
||||||
|
|
||||||
** Functions / Macros
|
** Functions / Macros
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
|
|
@ -523,6 +524,7 @@ Simple links may also be written manually in either sexp or non-sexp form, like:
|
||||||
+ Macro =org-ql-defpred=, used to define search predicates. (See [[file:examples/defpred.org][tutorial]].)
|
+ Macro =org-ql-defpred=, used to define search predicates. (See [[file:examples/defpred.org][tutorial]].)
|
||||||
+ Predicate ~effort~.
|
+ Predicate ~effort~.
|
||||||
+ Predicate ~heading-regexp~, which matches regular expressions against heading text (alias: ~h*~).
|
+ Predicate ~heading-regexp~, which matches regular expressions against heading text (alias: ~h*~).
|
||||||
|
+ Timestamp-related predicates now accept an optional ~:with-time~ argument, which allows matching timestamps with or without times (i.e. HH:MM).
|
||||||
|
|
||||||
*Changed*
|
*Changed*
|
||||||
+ Helm support (including the command =helm-org-ql=) has been moved to a separate package, =helm-org-ql=.
|
+ Helm support (including the command =helm-org-ql=) has been moved to a separate package, =helm-org-ql=.
|
||||||
|
|
|
||||||
164
org-ql.el
164
org-ql.el
|
|
@ -1846,34 +1846,41 @@ With KEYWORDS, return non-nil if its keyword is one of KEYWORDS (a list of strin
|
||||||
|
|
||||||
;;;;;; Timestamps
|
;;;;;; Timestamps
|
||||||
|
|
||||||
;; TODO: Remove the _on vars from these arg lists. I think they're not
|
;; NOTE: The underscores before some arguments in these definitions
|
||||||
|
;; prevent "unused lexical variable" warnings, because we pre-process
|
||||||
|
;; them before the functions are called.
|
||||||
|
|
||||||
|
;; TODO: Remove the _underscored vars from these arg lists. I think they're not
|
||||||
;; necessary, or shouldn't be, since --pre-process-query should handle them.
|
;; necessary, or shouldn't be, since --pre-process-query should handle them.
|
||||||
|
|
||||||
;; NOTE: These docstrings apply to the functions defined by `org-ql--defpref',
|
;; NOTE: Arguments to these predicates are pre-processed in
|
||||||
;; not necessarily to the way users are expected to call them in queries. The
|
;; `org-ql--normalize-query' and `org-ql--query-predicate'. Some
|
||||||
;; queries are pre-processed by `org-ql--normalize-query' to handle
|
;; arguments are not to be given by the user in a query,
|
||||||
;; arguments which are constant during a query's execution.
|
;; e.g. `regexp'. FROM and TO are actually expected to be `ts'
|
||||||
|
;; structs. However, the docstrings are written for users, which
|
||||||
|
;; makes documentation easier to update.
|
||||||
|
|
||||||
;; TODO: Update the macro to define a user-facing docstring so I don't
|
;; TODO: Update the macro to define a user-facing docstring so I don't
|
||||||
;; have to manually update the documentation.
|
;; have to manually update the documentation.
|
||||||
|
|
||||||
(org-ql-defpred clocked (&key from to _on)
|
;; This string is common to these predicates and is used in
|
||||||
;; The underscore before `on' prevents "unused lexical variable"
|
;; documentation; keeping it here should make it easier to update:
|
||||||
;; warnings, because we pre-process that argument in a macro before
|
"If FROM, return non-nil if entry's timestamp is on or after FROM.
|
||||||
;; this function is called.
|
|
||||||
"Return non-nil if current entry was clocked in given period.
|
|
||||||
If no arguments are specified, return non-nil if entry has any
|
|
||||||
timestamp.
|
|
||||||
|
|
||||||
If FROM, return non-nil if entry has a timestamp on or after
|
If TO, return non-nil if entry's timestamp is on or before TO.
|
||||||
FROM.
|
|
||||||
|
|
||||||
If TO, return non-nil if entry has a timestamp on or before TO.
|
If ON, return non-nil if entry's timestamp is on date ON.
|
||||||
|
|
||||||
If ON, return non-nil if entry has a timestamp on date ON.
|
|
||||||
|
|
||||||
FROM, TO, and ON should be either `ts' structs, or strings
|
FROM, TO, and ON should be either `ts' structs, or strings
|
||||||
parseable by `parse-time-string' which may omit the time value."
|
parseable by `parse-time-string' which may omit the time value."
|
||||||
|
|
||||||
|
(org-ql-defpred clocked (&key from to _on)
|
||||||
|
"Return non-nil if current entry was clocked in given period.
|
||||||
|
Without arguments, return non-nil if entry was ever clocked.
|
||||||
|
Note: Clock entries are expected to be clocked out. Currently
|
||||||
|
clocked entries (i.e. with unclosed timestamp ranges) are
|
||||||
|
ignored."
|
||||||
|
;; TODO: Verify that currently clocked entries are still ignored.
|
||||||
:normalizers ((`(,predicate-names ,(and num-days (pred numberp)))
|
:normalizers ((`(,predicate-names ,(and num-days (pred numberp)))
|
||||||
;; (clocked) and (closed) implicitly look into the past.
|
;; (clocked) and (closed) implicitly look into the past.
|
||||||
(let ((from (->> (ts-now)
|
(let ((from (->> (ts-now)
|
||||||
|
|
@ -1888,23 +1895,9 @@ parseable by `parse-time-string' which may omit the time value."
|
||||||
(org-ql--predicate-ts :from from :to to :regexp org-ql-clock-regexp :match-group 1))
|
(org-ql--predicate-ts :from from :to to :regexp org-ql-clock-regexp :match-group 1))
|
||||||
|
|
||||||
(org-ql-defpred closed (&key from to _on)
|
(org-ql-defpred closed (&key from to _on)
|
||||||
;; TODO: Should this use the new org-ql-regexps?
|
;; MAYBE: Use the new org-ql-regexps?
|
||||||
;; The underscore before `on' prevents "unused lexical variable"
|
|
||||||
;; warnings, because we pre-process that argument in a macro before
|
|
||||||
;; this function is called.
|
|
||||||
"Return non-nil if current entry was closed in given period.
|
"Return non-nil if current entry was closed in given period.
|
||||||
If no arguments are specified, return non-nil if entry has any
|
Without arguments, return non-nil if entry is closed."
|
||||||
timestamp.
|
|
||||||
|
|
||||||
If FROM, return non-nil if entry has a timestamp on or after
|
|
||||||
FROM.
|
|
||||||
|
|
||||||
If TO, return non-nil if entry has a timestamp on or before TO.
|
|
||||||
|
|
||||||
If ON, return non-nil if entry has a timestamp on date ON.
|
|
||||||
|
|
||||||
FROM, TO, and ON should be either `ts' structs, or strings
|
|
||||||
parseable by `parse-time-string' which may omit the time value."
|
|
||||||
:normalizers ((`(,predicate-names ,(and num-days (pred numberp)))
|
:normalizers ((`(,predicate-names ,(and num-days (pred numberp)))
|
||||||
;; (clocked) and (closed) implicitly look into the past.
|
;; (clocked) and (closed) implicitly look into the past.
|
||||||
(let ((from (->> (ts-now)
|
(let ((from (->> (ts-now)
|
||||||
|
|
@ -1919,22 +1912,10 @@ parseable by `parse-time-string' which may omit the time value."
|
||||||
:limit (line-end-position 2)))
|
:limit (line-end-position 2)))
|
||||||
|
|
||||||
(org-ql-defpred deadline (&key from to _on regexp _with-time)
|
(org-ql-defpred deadline (&key from to _on regexp _with-time)
|
||||||
;; The underscore before `on' prevents "unused lexical variable"
|
|
||||||
;; warnings, because we pre-process that argument in a macro before
|
|
||||||
;; this function is called.
|
|
||||||
"Return non-nil if current entry has deadline in given period.
|
"Return non-nil if current entry has deadline in given period.
|
||||||
If no arguments are specified, return non-nil if entry has any
|
If argument is `auto', return non-nil if entry has deadline
|
||||||
timestamp.
|
within `org-deadline-warning-days'. Without arguments, return
|
||||||
|
non-nil if entry has a deadline."
|
||||||
If FROM, return non-nil if entry has a timestamp on or after
|
|
||||||
FROM.
|
|
||||||
|
|
||||||
If TO, return non-nil if entry has a timestamp on or before TO.
|
|
||||||
|
|
||||||
If ON, return non-nil if entry has a timestamp on date ON.
|
|
||||||
|
|
||||||
FROM, TO, and ON should be either `ts' structs, or strings
|
|
||||||
parseable by `parse-time-string' which may omit the time value."
|
|
||||||
:normalizers ((`(,predicate-names auto)
|
:normalizers ((`(,predicate-names auto)
|
||||||
;; Use `org-deadline-warning-days' as the :to arg.
|
;; Use `org-deadline-warning-days' as the :to arg.
|
||||||
(let ((to (->> (ts-now)
|
(let ((to (->> (ts-now)
|
||||||
|
|
@ -1946,7 +1927,8 @@ parseable by `parse-time-string' which may omit the time value."
|
||||||
(ts-adjust 'day num-days)
|
(ts-adjust 'day num-days)
|
||||||
(ts-apply :hour 23 :minute 59 :second 59))))
|
(ts-apply :hour 23 :minute 59 :second 59))))
|
||||||
`(deadline :to ,to))))
|
`(deadline :to ,to))))
|
||||||
;; NOTE: Does this normalizer cause the preamble to not be used? (Adding one to the deadline-warning definition to be sure.)
|
;; NOTE: Does this normalizer cause the preamble to not be used?
|
||||||
|
;; (Adding one to the deadline-warning definition to be sure.)
|
||||||
:preambles ((`(,predicate-names . ,rest)
|
:preambles ((`(,predicate-names . ,rest)
|
||||||
(list :query query
|
(list :query query
|
||||||
:regexp (pcase-exhaustive (org-ql--plist-get* rest :with-time)
|
:regexp (pcase-exhaustive (org-ql--plist-get* rest :with-time)
|
||||||
|
|
@ -1959,8 +1941,8 @@ parseable by `parse-time-string' which may omit the time value."
|
||||||
|
|
||||||
(org-ql-defpred deadline-warning (&key from to)
|
(org-ql-defpred deadline-warning (&key from to)
|
||||||
;; TODO: Should this also accept a WITH-TIME argument?
|
;; TODO: Should this also accept a WITH-TIME argument?
|
||||||
;; TODO: Should this use the new org-ql-regexps?
|
;; MAYBE: Use the new org-ql-regexps?
|
||||||
"Internal selector used to handle `org-deadline-warning-days' and deadlines with warning periods."
|
"Internal predicate used to handle `org-deadline-warning-days' and deadlines with warning periods."
|
||||||
:preambles ((`(,predicate-names . ,_)
|
:preambles ((`(,predicate-names . ,_)
|
||||||
(list :regexp org-deadline-time-regexp :query query)))
|
(list :regexp org-deadline-time-regexp :query query)))
|
||||||
:body
|
:body
|
||||||
|
|
@ -1988,23 +1970,8 @@ parseable by `parse-time-string' which may omit the time value."
|
||||||
('week (ts<= (->> ts (ts-adjust 'day (* -7 warning-value))) org-ql--today)))))))
|
('week (ts<= (->> ts (ts-adjust 'day (* -7 warning-value))) org-ql--today)))))))
|
||||||
|
|
||||||
(org-ql-defpred planning (&key from to _on regexp _with-time)
|
(org-ql-defpred planning (&key from to _on regexp _with-time)
|
||||||
;; The underscore before `on' prevents "unused lexical variable"
|
"Return non-nil if current entry has planning timestamp in given period.
|
||||||
;; warnings, because we pre-process that argument in a macro before
|
Without arguments, return non-nil if entry has any planning timestamp."
|
||||||
;; this function is called.
|
|
||||||
"Return non-nil if current entry has planning timestamp in given period (i.e. its deadline, scheduled, or closed timestamp).
|
|
||||||
If no arguments are specified, return non-nil if entry has any
|
|
||||||
timestamp.
|
|
||||||
|
|
||||||
If FROM, return non-nil if entry has a timestamp on or after
|
|
||||||
FROM.
|
|
||||||
|
|
||||||
If TO, return non-nil if entry has a timestamp on or before TO.
|
|
||||||
|
|
||||||
If ON, return non-nil if entry has a timestamp on date ON.
|
|
||||||
|
|
||||||
FROM, TO, and ON should be either `ts' structs, or strings
|
|
||||||
parseable by `parse-time-string' which may omit the time value."
|
|
||||||
;; FIXME: Update docstring.
|
|
||||||
:normalizers ((`(,predicate-names ,(and num-days (pred numberp)))
|
:normalizers ((`(,predicate-names ,(and num-days (pred numberp)))
|
||||||
(let ((to (->> (ts-now)
|
(let ((to (->> (ts-now)
|
||||||
(ts-adjust 'day num-days)
|
(ts-adjust 'day num-days)
|
||||||
|
|
@ -2016,30 +1983,15 @@ parseable by `parse-time-string' which may omit the time value."
|
||||||
('t org-ql-regexp-planning-with-time)
|
('t org-ql-regexp-planning-with-time)
|
||||||
('nil org-ql-regexp-planning-without-time)
|
('nil org-ql-regexp-planning-without-time)
|
||||||
('not-found org-ql-regexp-planning)))))
|
('not-found org-ql-regexp-planning)))))
|
||||||
;; NOTE: The argument `regexp' is provided by pre-processing done by `org-ql--query-predicate'.
|
;; MAYBE: Should the regexp be done in the normalizer instead? (If
|
||||||
;; MAYBE: Should the regexp be done in the normalizer instead? (If so, also in other ts-related predicates.)
|
;; so, also in other ts-related predicates.)
|
||||||
:body
|
:body
|
||||||
(org-ql--predicate-ts :from from :to to :regexp regexp :match-group 1
|
(org-ql--predicate-ts :from from :to to :regexp regexp :match-group 1
|
||||||
:limit (line-end-position 2)))
|
:limit (line-end-position 2)))
|
||||||
|
|
||||||
(org-ql-defpred scheduled (&key from to _on regexp _with-time)
|
(org-ql-defpred scheduled (&key from to _on regexp _with-time)
|
||||||
;; The underscore before `on' prevents "unused lexical variable"
|
|
||||||
;; warnings, because we pre-process that argument in a macro before
|
|
||||||
;; this function is called.
|
|
||||||
"Return non-nil if current entry is scheduled in given period.
|
"Return non-nil if current entry is scheduled in given period.
|
||||||
If no arguments are specified, return non-nil if entry has any
|
Without arguments, return non-nil if entry is scheduled."
|
||||||
timestamp.
|
|
||||||
|
|
||||||
If FROM, return non-nil if entry has a timestamp on or after
|
|
||||||
FROM.
|
|
||||||
|
|
||||||
If TO, return non-nil if entry has a timestamp on or before TO.
|
|
||||||
|
|
||||||
If ON, return non-nil if entry has a timestamp on date ON.
|
|
||||||
|
|
||||||
FROM, TO, and ON should be either `ts' structs, or strings
|
|
||||||
parseable by `parse-time-string' which may omit the time value."
|
|
||||||
;; FIXME: Update docstring.
|
|
||||||
:normalizers ((`(,predicate-names ,(and num-days (pred numberp)))
|
:normalizers ((`(,predicate-names ,(and num-days (pred numberp)))
|
||||||
(let ((to (->> (ts-now)
|
(let ((to (->> (ts-now)
|
||||||
(ts-adjust 'day num-days)
|
(ts-adjust 'day num-days)
|
||||||
|
|
@ -2058,24 +2010,8 @@ parseable by `parse-time-string' which may omit the time value."
|
||||||
(org-ql-defpred (ts ts-active ts-a ts-inactive ts-i)
|
(org-ql-defpred (ts ts-active ts-a ts-inactive ts-i)
|
||||||
(&key from to _on regexp _with-time
|
(&key from to _on regexp _with-time
|
||||||
(match-group 0) (limit (org-entry-end-position)))
|
(match-group 0) (limit (org-entry-end-position)))
|
||||||
;; NOTE: Arguments to this predicate are pre-processed in `org-ql--normalize-query'.
|
|
||||||
;; The underscore before `on' prevents "unused lexical variable" warnings due to the
|
|
||||||
;; pre-processing converting that argument to FROM and TO. The `regexp' argument is
|
|
||||||
;; also provided by the pre-processing and is not to be given by the user. FROM and
|
|
||||||
;; TO are actually expected to be `ts' structs. The docstring is written for users.
|
|
||||||
"Return non-nil if current entry has a timestamp in given period.
|
"Return non-nil if current entry has a timestamp in given period.
|
||||||
If no arguments are specified, return non-nil if entry has any
|
Without arguments, return non-nil if entry has a timestamp.
|
||||||
timestamp.
|
|
||||||
|
|
||||||
If FROM, return non-nil if entry has a timestamp on or after
|
|
||||||
FROM.
|
|
||||||
|
|
||||||
If TO, return non-nil if entry has a timestamp on or before TO.
|
|
||||||
|
|
||||||
If ON, return non-nil if entry has a timestamp on date ON.
|
|
||||||
|
|
||||||
FROM, TO, and ON should be either `ts' structs, or strings
|
|
||||||
parseable by `parse-time-string' which may omit the time value.
|
|
||||||
|
|
||||||
TYPE may be `active' to match active timestamps, `inactive' to
|
TYPE may be `active' to match active timestamps, `inactive' to
|
||||||
match inactive ones, or `both' / nil to match both types.
|
match inactive ones, or `both' / nil to match both types.
|
||||||
|
|
@ -2083,13 +2019,17 @@ match inactive ones, or `both' / nil to match both types.
|
||||||
LIMIT bounds the search for the timestamp REGEXP. It defaults to
|
LIMIT bounds the search for the timestamp REGEXP. It defaults to
|
||||||
the end of the entry, i.e. the position returned by
|
the end of the entry, i.e. the position returned by
|
||||||
`org-entry-end-position', but for certain searches it should be
|
`org-entry-end-position', but for certain searches it should be
|
||||||
bound to a different positiion, e.g. for planning lines, the end
|
bound to a different positiion (e.g. for planning lines, the end
|
||||||
of the line after the heading."
|
of the line after the heading). MATCH-GROUP should be the number
|
||||||
;; FIXME: Update docstring (e.g. mention MATCH-GROUP).
|
of REGEXP's group that matches the Org timestamp (i.e. excluding
|
||||||
|
any planning prefix); it defaults to 0 (i.e. the whole regexp)."
|
||||||
;; MAYBE: Define active/inactive ones separately?
|
;; MAYBE: Define active/inactive ones separately?
|
||||||
:normalizers ((`(,(or 'ts-active 'ts-a) . ,rest) `(ts :type active ,@rest))
|
:normalizers
|
||||||
|
((`(,(or 'ts-active 'ts-a) . ,rest) `(ts :type active ,@rest))
|
||||||
(`(,(or 'ts-inactive 'ts-i) . ,rest) `(ts :type inactive ,@rest)))
|
(`(,(or 'ts-inactive 'ts-i) . ,rest) `(ts :type inactive ,@rest)))
|
||||||
:preambles ((`(,predicate-names . ,rest)
|
|
||||||
|
:preambles
|
||||||
|
((`(,predicate-names . ,rest)
|
||||||
(list :regexp (pcase (plist-get rest :type)
|
(list :regexp (pcase (plist-get rest :type)
|
||||||
((or 'nil 'both) (pcase-exhaustive (org-ql--plist-get* rest :with-time)
|
((or 'nil 'both) (pcase-exhaustive (org-ql--plist-get* rest :with-time)
|
||||||
('t org-ql-regexp-ts-both-with-time)
|
('t org-ql-regexp-ts-both-with-time)
|
||||||
|
|
@ -2105,13 +2045,13 @@ of the line after the heading."
|
||||||
('not-found org-ql-regexp-ts-inactive))))
|
('not-found org-ql-regexp-ts-inactive))))
|
||||||
;; Predicate needs testing only when args are present.
|
;; Predicate needs testing only when args are present.
|
||||||
:query (-let (((&keys :from :to :on) rest))
|
:query (-let (((&keys :from :to :on) rest))
|
||||||
;; FIXME: This used to be (when (or from to on) query), but that doesn't seem right, so I
|
;; TODO: This used to be (when (or from to on) query), but
|
||||||
;; changed it to this if, and the tests pass either way. Might deserve a little scrutiny.
|
;; that doesn't seem right, so I changed it to this if, and the
|
||||||
|
;; tests pass either way. Might deserve a little scrutiny.
|
||||||
(if (or from to on)
|
(if (or from to on)
|
||||||
query
|
query
|
||||||
t)))))
|
t)))))
|
||||||
;; TODO: DRY this with the clocked predicate.
|
|
||||||
;; NOTE: The argument `regexp' is provided by pre-processing done by `org-ql--query-predicate'.
|
|
||||||
:body
|
:body
|
||||||
(cl-macrolet ((next-timestamp ()
|
(cl-macrolet ((next-timestamp ()
|
||||||
`(when (re-search-forward regexp limit t)
|
`(when (re-search-forward regexp limit t)
|
||||||
|
|
|
||||||
120
org-ql.info
120
org-ql.info
|
|
@ -530,24 +530,27 @@ File: README.info, Node: Date/time predicates, Prev: Ancestor/descendant predi
|
||||||
4.2.4 Date/time predicates
|
4.2.4 Date/time predicates
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
All of these predicates take optional keyword arguments ‘:from’, ‘:to:’,
|
These predicates take optional keyword arguments:
|
||||||
and ‘:on’:
|
|
||||||
|
|
||||||
• If ‘:from’, return non-nil if entry has a timestamp on or after
|
• ‘:from’: Match entries whose timestamp is on or after timestamp
|
||||||
‘:from’.
|
‘:from’.
|
||||||
• If ‘:to’, return non-nil if entry has a timestamp on or before
|
• ‘:to’: Match entries whose timestamp is on or before timestamp
|
||||||
‘:to’.
|
‘:to’.
|
||||||
• If ‘:on’, return non-nil if entry has a timestamp on date ‘:on’.
|
• ‘:on’: Match entries whose timestamp is on date ‘:on’.
|
||||||
|
• ‘:with-time’: If unspecified, match timestamps with or without
|
||||||
|
times (i.e. HH:MM). If nil, match timestamps without times. If t,
|
||||||
|
match timestamps with times.
|
||||||
|
|
||||||
Argument values should be either a number of days (positive to look
|
Timestamp/date arguments should be either a number of days (positive
|
||||||
forward, or negative to look backward), a ‘ts’ struct, or a string
|
to look forward, or negative to look backward), a string parseable by
|
||||||
parseable by ‘parse-time-string’ (the string may omit the time value).
|
‘parse-time-string’ (the string may omit the time value), or a ‘ts’
|
||||||
|
struct.
|
||||||
|
|
||||||
• *Predicates*
|
• *Predicates*
|
||||||
‘ts’
|
‘ts’
|
||||||
Return non-nil if current entry has a timestamp in given
|
Return non-nil if current entry has a timestamp in given
|
||||||
period. If no arguments are specified, return non-nil if
|
period. Without arguments, return non-nil if entry has a
|
||||||
entry has any timestamp.
|
timestamp.
|
||||||
‘ts-active, ts-a’
|
‘ts-active, ts-a’
|
||||||
Like ts, but only matches active timestamps.
|
Like ts, but only matches active timestamps.
|
||||||
‘ts-inactive, ts-i’
|
‘ts-inactive, ts-i’
|
||||||
|
|
@ -560,30 +563,28 @@ number of days. The number can be negative to invert the direction.
|
||||||
• *Backward-looking*
|
• *Backward-looking*
|
||||||
‘clocked’
|
‘clocked’
|
||||||
Return non-nil if current entry was clocked in given period.
|
Return non-nil if current entry was clocked in given period.
|
||||||
If no arguments are specified, return non-nil if entry was
|
Without arguments, return non-nil if entry was ever clocked.
|
||||||
clocked at any time. Note: Clock entries are expected to be
|
Note: Clock entries are expected to be clocked out. Currently
|
||||||
clocked out. Currently clocked entries (i.e. with unclosed
|
clocked entries (i.e. with unclosed timestamp ranges) are
|
||||||
timestamp ranges) are ignored.
|
ignored.
|
||||||
‘closed’
|
‘closed’
|
||||||
Return non-nil if current entry was closed in given period.
|
Return non-nil if current entry was closed in given period.
|
||||||
If no arguments are specified, return non-nil if entry was
|
Without arguments, return non-nil if entry is closed.
|
||||||
closed at any time.
|
|
||||||
|
|
||||||
• *Forward-looking*
|
• *Forward-looking*
|
||||||
‘deadline’
|
‘deadline’
|
||||||
Return non-nil if current entry has deadline in given period.
|
Return non-nil if current entry has deadline in given period.
|
||||||
If argument is auto, return non-nil if entry has deadline
|
If argument is auto, return non-nil if entry has deadline
|
||||||
within org-deadline-warning-days. If no arguments are
|
within org-deadline-warning-days. Without arguments, return
|
||||||
specified, return non-nil if entry has any deadline.
|
non-nil if entry has any deadline.
|
||||||
‘planning’
|
‘planning’
|
||||||
Return non-nil if current entry has planning timestamp in
|
Return non-nil if current entry has planning timestamp (i.e.
|
||||||
given period (i.e. its deadline, scheduled, or closed
|
its deadline, scheduled, or closed timestamp) in given period.
|
||||||
timestamp). If no arguments are specified, return non-nil if
|
Without arguments, return non-nil if entry has any planning
|
||||||
entry is scheduled at any time.
|
timestamp.
|
||||||
‘scheduled’
|
‘scheduled’
|
||||||
Return non-nil if current entry is scheduled in given period.
|
Return non-nil if current entry is scheduled in given period.
|
||||||
If no arguments are specified, return non-nil if entry is
|
Without arguments, return non-nil if entry is scheduled.
|
||||||
scheduled at any time.
|
|
||||||
|
|
||||||
|
|
||||||
File: README.info, Node: Functions / Macros, Next: Dynamic block, Prev: Queries, Up: Usage
|
File: README.info, Node: Functions / Macros, Next: Dynamic block, Prev: Queries, Up: Usage
|
||||||
|
|
@ -981,6 +982,9 @@ File: README.info, Node: 06-pre, Next: 052, Up: Changelog
|
||||||
• Predicate ‘effort’.
|
• Predicate ‘effort’.
|
||||||
• Predicate ‘heading-regexp’, which matches regular expressions
|
• Predicate ‘heading-regexp’, which matches regular expressions
|
||||||
against heading text (alias: ‘h*’).
|
against heading text (alias: ‘h*’).
|
||||||
|
• Timestamp-related predicates now accept an optional ‘:with-time’
|
||||||
|
argument, which allows matching timestamps with or without times
|
||||||
|
(i.e. HH:MM).
|
||||||
|
|
||||||
*Changed*
|
*Changed*
|
||||||
• Helm support (including the command helm-org-ql) has been moved to
|
• Helm support (including the command helm-org-ql) has been moved to
|
||||||
|
|
@ -1534,40 +1538,40 @@ Node: Non-sexp query syntax9485
|
||||||
Node: General predicates11209
|
Node: General predicates11209
|
||||||
Node: Ancestor/descendant predicates17430
|
Node: Ancestor/descendant predicates17430
|
||||||
Node: Date/time predicates18558
|
Node: Date/time predicates18558
|
||||||
Node: Functions / Macros21213
|
Node: Functions / Macros21220
|
||||||
Node: Agenda-like views21511
|
Node: Agenda-like views21518
|
||||||
Node: Listing / acting-on results22916
|
Node: Listing / acting-on results22923
|
||||||
Node: Custom predicates28538
|
Node: Custom predicates28545
|
||||||
Node: Dynamic block32029
|
Node: Dynamic block32036
|
||||||
Node: Links34727
|
Node: Links34734
|
||||||
Node: Tips35414
|
Node: Tips35421
|
||||||
Node: Changelog35732
|
Node: Changelog35739
|
||||||
Node: 06-pre36458
|
Node: 06-pre36465
|
||||||
Node: 05237865
|
Node: 05238038
|
||||||
Node: 05138169
|
Node: 05138342
|
||||||
Node: 0538586
|
Node: 0538759
|
||||||
Node: 04940060
|
Node: 04940233
|
||||||
Node: 04840334
|
Node: 04840507
|
||||||
Node: 04740681
|
Node: 04740854
|
||||||
Node: 04641076
|
Node: 04641249
|
||||||
Node: 04541476
|
Node: 04541649
|
||||||
Node: 04441835
|
Node: 04442008
|
||||||
Node: 04342194
|
Node: 04342367
|
||||||
Node: 04242391
|
Node: 04242564
|
||||||
Node: 04142552
|
Node: 04142725
|
||||||
Node: 0442793
|
Node: 0442966
|
||||||
Node: 03246726
|
Node: 03246899
|
||||||
Node: 03147105
|
Node: 03147278
|
||||||
Node: 0347302
|
Node: 0347475
|
||||||
Node: 02350277
|
Node: 02350450
|
||||||
Node: 02250505
|
Node: 02250678
|
||||||
Node: 02150773
|
Node: 02150946
|
||||||
Node: 0250972
|
Node: 0251145
|
||||||
Node: 0155007
|
Node: 0155180
|
||||||
Node: Notes55108
|
Node: Notes55281
|
||||||
Node: Comparison with Org Agenda searches55270
|
Node: Comparison with Org Agenda searches55443
|
||||||
Node: org-sidebar56142
|
Node: org-sidebar56315
|
||||||
Node: License56421
|
Node: License56594
|
||||||
|
|
||||||
End Tag Table
|
End Tag Table
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue