diff options
author | Thanos Apollo <[email protected]> | 2024-01-02 15:27:31 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-01-03 07:10:23 +0200 |
commit | e2f817647e945774a108b7636b69fc8181660a79 (patch) | |
tree | 5bfbfed3db3aea3187a33887f71d9754e876daf3 | |
parent | b3a01de8e6c50c2b5e27f72e07bba5187d27742a (diff) |
Rewrite gnosis-suspend-deck as cl-defun
-rw-r--r-- | gnosis.el | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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. |