summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-12-28 04:05:31 +0200
committerThanos Apollo <[email protected]>2023-12-28 04:05:31 +0200
commitbe7bc38c44267bcd7ac4d8d1e41cc87c8cef516a (patch)
treeb10b2347ddfd383eaa46401af8e9109f70895556
parentc33d0fee946abe25411286533b8e58b13f07cf6a (diff)
Add gnosis-prompt-tag
-rw-r--r--gnosis.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index efa10ed..a1318fe 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -369,6 +369,20 @@ Compare 2 strings, ignoring case and whitespace."
(cl-loop for (id tags) in (emacsql gnosis-db [:select [id tags] :from notes])
when (cl-every (lambda (tag) (member tag tags)) input-tags)
collect id))
+
+(defun gnosis-prompt-tag ()
+ "Prompt user to enter tags, until they enter `q'.
+
+Returns a list of unique entered tags."
+ (interactive)
+ (let ((tags '())
+ (tag ""))
+ (while (not (string= tag "q"))
+ (setf tag (completing-read "Add tag (q for quit): " (gnosis-unique-tags) nil nil))
+ (unless (or (string= tag "q") (member tag tags))
+ (push tag tags)))
+ (reverse tags)))
+
;; Review
;;;;;;;;;;
(defun gnosis-review--algorithm (id success)