[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Define treesit-font-lock-level as buffer local
From: |
Yuan Fu |
Subject: |
Re: Define treesit-font-lock-level as buffer local |
Date: |
Sat, 7 Dec 2024 23:44:25 -0800 |
> On Dec 7, 2024, at 4:04 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
> Ping!
>
>> Date: Sat, 23 Nov 2024 14:20:28 +0200
>> From: Eli Zaretskii <eliz@gnu.org>
>> Cc: v.pupillo@gmail.com, emacs-devel@gnu.org
>>
>>> From: Yuan Fu <casouri@gmail.com>
>>> Date: Sun, 10 Nov 2024 00:04:00 -0800
>>> Cc: Vincenzo Pupillo <v.pupillo@gmail.com>,
>>> emacs-devel@gnu.org
>>>
>>>
>>>
>>>> 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.
>>
>> Did you have time to work on this?
Ok, following the recent discussion, I implemented the original idea, which is
an alist mapping major modes to font lock levels. The check is made with
derived-mode-p, so c-mode should work for c-ts-mode too, but I still used
c-ts-mode in the example in the docstring since I don’t want to complicate it.
The change is pushed to master.
Yuan