From 2a41bcba72847481584f118a9b1a4b1862d3bb31 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 6 Aug 2024 20:36:10 +0300 Subject: suspend-note: Add verification optional arg. * Optionally, skin verification y-or-n-p promtp. --- gnosis.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gnosis.el b/gnosis.el index ab46e26..3e0049a 100644 --- a/gnosis.el +++ b/gnosis.el @@ -721,10 +721,13 @@ If NAME is t, return name of deck." (deck (gnosis-get 'deck-id 'notes id-clause))) (if name (gnosis--get-deck-name deck) deck))) -(cl-defun gnosis-suspend-note (id) - "Suspend note with ID." - (let ((suspended (= (gnosis-get 'suspend 'review-log `(= id ,id)) 1))) - (when (y-or-n-p (if suspended "Unsuspend note? " "Suspend note? ")) +(cl-defun gnosis-suspend-note (id &optional verification) + "Suspend note with ID. + +When VERIFICATION is non-nil, skips `y-or-n-p' prompt." + (let* ((suspended (= (gnosis-get 'suspend 'review-log `(= id ,id)) 1)) + (verification (or verification (y-or-n-p (if suspended "Unsuspend note? " "Suspend note? "))))) + (when verification (if suspended (gnosis-update 'review-log '(= suspend 0) `(= id ,id)) (gnosis-update 'review-log '(= suspend 1) `(= id ,id)))))) -- cgit v1.2.3