summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-05-01 20:49:34 +0300
committerThanos Apollo <[email protected]>2024-05-01 20:49:34 +0300
commit6d8bb7376b7b83d998e230c3f4b3d5948f43183e (patch)
treeeb7923e14d78ffc83ae4b54bed76611d675f9735 /gnosis.el
parentc3a5bbbdfef1d05a77bb166988aaaf13649e72b6 (diff)
gnosis-display: Use fill-paragraph as optional arg
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el25
1 files changed, 17 insertions, 8 deletions
diff --git a/gnosis.el b/gnosis.el
index 392b3a2..8f779bf 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -280,11 +280,15 @@ Example:
if (= i index) collect new-item
else collect item))
-(defun gnosis-display-question (id)
- "Display main row for note ID."
+(defun gnosis-display-question (id &optional fill-paragraph-p)
+ "Display main row for note ID.
+
+If FILL-PARAGRAPH-P, insert question using `fill-paragraph'."
(let ((question (gnosis-get 'main 'notes `(= id ,id))))
(erase-buffer)
- (fill-paragraph (insert "\n" (propertize question 'face 'gnosis-face-main)))))
+ (if fill-paragraph-p
+ (fill-paragraph (insert "\n" (propertize question 'face 'gnosis-face-main))))
+ (insert "\n" (propertize question 'face 'gnosis-face-main))))
(defun gnosis-display-mcq-options (id)
"Display answer options for mcq note ID."
@@ -295,12 +299,17 @@ Example:
do (insert (format "\n%s. %s" option-num option))
(setf option-num (1+ option-num)))))
-(defun gnosis-display-cloze-sentence (sentence clozes)
- "Display cloze sentence for SENTENCE with CLOZES."
+(defun gnosis-display-cloze-sentence (sentence clozes &optional fill-paragraph-p)
+ "Display cloze sentence for SENTENCE with CLOZES.
+
+If FILL-PARAGRAPH-P, insert using `fill-paragraph'"
(erase-buffer)
- (fill-paragraph
- (insert "\n"
- (gnosis-cloze-replace-words sentence clozes (propertize gnosis-cloze-string 'face 'gnosis-face-cloze)))))
+ (let ((cloze-sentence
+ (gnosis-cloze-replace-words sentence clozes (propertize gnosis-cloze-string 'face 'gnosis-face-cloze))))
+ (if fill-paragraph-p
+ (fill-paragraph
+ (insert "\n" cloze-sentence))
+ (insert "\n" cloze-sentence))))
(defun gnosis-display-basic-answer (answer success user-input)
"Display ANSWER.