Add: (org-ql-select) Accept a function for buffers-files

This commit is contained in:
Adam Porter 2019-10-02 11:58:28 -05:00
parent e60e217312
commit c286ab1967
3 changed files with 4 additions and 4 deletions

View file

@ -149,7 +149,8 @@ For convenience, arguments should be unquoted."
(cl-defun org-ql-select (buffers-or-files query &key action narrow sort)
"Return items matching QUERY in BUFFERS-OR-FILES.
BUFFERS-OR-FILES is a one or a list of files and/or buffers.
BUFFERS-OR-FILES is a file or buffer, a list of files and/or
buffers, or a function which returns such a list.
QUERY is an `org-ql' query sexp (quoted, since this is a
function).
@ -180,6 +181,7 @@ returns nil or non-nil."
(declare (indent defun))
(-let* ((buffers (->> (cl-typecase buffers-or-files
(null (list (current-buffer)))
(function (funcall buffers-or-files))
(list buffers-or-files)
(otherwise (list buffers-or-files)))
(--map (cl-etypecase it