summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-01-14 13:03:37 +0200
committerThanos Apollo <[email protected]>2024-01-14 13:03:37 +0200
commit64e72d42dcb9db3a2a10b2b1f490eea987604f2d (patch)
treeb479c3dfd86a6f6186e1e62baa076eccfdb519d3
parent7c9a1ad6f27c00f6882171ba17e67a18cb2d8b3a (diff)
Add gnosis-display-y-or-n-answer
Display answer for note with face depending on the value of success
-rw-r--r--gnosis.el15
1 files changed, 15 insertions, 0 deletions
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