summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2022-12-06 00:15:30 -0800
committerYuan Fu <casouri@gmail.com>2022-12-06 13:43:58 -0800
commit6187d001f28e65b642dbb5e3001b97c5bdc39918 (patch)
tree65508db664da96fbf0308fa18fb42c391f1b2952
parentb3847c020835676d5266801573e00aed1967b8e4 (diff)
downloademacs-6187d001f28e65b642dbb5e3001b97c5bdc39918.tar.gz
Fontify some keywords in type face in c-ts-mode
* lisp/progmodes/c-ts-mode.el (c-ts-mode--keywords): Remove some keywords. (c-ts-mode--type-keywords): New variables. (c-ts-mode--font-lock-settings): New rule.
-rw-r--r--lisp/progmodes/c-ts-mode.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 1bd093cfa2d..400af2db19e 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -169,9 +169,9 @@ MODE is either `c' or `cpp'."
'("break" "case" "const" "continue"
"default" "do" "else" "enum"
"extern" "for" "goto" "if" "inline"
- "long" "register" "return" "short"
- "signed" "sizeof" "static" "struct"
- "switch" "typedef" "union" "unsigned"
+ "register" "return"
+ "sizeof" "static" "struct"
+ "switch" "typedef" "union"
"volatile" "while")))
(if (eq mode 'cpp)
(append c-keywords
@@ -188,6 +188,10 @@ MODE is either `c' or `cpp'."
"xor" "xor_eq"))
(append '("auto") c-keywords))))
+(defvar c-ts-mode--type-keywords
+ '("long" "short" "signed" "unsigned")
+ "Keywords that should be considered as part of a type.")
+
(defvar c-ts-mode--operators
'("=" "-" "*" "/" "+" "%" "~" "|" "&" "^" "<<" ">>" "->"
"." "<" "<=" ">=" ">" "==" "!=" "!" "&&" "||" "-="
@@ -263,7 +267,8 @@ MODE is either `c' or `cpp'."
(qualified_identifier
scope: (namespace_identifier) @font-lock-type-face)
- (operator_cast) type: (type_identifier) @font-lock-type-face)))
+ (operator_cast) type: (type_identifier) @font-lock-type-face))
+ [,@c-ts-mode--type-keywords] @font-lock-type-face)
:language mode
:feature 'definition