summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-12-29 04:59:37 +0200
committerThanos Apollo <[email protected]>2023-12-29 05:01:42 +0200
commit6522d74d8a5225c83869b1ae2737ab71d99ff7a8 (patch)
treeb5c9309a3e4adc78c604fadfc459c33086f4773b /gnosis.el
parente33f25e15e48f7872499018d73c5224a004c8eb9 (diff)
Update cloze review
- Fix 'looping issues' - Fix revealing all clozes as false & other face issues - Now reveal unanswered clozes as unanswered - Display user-input answer
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el23
1 files changed, 14 insertions, 9 deletions
diff --git a/gnosis.el b/gnosis.el
index 5cf87df..47cbf05 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -176,8 +176,8 @@ If FACE nil, propertize replace using `gnosis-face-correct', or
(if success 'gnosis-face-correct 'gnosis-face-false)
face)))))
-(cl-defun gnosis-display--cloze-user-answer (user-input &optional (false nil))
- "Display USER-INPUT answer for cloze note.
+(cl-defun gnosis-display-cloze-user-answer (user-input &optional (false t))
+ "Display USER-INPUT answer for cloze note upon failed review.
If FALSE t, use gnosis-face-false face"
(with-gnosis-buffer
@@ -564,7 +564,6 @@ SUCCESS is a binary value, 1 is for successful review."
(message "Correct!"))
(gnosis-review--update id 0)
(message "False"))
- (sit-for 0.3)
(gnosis-display--correct-answer-mcq answer user-choice)
(gnosis-display--extra id)))
@@ -598,7 +597,8 @@ Used to reveal all clozes left with `gnosis-face-cloze-unanswered' face."
"Review cloze type note for ID."
(let* ((main (gnosis-get 'main 'notes `(= id ,id)))
(clozes (gnosis-get 'answer 'notes `(= id ,id)))
- (num 0)
+ (num 1)
+ (clozes-num (length clozes))
(hint (gnosis-get 'options 'notes `(= id ,id))))
(gnosis-display--image id)
(gnosis-display--cloze-sentence main clozes)
@@ -606,14 +606,19 @@ Used to reveal all clozes left with `gnosis-face-cloze-unanswered' face."
(cl-loop for cloze in clozes
do (let ((input (gnosis-review-cloze--input cloze)))
(if (equal (car input) t)
- (progn (gnosis-review-cloze--reveal (list (nth num clozes)) t)
+ ;; Reveal only one cloze
+ (progn (gnosis-display-cloze-reveal :replace cloze)
(setf num (1+ num)))
- (gnosis-review-cloze--reveal clozes nil)
- (gnosis-display--cloze-user-answer (cdr input) t)
+ ;; Reveal cloze for wrong input, with `gnosis-face-false'
+ (gnosis-display-cloze-reveal :replace cloze :success nil)
+ ;; Do NOT remove the _when_ statement, unexpected
+ ;; bugs occur if so depending on the number of
+ ;; clozes.
+ (when (< num clozes-num) (gnosis-review-cloze-reveal-unaswered clozes))
+ (gnosis-display-cloze-user-answer (cdr input))
(gnosis-review--update id 0)
(cl-return)))
- finally (progn (gnosis-review-cloze--reveal clozes t)
- (gnosis-review--update id 1))))
+ finally (gnosis-review--update id 1)))
(gnosis-display--extra id))
(defun gnosis-review-note (id)