From 6df4a3d342bee27ef6891dc4930dd3ff17c52c31 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 2 Jul 2024 18:10:04 +0300 Subject: gnosis-apply-syntax-overlay: Update regex & add underline --- gnosis.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gnosis.el b/gnosis.el index cf25631..10c54d4 100644 --- a/gnosis.el +++ b/gnosis.el @@ -374,10 +374,11 @@ This will not be applied to sentences that start with double space." (defun gnosis-apply-syntax-overlay () "Apply custom font overlays for syntax highlighting, and remove delimiters." - (let ((syntax-highlights '(("\\*\\([^*[:space:]][^*]*[^*[:space:]]\\)\\*" . bold) - ("/\\([^/[:space:]][^/]*[^/[:space:]]\\)/" . italic) - ("=\\([^=[:space:]][^=]*[^=[:space:]]\\)=" . font-lock-constant-face) - ("~\\([^~[:space:]][^~]*[^~[:space:]]\\)~" . font-lock-keyword-face)))) + (let ((syntax-highlights '(("\\*\\([^*[:space:]][^*\n]*[^*[:space:]]\\)\\*" . bold) + ("/\\([^/[:space:]][^/\n]*[^/[:space:]]\\)/" . italic) + ("=\\([^=[:space:]][^=\n]*[^=[:space:]]\\)=" . font-lock-constant-face) + ("~\\([^~[:space:]][^~\n]*[^~[:space:]]\\)~" . font-lock-keyword-face) + ("_\\([^_[:space:]][^_\n]*[^_[:space:]]\\)_" . underline)))) (save-excursion (cl-loop for (regex . face) in syntax-highlights do (progn @@ -442,7 +443,8 @@ If FILL-PARAGRAPH-P, insert using `fill-paragraph'" (let ((cloze-sentence (gnosis-cloze-replace-words sentence clozes (propertize gnosis-cloze-string 'face 'gnosis-face-cloze)))) (insert "\n" (gnosis-center-string cloze-sentence)) - (gnosis-insert-separator))) + (gnosis-insert-separator) + (gnosis-apply-syntax-overlay))) (defun gnosis-display-basic-answer (answer success user-input) "Display ANSWER. -- cgit v1.2.3