summaryrefslogtreecommitdiff
path: root/llama.el
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2025-01-17 17:41:53 +0100
committerJonas Bernoulli <jonas@bernoul.li>2025-01-17 17:41:53 +0100
commit5259a6f298a56b445b16687ff49708ed3906061d (patch)
tree3fd2d803161bf7bd99bbf5bd41036263a0a1bd49 /llama.el
parent3d9b59e1125e85137346b4c866e8a0a58464acb8 (diff)
Highlight many symbols if they appear after "(##"
Advice `lisp--el-match-keyword' to do so, but only if `llama-fontify-mode' is enable. If so, highlight symbols after "(##", "(## " and "(", which would otherwise only be highlighted after "(".
Diffstat (limited to 'llama.el')
-rw-r--r--llama.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/llama.el b/llama.el
index b242aa7..b729870 100644
--- a/llama.el
+++ b/llama.el
@@ -320,6 +320,31 @@ that) is used as COLLECTION, by `unintern'ing that symbol temporarily."
(when bound
(set (intern "") value)))))
+(defvar llama-fontify-mode)
+
+(define-advice lisp--el-match-keyword (:override (limit) llama -80)
+ (catch 'found
+ (while (re-search-forward
+ (concat (if llama-fontify-mode
+ "(\\(?:## ?\\)?\\("
+ "(\\(")
+ (static-if (get 'lisp-mode-symbol 'rx-definition) ;>= 29.1
+ (rx lisp-mode-symbol)
+ lisp-mode-symbol-regexp)
+ "\\)\\_>")
+ limit t)
+ (let ((sym (intern-soft (match-string 1))))
+ (when (and (or (special-form-p sym)
+ (macrop sym)
+ ;; Same as in advice of `morlock' package.
+ (get sym 'morlock-font-lock-keyword))
+ (not (get sym 'no-font-lock-keyword))
+ (static-if (fboundp 'lisp--el-funcall-position-p) ;>= 28.1
+ (lisp--el-funcall-position-p (match-beginning 0))
+ (not (lisp--el-non-funcall-position-p
+ (match-beginning 0)))))
+ (throw 'found t))))))
+
;;; Fontification
(defgroup llama ()