summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/emacs/modules/mm-treesit.el20
1 files changed, 19 insertions, 1 deletions
diff --git a/.config/emacs/modules/mm-treesit.el b/.config/emacs/modules/mm-treesit.el
index 75e679f..ed8a299 100644
--- a/.config/emacs/modules/mm-treesit.el
+++ b/.config/emacs/modules/mm-treesit.el
@@ -137,4 +137,22 @@ This alist is used to configure `auto-mode-alist'.")
;; https://github.com/tree-sitter/tree-sitter-c/issues/236
(append keywords '("constexpr"))))
-(provide 'mm-treesit)
+
+;;; Highlight Predefined Variables
+
+(with-eval-after-load 'treesit
+ (defvar mm-c-font-lock-rules
+ (treesit-font-lock-rules
+ :language 'c
+ :feature 'constant
+ :override t
+ `(((identifier) @font-lock-constant-face
+ (:match ,(rx bos (or "__func__" "__FUNCTION__") eos)
+ @font-lock-constant-face))))))
+
+(add-hook 'c-ts-mode-hook
+ (defun mm-c-apply-font-lock-extras ()
+ (setq treesit-font-lock-settings
+ (append treesit-font-lock-settings mm-c-font-lock-rules))))
+
+(provide 'mm-treesit) \ No newline at end of file