summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-12-28 08:13:09 +0200
committerThanos Apollo <[email protected]>2023-12-28 08:13:09 +0200
commitcc1b398063582db2c6686c20caa18c4e9dda90c0 (patch)
tree05bfdd1f7b754583e1465b18083b6c899bd1032f /gnosis.el
parentac7a0b6b084b5eafab352b0cc77e15165ad894cc (diff)
Add gnosis-suspend-deck
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index fdb1b7d..720076c 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -227,6 +227,15 @@ Set SPLIT to t to split all input given."
(gnosis--delete 'decks `(= name ,deck))
(message "Deleted deck %s" deck))
+(defun gnosis-suspend-deck (&optional deck)
+ "Suspend all note(s) with DECK id.
+
+When called with a prefix, unsuspends all notes in deck."
+ (unless deck (setf deck (gnosis--get-deck-id)))
+ (let ((notes (gnosis-select 'id 'notes `(= deck-id ,deck)))
+ (suspend (if current-prefix-arg 0 1)))
+ (cl-loop for note in notes
+ do (gnosis-update 'review-log `(= suspend ,suspend) `(= id ,(car note))))))
(defun gnosis-add-note-fields (deck type main options answer extra tags suspend image)
"Add fields for new note.