From 64e72d42dcb9db3a2a10b2b1f490eea987604f2d Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sun, 14 Jan 2024 13:03:37 +0200 Subject: Add gnosis-display-y-or-n-answer Display answer for note with face depending on the value of success --- gnosis.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gnosis.el b/gnosis.el index 33562d3..d901c24 100644 --- a/gnosis.el +++ b/gnosis.el @@ -237,6 +237,21 @@ When SUCCESS nil, display USER-INPUT as well" " " (propertize user-input 'face 'gnosis-face-false)))))) +(cl-defun gnosis-display-y-or-n-answer (&key answer success) + "Display y-or-n answer for note ID. + +ANSWER is the correct answer, either y or n. Answer is either 121 or +110, which are the char values for y & n respectively +SUCCESS is t when user-input is correct, else nil" + (let ((answer (if (equal answer 121) "y" "n"))) + (with-gnosis-buffer + (insert + (concat "\n\n" + (propertize "Answer:" 'face 'gnosis-face-directions) + " " + (propertize answer 'face (if success 'gnosis-face-correct 'gnosis-face-false))))))) + + (defun gnosis-display--hint (hint) "Display HINT." (with-gnosis-buffer -- cgit v1.2.3