summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-06-27 14:19:05 +0300
committerThanos Apollo <[email protected]>2024-06-27 14:19:05 +0300
commit4dd826c6d874f935a6df2062a24f52141ace9997 (patch)
tree03ccf5edf3171a5417a983ea80c38132a50e3b97 /gnosis.el
parent2cc330895f1a85844f36b73a54f98717cd8b4d79 (diff)
Add gnosis-apply-overlays
Overlays to apply org-mode like highlighting
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index bd80a83..137d00e 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -319,6 +319,22 @@ History is disabled."
(overlay-put overlay 'face 'gnosis-face-separator)
(overlay-put overlay 'display (make-string width ?\s))))))
+(defun gnosis-apply-overlays ()
+ "Apply custom font overlays for syntax highlighting."
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward "\\*\\([^*]+\\)\\*" nil t)
+ (overlay-put (make-overlay (match-beginning 1) (match-end 1)) 'face 'bold))
+ (goto-char (point-min))
+ (while (re-search-forward "/\\([^/]+\\)/" nil t)
+ (overlay-put (make-overlay (match-beginning 1) (match-end 1)) 'face 'italic))
+ (goto-char (point-min))
+ (while (re-search-forward "=\\([^=]+\\)=" nil t)
+ (overlay-put (make-overlay (match-beginning 1) (match-end 1)) 'face 'font-lock-constant-face))
+ (goto-char (point-min))
+ (while (re-search-forward "~\\([^~]+\\)~" nil t)
+ (overlay-put (make-overlay (match-beginning 1) (match-end 1)) 'face 'font-lock-keyword-face))))
+
(defun gnosis-display-question (id &optional fill-paragraph-p)
"Display main row for note ID.