summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-07-17 08:23:37 +0300
committerThanos Apollo <[email protected]>2024-07-17 08:23:37 +0300
commitbd1844395752dce33587dfb6d9b76586217e3035 (patch)
treea1a8f89ec730f06dceb283e0d741b0cbfc81de6e
parented5bd31237d869efb09e76a8dae1fc08c1d3ccab (diff)
display: Add gnosis-apply-highlighting-p
* New variable: When non-nil applies syntax gnosis syntax highlighting.
-rw-r--r--gnosis.el24
1 files changed, 14 insertions, 10 deletions
diff --git a/gnosis.el b/gnosis.el
index e444dfb..cfd2f2d 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -191,6 +191,9 @@ Seperate the question/stem from options."
"Non-nil means center content."
:type 'boolean
:group 'gosis)
+
+(defcustom gnosis-apply-highlighting-p t
+ "Non-nil means apply syntax highlighting."
:type 'boolean
:group 'gosis)
@@ -400,16 +403,17 @@ This will not be applied to sentences that start with double space."
("=\\([^=[: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
- (goto-char (point-min))
- (while (re-search-forward regex nil t)
- (let ((start (match-beginning 1))
- (end (match-end 1)))
- (overlay-put (make-overlay start end) 'face face)
- (delete-region end (match-end 0))
- (delete-region (match-beginning 0) start))))))))
+ (when gnosis-apply-highlighting-p
+ (save-excursion
+ (cl-loop for (regex . face) in syntax-highlights
+ do (progn
+ (goto-char (point-min))
+ (while (re-search-forward regex nil t)
+ (let ((start (match-beginning 1))
+ (end (match-end 1)))
+ (overlay-put (make-overlay start end) 'face face)
+ (delete-region end (match-end 0))
+ (delete-region (match-beginning 0) start)))))))))
(defun gnosis-display-question (id &optional fill-paragraph-p)
"Display main row for note ID.