From 37668b2aace2c893a3d0faaf2aada45dcd6abfc3 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sat, 30 Dec 2023 09:58:01 +0200 Subject: Rewrite gnosis-prompt-tag as gnosis-tag-prompt Optionally take custom prompt. --- gnosis.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gnosis.el b/gnosis.el index c576cfd..fef21f2 100644 --- a/gnosis.el +++ b/gnosis.el @@ -461,15 +461,17 @@ Compare 2 strings, ignoring case and whitespace." t nil)) -(defun gnosis-prompt-tag () - "Prompt user to enter tags, until they enter `q'. +(defun gnosis-tag-prompt (&optional prompt) + "PROMPT user to select tags, or add new, until they enter `q'. Returns a list of unique entered tags." (interactive) - (let ((tags '()) - (tag "")) + (let* ((tags '()) + (tag "") + (prompt (or (concat prompt " (q for quit): ") + (format "Select tags [%s] (q for quit): " tags)))) (while (not (string= tag "q")) - (setf tag (completing-read "Add tag (q for quit): " (gnosis-unique-tags) nil nil)) + (setf tag (completing-read prompt (gnosis-get-tags--unique) nil nil)) (unless (or (string= tag "q") (member tag tags)) (push tag tags))) (reverse tags))) @@ -635,7 +637,7 @@ Used to reveal all clozes left with `gnosis-face-cloze-unanswered' face." (defun gnosis-review-all-with-tags () "Review all note(s) with specified tag(s)." - (let ((notes (gnosis-select-by-tag (gnosis-prompt-tag))) + (let ((notes (gnosis-select-by-tag (gnosis-tag-prompt))) (note-count 0)) (cl-loop for note in notes do (progn (gnosis-review-note note) -- cgit v1.2.3