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

@ -482,6 +482,7 @@ Expands into a call to ~org-ql-select~ with the same arguments. For convenience
+ Predicate =(path)=.
+ Option =org-ql-views= may now be customized in a guided, structured way with the customization UI (e.g. =M-x customize-option RET org-ql-views RET=, or press =c= in the =org-ql-view-sidebar= buffer).
+ Enable more Org Agenda commands in =org-ql-view= buffers (e.g. setting deadlines and scheduling). (Fixes [[https://github.com/alphapapa/org-ql/issues/35][#35]]. Thanks to [[https://github.com/mz-pdm][Milan Zamazal]] and [[https://github.com/mskorzhinskiy][Mikhail Skorzhinskii]].)
+ Function =org-ql-select='s =buffers-files= argument can be a function which returns a list of buffers and/or files.
*Changed*
+ Predicate =heading= now accepts multiple regexps, which are matched with boolean =AND=.

View file

@ -210,9 +210,6 @@ Interactively, prompt for NAME."
(cl-typecase view
(function (call-interactively view))
(list (-let* (((&plist :buffers-files :query :sort :narrow :super-groups :title) view)
(buffers-files (cl-typecase buffers-files
(function (funcall buffers-files))
(list buffers-files)))
(super-groups (cl-typecase super-groups
(symbol (symbol-value super-groups))
(list super-groups))))

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