From 2d8cf433510b6e5bdf2b203d7b8b85b876b98e99 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sun, 3 Mar 2024 02:18:43 +0200 Subject: gnosis-suspend-deck: Add confirmation --- gnosis.el | 14 ++++++++------ 1 file 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. -- cgit v1.2.3