summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-02-17 11:15:58 +0200
committerThanos Apollo <[email protected]>2024-02-17 11:15:58 +0200
commit8b3515893e3610f8822bb02f5c017033c7551046 (patch)
tree14baea6b6ac0109ad04323aef8c4b86ec93f3ee5 /gnosis.el
parent84f3fc35e2b17473571beb37a62174554b40257f (diff)
Add gnosis-previous-note-tags
Store previous note tags, prompt user if he wants to set them for new note as well.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el24
1 files changed, 16 insertions, 8 deletions
diff --git a/gnosis.el b/gnosis.el
index ada6e8e..e1749c6 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -119,6 +119,9 @@ to \"push\" will execute the command 'git push'."
(defvar gnosis-note-types '("MCQ" "Cloze" "Basic" "Double" "y-or-n")
"Gnosis available note types.")
+(defvar gnosis-previous-note-tags '()
+ "Tags input from previously added note.")
+
;;; Faces
(defgroup gnosis-faces nil
@@ -814,14 +817,19 @@ 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 ""))
- (while (not (string= tag "q"))
- (setf tag (funcall gnosis-completing-read-function (concat prompt (format " %s (q for quit): " tags))
- (cons "q" (if due (gnosis-review-get-due-tags)
- (gnosis-get-tags--unique)))
- nil match))
- (unless (or (string= tag "q") (member tag tags))
- (push tag tags)))
+ (tag "")
+ (use-prev (when gnosis-previous-note-tags
+ (y-or-n-p (format "Use tags from previous note? %s" gnosis-previous-note-tags)))))
+ (if use-prev
+ (setq tags gnosis-previous-note-tags)
+ (while (not (string= tag "q"))
+ (setf tag (funcall gnosis-completing-read-function (concat prompt (format " %s (q for quit): " tags))
+ (cons "q" (if due (gnosis-review-get-due-tags)
+ (gnosis-get-tags--unique)))
+ nil match))
+ (unless (or (string= tag "q") (member tag tags))
+ (push tag tags))))
+ (setf gnosis-previous-note-tags (if use-prev tags (reverse tags)))
(reverse tags)))
;; Review