From 95dd23ee9266fd7d3e5873b572458dd7af9949c3 Mon Sep 17 00:00:00 2001 From: apc Date: Tue, 11 Feb 2025 21:03:13 -0500 Subject: [PATCH 1/2] Fix `org-ql-refile` so that it handles all possible values for `org-refile-targets` As per the documentation of `org-refile-targets`, each specification of the files in a given cons cell can be a list of files "or a symbol whose function or variable value will be used..." This ensures `org-refile-targets` can handle the case where the specification is a symbol with a variable value. --- org-ql-find.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/org-ql-find.el b/org-ql-find.el index e6c4795..9ca743a 100644 --- a/org-ql-find.el +++ b/org-ql-find.el @@ -117,9 +117,12 @@ which see (but only the files are used)." (cl-loop for (files-spec . _candidate-spec) in org-refile-targets append (cl-typecase files-spec (null (list (current-buffer))) - (symbol (pcase (funcall files-spec) + (function (pcase (funcall files-spec) + ((and (pred stringp) file) (list file)) + ((and (pred listp) files) files))) + (symbol (pcase (eval files-spec) ((and (pred stringp) file) (list file)) - ((and (pred listp) files) files))) + ((and (pred listp) files) files))) (list files-spec))))))) (list (org-ql-completing-read buffers-files :prompt "Refile to: ")))) (let ((buffer (or (buffer-base-buffer (marker-buffer marker)) @@ -136,7 +139,6 @@ which see (but only the files are used)." nil ;; Position marker)))) - ;;;###autoload (defun org-ql-find-in-agenda () "Call `org-ql-find' on `org-agenda-files'." From dc4bf65320f969154045000e6b6aec6ce73ea7e2 Mon Sep 17 00:00:00 2001 From: apc Date: Tue, 11 Feb 2025 21:05:22 -0500 Subject: [PATCH 2/2] Fix missing empty line and alignment --- org-ql-find.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org-ql-find.el b/org-ql-find.el index 9ca743a..ebfd612 100644 --- a/org-ql-find.el +++ b/org-ql-find.el @@ -122,7 +122,7 @@ which see (but only the files are used)." ((and (pred listp) files) files))) (symbol (pcase (eval files-spec) ((and (pred stringp) file) (list file)) - ((and (pred listp) files) files))) + ((and (pred listp) files) files))) (list files-spec))))))) (list (org-ql-completing-read buffers-files :prompt "Refile to: ")))) (let ((buffer (or (buffer-base-buffer (marker-buffer marker)) @@ -139,6 +139,7 @@ which see (but only the files are used)." nil ;; Position marker)))) + ;;;###autoload (defun org-ql-find-in-agenda () "Call `org-ql-find' on `org-agenda-files'."