summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-01-02 15:27:31 +0200
committerThanos Apollo <[email protected]>2024-01-03 07:10:23 +0200
commite2f817647e945774a108b7636b69fc8181660a79 (patch)
tree5bfbfed3db3aea3187a33887f71d9754e876daf3
parentb3a01de8e6c50c2b5e27f72e07bba5187d27742a (diff)
Rewrite gnosis-suspend-deck as cl-defun
-rw-r--r--gnosis.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/gnosis.el b/gnosis.el
index e9b30f7..b82a4a7 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -275,15 +275,19 @@ Set SPLIT to t to split all input given."
"Suspend note with ID."
(gnosis-update 'review-log '(= suspend 1) `(= id ,id)))
-(defun gnosis-suspend-deck (&optional deck)
+(cl-defun gnosis-suspend-deck (&optional (deck (gnosis--get-deck-id)))
"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)))
+ (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))))))
+ do (progn (gnosis-update 'review-log `(= suspend ,suspend) `(= id ,(car note)))
+ (setq note-count (1+ note-count)))
+ finally (if (equal suspend 0)
+ (message "Unsuspended %s notes" note-count)
+ (message "Suspended %s notes" note-count)))))
(defun gnosis-suspend-tag ()
"Suspend all note(s) with tag.