[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 69380a88e9: c-ts-mode: Highlight name in parameter declarations
From: |
Dmitry Gutov |
Subject: |
emacs-29 69380a88e9: c-ts-mode: Highlight name in parameter declarations |
Date: |
Sat, 4 Feb 2023 15:50:26 -0500 (EST) |
branch: emacs-29
commit 69380a88e9292a08822eeef972d8ace639e15519
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
c-ts-mode: Highlight name in parameter declarations
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings):
Uncomment parameter declaration highlighting (bug#61275).
(c-ts-mode--fontify-declarator): Check that identifier was found.
Some declarations can miss identifier name.
---
lisp/progmodes/c-ts-mode.el | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 390f67a8e8..2a164af26e 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -440,11 +440,10 @@ MODE is either `c' or `cpp'."
declarator: (_) @c-ts-mode--fontify-declarator)
(function_definition
- declarator: (_) @c-ts-mode--fontify-declarator))
+ declarator: (_) @c-ts-mode--fontify-declarator)
- ;; Should we highlight identifiers in the parameter list?
- ;; (parameter_declaration
- ;; declarator: (_) @c-ts-mode--fontify-declarator))
+ (parameter_declaration
+ declarator: (_) @c-ts-mode--fontify-declarator))
:language mode
:feature 'assignment
@@ -552,9 +551,10 @@ For NODE, OVERRIDE, START, END, and ARGS, see
identifier)))
("function_declarator" 'font-lock-function-name-face)
(_ 'font-lock-variable-name-face))))
- (treesit-fontify-with-override
- (treesit-node-start identifier) (treesit-node-end identifier)
- face override start end)))
+ (when identifier
+ (treesit-fontify-with-override
+ (treesit-node-start identifier) (treesit-node-end identifier)
+ face override start end))))
(defun c-ts-mode--fontify-variable (node override start end &rest _)
"Fontify an identifier node if it is a variable.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 69380a88e9: c-ts-mode: Highlight name in parameter declarations,
Dmitry Gutov <=