From 4aff673cd946f880012486bc2d0d6254ce29bf32 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Thu, 4 Jan 2024 10:22:22 +0200 Subject: Redo gnosis-tag-prompt as cl-defun --- gnosis.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gnosis.el b/gnosis.el index 47a5d33..f65e599 100644 --- a/gnosis.el +++ b/gnosis.el @@ -719,20 +719,21 @@ if DUE is t, return only due notes" due-notes) :test 'equal))) +(cl-defun gnosis-tag-prompt (&key (prompt "Selected tags") (match nil) (due nil)) "PROMPT user to select tags, until they enter `q'. Prompt user to select tags, generated from `gnosis-get-tags--unique'. PROMPT: Prompt string value MATCH: Require match, t or nil value - +DUE: if t, return tags for due notes from `gnosis-due-tags'. Returns a list of unique tags." (let* ((tags '()) - (tag "") - (prompt (or prompt "Selected tags")) - (match (or match nil))) + (tag "")) (while (not (string= tag "q")) (setf tag (completing-read (concat prompt (format " %s (q for quit): " tags)) - (cons "q" (gnosis-get-tags--unique)) nil match)) + (cons "q" (if due (gnosis-due-tags) + (gnosis-get-tags--unique))) + nil match)) (unless (or (string= tag "q") (member tag tags)) (push tag tags))) (reverse tags))) -- cgit v1.2.3