* Define treesit-font-lock-level as buffer local
@ 2024-11-07 10:30 Vincenzo Pupillo
2024-11-07 11:03 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Vincenzo Pupillo @ 2024-11-07 10:30 UTC (permalink / raw)
To: emacs-devel
Ciao,
I use tree-sitter for different languages, for some of them I prefer font lock level 3, for others I prefer level 4.
treesit-font-lock-level, however, is not defined as buffer local and so there is no elegant way to have
different levels for different languages.
Would it be possible to define treesit-font-lock-level as a buffer local?
Thank you.
V.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Define treesit-font-lock-level as buffer local
2024-11-07 10:30 Define treesit-font-lock-level as buffer local Vincenzo Pupillo
@ 2024-11-07 11:03 ` Eli Zaretskii
2024-11-07 11:08 ` Vincenzo Pupillo
0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2024-11-07 11:03 UTC (permalink / raw)
To: Vincenzo Pupillo, Yuan Fu; +Cc: emacs-devel
> From: Vincenzo Pupillo <v.pupillo@gmail.com>
> Date: Thu, 07 Nov 2024 11:30:03 +0100
>
> Ciao,
> I use tree-sitter for different languages, for some of them I prefer font lock level 3, for others I prefer level 4.
> treesit-font-lock-level, however, is not defined as buffer local and so there is no elegant way to have
> different levels for different languages.
> Would it be possible to define treesit-font-lock-level as a buffer local?
Is it a problem for you to do that in your init file?
Also, we could support a value of that variable which is a list, like
we do with font-lock-maximum-decoration. This will be more useful
than making the variable buffer-local, since presumably your
preferences are per-mode, not per-buffer. Yuan, WDYT?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Define treesit-font-lock-level as buffer local
2024-11-07 11:03 ` Eli Zaretskii
@ 2024-11-07 11:08 ` Vincenzo Pupillo
2024-11-09 8:36 ` Yuan Fu
0 siblings, 1 reply; 6+ messages in thread
From: Vincenzo Pupillo @ 2024-11-07 11:08 UTC (permalink / raw)
To: Yuan Fu, Eli Zaretskii; +Cc: emacs-devel
In data giovedì 7 novembre 2024 12:03:49 Ora standard dell’Europa centrale, Eli Zaretskii ha scritto:
> > From: Vincenzo Pupillo <v.pupillo@gmail.com>
> > Date: Thu, 07 Nov 2024 11:30:03 +0100
> >
> > Ciao,
> > I use tree-sitter for different languages, for some of them I prefer font lock level 3, for others I prefer level 4.
> > treesit-font-lock-level, however, is not defined as buffer local and so there is no elegant way to have
> > different levels for different languages.
> > Would it be possible to define treesit-font-lock-level as a buffer local?
>
> Is it a problem for you to do that in your init file?
No, it's not a problem.
> Also, we could support a value of that variable which is a list, like
> we do with font-lock-maximum-decoration. This will be more useful
> than making the variable buffer-local, since presumably your
> preferences are per-mode, not per-buffer.
Yes, this would be a better solution.
> Yuan, WDYT?
>
V.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Define treesit-font-lock-level as buffer local
2024-11-07 11:08 ` Vincenzo Pupillo
@ 2024-11-09 8:36 ` Yuan Fu
2024-11-09 8:54 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Yuan Fu @ 2024-11-09 8:36 UTC (permalink / raw)
To: Vincenzo Pupillo; +Cc: Eli Zaretskii, emacs-devel
> On Nov 7, 2024, at 3:08 AM, Vincenzo Pupillo <v.pupillo@gmail.com> wrote:
>
> In data giovedì 7 novembre 2024 12:03:49 Ora standard dell’Europa centrale, Eli Zaretskii ha scritto:
>>> From: Vincenzo Pupillo <v.pupillo@gmail.com>
>>> Date: Thu, 07 Nov 2024 11:30:03 +0100
>>>
>>> Ciao,
>>> I use tree-sitter for different languages, for some of them I prefer font lock level 3, for others I prefer level 4.
>>> treesit-font-lock-level, however, is not defined as buffer local and so there is no elegant way to have
>>> different levels for different languages.
>>> Would it be possible to define treesit-font-lock-level as a buffer local?
>>
>> Is it a problem for you to do that in your init file?
>
> No, it's not a problem.
>
>> Also, we could support a value of that variable which is a list, like
>> we do with font-lock-maximum-decoration. This will be more useful
>> than making the variable buffer-local, since presumably your
>> preferences are per-mode, not per-buffer.
> Yes, this would be a better solution.
>
>> Yuan, WDYT?
>>
Perhaps even per-language, for multi-language modes. I think it’s a valid use case. IMO, specify the level by language is better than mode. For single language modes, using the language is equivalent to using the mode; for multi-language modes, using the language allows more flexibility.
Yuan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Define treesit-font-lock-level as buffer local
2024-11-09 8:36 ` Yuan Fu
@ 2024-11-09 8:54 ` Eli Zaretskii
2024-11-10 8:04 ` Yuan Fu
0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2024-11-09 8:54 UTC (permalink / raw)
To: Yuan Fu; +Cc: v.pupillo, emacs-devel
> From: Yuan Fu <casouri@gmail.com>
> Date: Sat, 9 Nov 2024 00:36:31 -0800
> Cc: Eli Zaretskii <eliz@gnu.org>,
> emacs-devel@gnu.org
>
> >> Also, we could support a value of that variable which is a list, like
> >> we do with font-lock-maximum-decoration. This will be more useful
> >> than making the variable buffer-local, since presumably your
> >> preferences are per-mode, not per-buffer.
> > Yes, this would be a better solution.
> >
> >> Yuan, WDYT?
> >>
>
> Perhaps even per-language, for multi-language modes. I think it’s a valid use case. IMO, specify the level by language is better than mode. For single language modes, using the language is equivalent to using the mode; for multi-language modes, using the language allows more flexibility.
Patches welcome.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Define treesit-font-lock-level as buffer local
2024-11-09 8:54 ` Eli Zaretskii
@ 2024-11-10 8:04 ` Yuan Fu
0 siblings, 0 replies; 6+ messages in thread
From: Yuan Fu @ 2024-11-10 8:04 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Vincenzo Pupillo, emacs-devel
> On Nov 9, 2024, at 12:54 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Sat, 9 Nov 2024 00:36:31 -0800
>> Cc: Eli Zaretskii <eliz@gnu.org>,
>> emacs-devel@gnu.org
>>
>>>> Also, we could support a value of that variable which is a list, like
>>>> we do with font-lock-maximum-decoration. This will be more useful
>>>> than making the variable buffer-local, since presumably your
>>>> preferences are per-mode, not per-buffer.
>>> Yes, this would be a better solution.
>>>
>>>> Yuan, WDYT?
>>>>
>>
>> Perhaps even per-language, for multi-language modes. I think it’s a valid use case. IMO, specify the level by language is better than mode. For single language modes, using the language is equivalent to using the mode; for multi-language modes, using the language allows more flexibility.
>
> Patches welcome.
I’ll prepare one soon.
Yuan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-11-10 8:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07 10:30 Define treesit-font-lock-level as buffer local Vincenzo Pupillo
2024-11-07 11:03 ` Eli Zaretskii
2024-11-07 11:08 ` Vincenzo Pupillo
2024-11-09 8:36 ` Yuan Fu
2024-11-09 8:54 ` Eli Zaretskii
2024-11-10 8:04 ` Yuan Fu
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).