From 2dabfcd2c0208af129a1cb40913a29320c150351 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Thu, 22 Feb 2024 14:19:03 +0200 Subject: mcq: Refactor adding notes & use gnosis-prompt-mcq-choices --- gnosis.el | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/gnosis.el b/gnosis.el index 92a2c76..e2af6a4 100644 --- a/gnosis.el +++ b/gnosis.el @@ -436,7 +436,6 @@ When called with a prefix, unsuspends all notes for tag." ("Tag" (gnosis-suspend-tag)) (_ (message "Not ready yet."))))) - (defun gnosis-add-note-fields (deck type main options answer extra tags suspend image second-image) "Insert fields for new note. @@ -505,13 +504,17 @@ TAGS: Used to organize notes Refer to `gnosis-add-note--mcq' for more." (let ((deck (gnosis--get-deck-name))) (while (y-or-n-p (format "Add note of type `MCQ' to `%s' deck? " deck)) - (gnosis-add-note--mcq :deck deck - :question (read-string "Question: ") - :choices (gnosis--prompt "Choices") - :correct-answer (string-to-number (read-string "Which is the correct answer (number)? ")) - :extra (read-string "Extra: ") - :image (gnosis-select-image) - :tags (gnosis-tag-prompt))))) + (let* ((stem (read-string-from-buffer "Question: " "")) + (input-choices (gnosis-prompt-mcq-choices)) + (choices (car input-choices)) + (correct-choice (cadr input-choices))) + (gnosis-add-note--mcq :deck deck + :question stem + :choices choices + :correct-answer correct-choice + :extra (read-string-from-buffer "Extra" "") + :image (gnosis-select-image) + :tags (gnosis-prompt-tags--split gnosis-previous-note-tags)))))) (cl-defun gnosis-add-note--basic (&key deck question hint answer extra (image nil) tags (suspend 0) (second-image nil)) -- cgit v1.2.3