branch: elpa/llama
commit 5259a6f298a56b445b16687ff49708ed3906061d
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    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 "(".
---
 llama.el | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/llama.el b/llama.el
index b242aa79db..b7298703e5 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 ()

Reply via email to