unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61275: c-ts-mode: (eq treesit-font-lock-level 2) doesn't fontify parameter names.
@ 2023-02-04 16:27 Alan Mackenzie
  2023-02-04 16:57 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Mackenzie @ 2023-02-04 16:27 UTC (permalink / raw)
  To: 61275

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#61275: c-ts-mode: (eq treesit-font-lock-level 2) doesn't fontify parameter names.
  2023-02-04 16:27 bug#61275: c-ts-mode: (eq treesit-font-lock-level 2) doesn't fontify parameter names Alan Mackenzie
@ 2023-02-04 16:57 ` Eli Zaretskii
  2023-02-04 17:00   ` Alan Mackenzie
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-02-04 16:57 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 61275

> Date: Sat, 4 Feb 2023 16:27:13 +0000
> From: Alan Mackenzie <acm@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?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#61275: c-ts-mode: (eq treesit-font-lock-level 2) doesn't fontify parameter names.
  2023-02-04 16:57 ` Eli Zaretskii
@ 2023-02-04 17:00   ` Alan Mackenzie
  2023-02-04 17:13     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Mackenzie @ 2023-02-04 17:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 61275

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#61275: c-ts-mode: (eq treesit-font-lock-level 2) doesn't fontify parameter names.
  2023-02-04 17:00   ` Alan Mackenzie
@ 2023-02-04 17:13     ` Eli Zaretskii
  2023-02-04 17:20       ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-02-04 17:13 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 61275

> Date: Sat, 4 Feb 2023 17:00:45 +0000
> Cc: 61275@debbugs.gnu.org
> From: Alan Mackenzie <acm@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".





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#61275: c-ts-mode: (eq treesit-font-lock-level 2) doesn't fontify parameter names.
  2023-02-04 17:13     ` Eli Zaretskii
@ 2023-02-04 17:20       ` Eli Zaretskii
  2023-02-04 20:54         ` Dmitry Gutov
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-02-04 17:20 UTC (permalink / raw)
  To: acm, Theodor Thornhill, Yuan Fu; +Cc: 61275

> Cc: 61275@debbugs.gnu.org
> Date: Sat, 04 Feb 2023 19:13:43 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > Date: Sat, 4 Feb 2023 17:00:45 +0000
> > Cc: 61275@debbugs.gnu.org
> > From: Alan Mackenzie <acm@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#61275: c-ts-mode: (eq treesit-font-lock-level 2) doesn't fontify parameter names.
  2023-02-04 17:20       ` Eli Zaretskii
@ 2023-02-04 20:54         ` Dmitry Gutov
  2023-02-04 20:59           ` Alan Mackenzie
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Gutov @ 2023-02-04 20:54 UTC (permalink / raw)
  To: Eli Zaretskii, acm, Theodor Thornhill, Yuan Fu; +Cc: 61275-done

Version: 29.1

On 04/02/2023 19:20, Eli Zaretskii wrote:
>> Cc:61275@debbugs.gnu.org
>> Date: Sat, 04 Feb 2023 19:13:43 +0200
>> From: Eli Zaretskii<eliz@gnu.org>
>>
>>> Date: Sat, 4 Feb 2023 17:00:45 +0000
>>> Cc:61275@debbugs.gnu.org
>>> From: Alan Mackenzie<acm@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#61275: c-ts-mode: (eq treesit-font-lock-level 2) doesn't fontify parameter names.
  2023-02-04 20:54         ` Dmitry Gutov
@ 2023-02-04 20:59           ` Alan Mackenzie
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Mackenzie @ 2023-02-04 20:59 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 61275, Eli Zaretskii, Theodor Thornhill, Yuan Fu

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-02-04 20:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-04 16:27 bug#61275: c-ts-mode: (eq treesit-font-lock-level 2) doesn't fontify parameter names Alan Mackenzie
2023-02-04 16:57 ` Eli Zaretskii
2023-02-04 17:00   ` Alan Mackenzie
2023-02-04 17:13     ` Eli Zaretskii
2023-02-04 17:20       ` Eli Zaretskii
2023-02-04 20:54         ` Dmitry Gutov
2023-02-04 20:59           ` Alan Mackenzie

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).