diff options
author | Thanos Apollo <[email protected]> | 2023-12-29 04:56:08 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-12-29 04:56:08 +0200 |
commit | 47dd5f1613d5be4a53277961550dd8634f5f587e (patch) | |
tree | d63914b9b1bc1c38fabccf223dbfc265962f98e2 /gnosis.el | |
parent | cebbef623bfd42b0d2d61fc509318bbc7e61ff8a (diff) |
gnosis-display: Rewrite cloze-reveal
Rewrite as cl-defun with keywords, change previous default values.
New: Optionally add custom face
Diffstat (limited to 'gnosis.el')
-rw-r--r-- | gnosis.el | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -164,14 +164,17 @@ When SUCCESS nil, display USER-INPUT as well" (propertize "\n\n-----\n" 'face 'gnosis-face-seperator) (propertize hint 'face 'gnosis-face-hint))))) -(defun gnosis-display--cloze-reveal (cloze-chars replace success) - "Replace CLOZE-CHARS with REPLACE. +(cl-defun gnosis-display-cloze-reveal (&key (cloze-char gnosis-cloze-char) replace (success t) (face nil)) + "Replace CLOZE-CHAR with REPLACE. -If SUCCESS t" +If FACE nil, propertize replace using `gnosis-face-correct', or +`gnosis-face-false' when (not SUCCESS). Else use FACE value." (with-gnosis-buffer (goto-char (point-min)) - (search-forward cloze-chars nil t) - (replace-match (propertize replace 'face (if success 'gnosis-face-correct 'gnosis-face-false))))) + (search-forward cloze-char nil t) + (replace-match (propertize replace 'face (if (not face) + (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. |