Add: (org-ql) Markers argument
This commit is contained in:
parent
fe3d5c2bd8
commit
08243d5479
1 changed files with 15 additions and 2 deletions
17
org-ql.el
17
org-ql.el
|
|
@ -17,7 +17,8 @@
|
||||||
|
|
||||||
;;;; Macros
|
;;;; Macros
|
||||||
|
|
||||||
(cl-defmacro org-ql (buffers-or-files pred-body &key (action-fn '#'identity) sort narrow)
|
(cl-defmacro org-ql (buffers-or-files pred-body &key (action-fn '#'identity)
|
||||||
|
sort narrow markers)
|
||||||
"Find entries in BUFFERS-OR-FILES that match PRED-BODY, and return the results of running ACTION-FN on each matching entry.
|
"Find entries in BUFFERS-OR-FILES that match PRED-BODY, and return the results of running ACTION-FN on each matching entry.
|
||||||
|
|
||||||
ACTION-FN should take a single argument, which will be the result
|
ACTION-FN should take a single argument, which will be the result
|
||||||
|
|
@ -28,8 +29,20 @@ one or more sorting methods, including: `date', `deadline',
|
||||||
`scheduled', and `priority'.
|
`scheduled', and `priority'.
|
||||||
|
|
||||||
If NARROW is non-nil, query will run without widening the
|
If NARROW is non-nil, query will run without widening the
|
||||||
buffer (the default is to widen and search the entire buffer)."
|
buffer (the default is to widen and search the entire buffer).
|
||||||
|
|
||||||
|
If MARKERS is non-nil, `org-agenda-ng--add-markers' is used to
|
||||||
|
add markers to each item, pointing to the item in its source
|
||||||
|
buffer."
|
||||||
(declare (indent defun))
|
(declare (indent defun))
|
||||||
|
(when markers
|
||||||
|
(setq action-fn (pcase action-fn
|
||||||
|
(`(function identity) '#'org-agenda-ng--add-markers)
|
||||||
|
(_ (byte-compile `(lambda (item)
|
||||||
|
(--> item
|
||||||
|
;; Add the markers before calling the action fn
|
||||||
|
org-agenda-ng--add-markers
|
||||||
|
,action-fn)))))))
|
||||||
`(org-ql--query ,buffers-or-files
|
`(org-ql--query ,buffers-or-files
|
||||||
(byte-compile (lambda ()
|
(byte-compile (lambda ()
|
||||||
(cl-symbol-macrolet ((today org-ql--today) ; Necessary because of byte-compiling the lambda
|
(cl-symbol-macrolet ((today org-ql--today) ; Necessary because of byte-compiling the lambda
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue