Fix #if defined directive fontification in c-ts-mode
authorYuan Fu <casouri@gmail.com>
Thu, 9 May 2024 03:50:24 +0000 (20:50 -0700)
committerYuan Fu <casouri@gmail.com>
Thu, 9 May 2024 03:50:24 +0000 (20:50 -0700)
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Fontify
each part separately so the identifier isn't overriden.

lisp/progmodes/c-ts-mode.el

index 2d431d75d2168367a7db7e20bbff62f75044e988..730671da78175727ba1127b4fedf38731d43d5c7 100644 (file)
@@ -617,8 +617,11 @@ MODE is either `c' or `cpp'."
      (preproc_params
       (identifier) @font-lock-variable-name-face)
 
-     (preproc_defined) @font-lock-preprocessor-face
-     (preproc_defined (identifier) @font-lock-variable-name-face)
+     (preproc_defined
+      "defined" @font-lock-preprocessor-face
+      "(" @font-lock-preprocessor-face
+      (identifier) @font-lock-variable-name-face
+      ")" @font-lock-preprocessor-face)
      [,@c-ts-mode--preproc-keywords] @font-lock-preprocessor-face)
 
    :language mode