From c286ab19677fea985150423f7bdcdf56aa5921a9 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Wed, 2 Oct 2019 11:58:28 -0500 Subject: [PATCH] Add: (org-ql-select) Accept a function for buffers-files --- README.org | 1 + org-ql-view.el | 3 --- org-ql.el | 4 +++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.org b/README.org index 8191748..b81e588 100644 --- a/README.org +++ b/README.org @@ -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=. diff --git a/org-ql-view.el b/org-ql-view.el index 9b7db43..d65a7a7 100644 --- a/org-ql-view.el +++ b/org-ql-view.el @@ -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)))) diff --git a/org-ql.el b/org-ql.el index 19f8879..ac58f00 100644 --- a/org-ql.el +++ b/org-ql.el @@ -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