summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-01-04 10:22:22 +0200
committerThanos Apollo <[email protected]>2024-01-04 10:22:22 +0200
commit4aff673cd946f880012486bc2d0d6254ce29bf32 (patch)
treeacd1ffbc106325ae2a1377b1277f0bc7a6509a70 /gnosis.el
parent248bd3876235f7c97021c5dd3c5e825d295676fb (diff)
Redo gnosis-tag-prompt as cl-defun
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el11
1 files 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)))