emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Initial fontification in sh-mode with tree-sittter


From: Yuan Fu
Subject: Re: Initial fontification in sh-mode with tree-sittter
Date: Mon, 31 Oct 2022 17:33:51 -0700


> On Oct 28, 2022, at 11:12 AM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> 
>>> This way, users can set a vague global "level" preference as a good
>>> baseline, which they can more finely tune according to their own
>>> preference by controlling individual features for specific modes.
>> I should probably add some convenient functions user can use to add/remove
>> feature from that list, since its not a plain list, but rather a list
>> of list.
> 
> I think this var should be provided by the major mode and not touched
> by users.
> 
> Instead we should provide another config var for users where they can
> individually enable/disable specific features for specific major modes.

How about:

(add-hook 'xxx-mode-hook
          (lambda ()
            (setq-local treesit-font-lock-disabled-features '(features...))
            (treesit-font-lock-recompute-features)))

Or

(add-hook 'xxx-mode-hook
          (lambda ()
            (treesit-font-lock-set-disabled-features 'features...)))

?

You probably don’t need to set enabled features, because you can set 
maximum-decoration to a high value and specify what to disable. And 
maximum-decoration is infinity by default.

BTW, I’m trying to think of a better prefix than font-lock for these functions 
and variables, maybe “fontify”? Like

treesit-fontify-region-function
treesit-fontify-rules
treesit-fontify-settings
treesit-fontify-feature-list

It being a verb is a bit strange, but “fontification” is too long. Actually, 
what does “lock” even mean in font lock?

Yuan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]