summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-03-03 02:18:43 +0200
committerThanos Apollo <[email protected]>2024-03-03 02:18:43 +0200
commit2d8cf433510b6e5bdf2b203d7b8b85b876b98e99 (patch)
tree516d7df9675842dce09305e09bb025a70ae18989
parent402809457745553b29eb685b4a875bdd81304dfd (diff)
gnosis-suspend-deck: Add confirmation
-rw-r--r--gnosis.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/gnosis.el b/gnosis.el
index 67ed0fd..f06bf01 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -427,15 +427,17 @@ Set SPLIT to t to split all input given."
"Suspend all note(s) with DECK id.
When called with a prefix, unsuspends all notes in deck."
- (let ((notes (gnosis-select 'id 'notes `(= deck-id ,deck)))
- (suspend (if current-prefix-arg 0 1))
- (note-count 0))
- (cl-loop for note in notes
- do (gnosis-update 'review-log `(= suspend ,suspend) `(= id ,(car note)))
+ (let* ((notes (gnosis-select 'id 'notes `(= deck-id ,deck) t))
+ (suspend (if current-prefix-arg 0 1))
+ (note-count 0)
+ (confirm (y-or-n-p (if (= suspend 0) "Unsuspend all notes for deck? " "Suspend all notes for deck? "))))
+ (when confirm
+ (cl-loop for note in notes
+ do (gnosis-update 'review-log `(= suspend ,suspend) `(= id ,note))
(setq note-count (1+ note-count))
finally (if (equal suspend 0)
(message "Unsuspended %s notes" note-count)
- (message "Suspended %s notes" note-count)))))
+ (message "Suspended %s notes" note-count))))))
(defun gnosis-suspend-tag ()
"Suspend all note(s) with tag.