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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61275 in the body.
You can then email your comments to 61275 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#61275; Package emacs. (Sat, 04 Feb 2023 16:28:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alan Mackenzie <acm <at> muc.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 04 Feb 2023 16:28:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

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).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61275; Package emacs. (Sat, 04 Feb 2023 16:58:02 GMT) Full text and rfc822 format available.

Message #8 received at 61275 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 61275 <at> debbugs.gnu.org
Subject: Re: bug#61275: c-ts-mode: (eq treesit-font-lock-level 2) doesn't
 fontify parameter names.
Date: Sat, 04 Feb 2023 18:57:15 +0200
> Date: Sat, 4 Feb 2023 16:27:13 +0000
> From: Alan Mackenzie <acm <at> muc.de>
> 
>     int foo (int bar)
>     {
>         int baz;
> 
>         baz = bar;
> 	return baz;
>     }
> 
> , the definition of bar is not fontified, but that of baz is.

By "the definition of bar", do you mean this:

    int foo (int bar)
                 ^^^
or do you mean something else?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61275; Package emacs. (Sat, 04 Feb 2023 17:01:02 GMT) Full text and rfc822 format available.

Message #11 received at 61275 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 61275 <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 17:00:45 +0000
Hello, Eli.

On Sat, Feb 04, 2023 at 18:57:15 +0200, Eli Zaretskii wrote:
> > Date: Sat, 4 Feb 2023 16:27:13 +0000
> > From: Alan Mackenzie <acm <at> muc.de>

> >     int foo (int bar)
> >     {
> >         int baz;

> >         baz = bar;
> > 	return baz;
> >     }

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

> By "the definition of bar", do you mean this:

>     int foo (int bar)
>                  ^^^

Yes, that's precisely what I meant.

> or do you mean something else?

No.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61275; Package emacs. (Sat, 04 Feb 2023 17:14:02 GMT) Full text and rfc822 format available.

Message #14 received at 61275 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 61275 <at> debbugs.gnu.org
Subject: Re: bug#61275: c-ts-mode: (eq treesit-font-lock-level 2) doesn't
 fontify parameter names.
Date: Sat, 04 Feb 2023 19:13:43 +0200
> 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".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61275; Package emacs. (Sat, 04 Feb 2023 17:21:01 GMT) Full text and rfc822 format available.

Message #17 received at 61275 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: acm <at> muc.de, Theodor Thornhill <theo <at> thornhill.no>,
 Yuan Fu <casouri <at> gmail.com>
Cc: 61275 <at> debbugs.gnu.org
Subject: Re: bug#61275: c-ts-mode: (eq treesit-font-lock-level 2) doesn't
 fontify parameter names.
Date: Sat, 04 Feb 2023 19:20:01 +0200
> 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.




Reply sent to Dmitry Gutov <dgutov <at> yandex.ru>:
You have taken responsibility. (Sat, 04 Feb 2023 20:55:01 GMT) Full text and rfc822 format available.

Notification sent to Alan Mackenzie <acm <at> muc.de>:
bug acknowledged by developer. (Sat, 04 Feb 2023 20:55:02 GMT) Full text and rfc822 format available.

Message #22 received at 61275-done <at> debbugs.gnu.org (full text, mbox):

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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61275; Package emacs. (Sat, 04 Feb 2023 21:00:02 GMT) Full text and rfc822 format available.

Message #25 received at 61275 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 61275 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Theodor Thornhill <theo <at> thornhill.no>, Yuan Fu <casouri <at> gmail.com>
Subject: Re: bug#61275: c-ts-mode: (eq treesit-font-lock-level 2) doesn't
 fontify parameter names.
Date: Sat, 4 Feb 2023 20:59:20 +0000
Hello, Dmitry.

On Sat, Feb 04, 2023 at 22:54:04 +0200, Dmitry Gutov wrote:
> Version: 29.1

[ .... ]

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

Thanks!

-- 
Alan Mackenzie (Nuremberg, Germany).




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 05 Mar 2023 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 52 days ago.

Previous Next


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