summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-12-30 09:58:01 +0200
committerThanos Apollo <[email protected]>2023-12-30 09:58:01 +0200
commit37668b2aace2c893a3d0faaf2aada45dcd6abfc3 (patch)
treece15abe4007ab3ab1ab561aa470bfcd07b8bfb32 /gnosis.el
parentb5b495e61e41cdc962b4240d8aa8a7089e3e4e64 (diff)
Rewrite gnosis-prompt-tag as gnosis-tag-prompt
Optionally take custom prompt.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el14
1 files 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)