GNU bug report logs - #61275
c-ts-mode: (eq treesit-font-lock-level 2) doesn't fontify parameter names.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Sat, 4 Feb 2023 16:28:01 UTC

Severity: normal

Fixed in version 29.1

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#61275: closed (c-ts-mode: (eq treesit-font-lock-level 2)
 doesn't fontify parameter names.)
Date: Sat, 04 Feb 2023 20:55:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 4 Feb 2023 22:54:04 +0200
with message-id <1879994d-43cb-87a2-6316-cc6c2805a82c <at> yandex.ru>
and subject line Re: bug#61275: c-ts-mode: (eq treesit-font-lock-level 2) doesn't fontify parameter names.
has caused the debbugs.gnu.org bug report #61275,
regarding c-ts-mode: (eq treesit-font-lock-level 2) doesn't fontify parameter names.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
61275: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61275
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Alan Mackenzie <acm <at> muc.de>
To: bug-gnu-emacs <at> gnu.org
Subject: c-ts-mode: (eq treesit-font-lock-level 2) doesn't fontify parameter
 names.
Date: Sat, 4 Feb 2023 16:27:13 +0000
Hello, Emacs.

In master (or probably the release branch), setting
treesit-font-lock-level to 2 for c-ts-mode fontifies variable
definitions, but not the parameter definitions of a C function.

For example, in

    int foo (int bar)
    {
        int baz;

        baz = bar;
	return baz;
    }

, the definition of bar is not fontified, but that of baz is.

There doesn't appear to be a (documented) way to get something similar to
C Mode's fontification, where the declarations of variables and
parameters were fontified, but not their use.

This is a fontification detail I would very much like to have.  In long
straggling C functions, variables are frequently declared in the middle
of the functions, and having the declarations stand out makes it easy to
search for them with the eye.  It is less easy if parameters aren't also
fontified.

-- 
Alan Mackenzie (Nuremberg, Germany).


[Message part 3 (message/rfc822, inline)]
From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>, acm <at> muc.de,
 Theodor Thornhill <theo <at> thornhill.no>, Yuan Fu <casouri <at> gmail.com>
Cc: 61275-done <at> debbugs.gnu.org
Subject: Re: bug#61275: c-ts-mode: (eq treesit-font-lock-level 2) doesn't
 fontify parameter names.
Date: Sat, 4 Feb 2023 22:54:04 +0200
Version: 29.1

On 04/02/2023 19:20, Eli Zaretskii wrote:
>> Cc:61275 <at> debbugs.gnu.org
>> Date: Sat, 04 Feb 2023 19:13:43 +0200
>> From: Eli Zaretskii<eliz <at> gnu.org>
>>
>>> Date: Sat, 4 Feb 2023 17:00:45 +0000
>>> Cc:61275 <at> debbugs.gnu.org
>>> From: Alan Mackenzie<acm <at> muc.de>
>>>
>>>> By "the definition of bar", do you mean this:
>>>>      int foo (int bar)
>>>>                   ^^^
>>> Yes, that's precisely what I meant.
>> I believe this is known as "parameter declaration".
> More accurately, you want the parameter identifiers which are part of
> parameter declarations to be fontified using the
> font-lock-variable-name-face.
> 
> I hope Yuan or Theo could look into this soon.

I've installed the patch previously posted to emacs-devel. It should 
take care of c-ts-mode and c++-ts-mode.


This bug report was last modified 2 years and 105 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.