summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-05-09 23:15:11 +0300
committerThanos Apollo <[email protected]>2024-05-09 23:15:11 +0300
commitf354a7dc077b36393efdd1c024f8f1d9d4390ed0 (patch)
tree20ec0d8e1dea6d8bddea3404063a47e9eff946a3 /gnosis.el
parent84530976cf523605514498e985bb48803a83f534 (diff)
[Refactor] Add gnosis-review-actions
Seperate actions to take during review of gnosis note. Use recursion to be able to do more than one action, e.g edit & then override note.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el41
1 files changed, 25 insertions, 16 deletions
diff --git a/gnosis.el b/gnosis.el
index 9797c16..4ed7b11 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1274,6 +1274,30 @@ NOTE-NUM: The number of notes reviewed in the session."
(gnosis-vc-push))
(message "Review session finished. %d notes reviewed." note-num)))
+(defun gnosis-review-actions (success note note-count)
+ "Specify action during review of note.
+
+SUCCESS: Review result
+NOTE: Note ID
+NOTE-COUNT: Total notes reviewed"
+ (pcase (car (read-multiple-choice
+ "Note actions"
+ '((?n "next")
+ (?o "override")
+ (?s "suspend")
+ (?e "edit")
+ (?q "quit"))))
+ (?n (gnosis-review--update note success))
+ (?o (setf success (if success nil t))
+ (gnosis-display-next-review note success)
+ (gnosis-review-actions success note note-count))
+ (?s (gnosis-suspend-note note))
+ (?e (gnosis-edit-note note t)
+ (recursive-edit)
+ (gnosis-review-actions success note note-count))
+ (?q (gnosis-review--update note success)
+ (gnosis-review-commit note-count)
+ (cl-return))))
(defun gnosis-review--session (notes)
"Start review session for NOTES.
@@ -1286,22 +1310,7 @@ NOTES: List of note ids"
(cl-loop for note in notes
do (let ((success (gnosis-review-note note)))
(setf note-count (1+ note-count))
- (pcase (car (read-multiple-choice
- "Note actions"
- '((?n "next")
- (?o "override")
- (?s "suspend")
- (?e "edit")
- (?q "quit"))))
- (?n (gnosis-review--update note success))
- (?o (gnosis-review-override note success))
- (?s (gnosis-suspend-note note))
- (?e (gnosis-review--update note success)
- (gnosis-edit-note note t)
- (recursive-edit))
- (?q (gnosis-review--update note success)
- (gnosis-review-commit note-count)
- (cl-return)))
+ (gnosis-review-actions success note note-count)
(setq gnosis-due-notes-total (length (gnosis-review-get-due-notes))))
finally (gnosis-review-commit note-count))))))