emacs-devel
[Top][All Lists]
Advanced

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

Re: Average-user-facing interface for tree-sitter


From: Yuan Fu
Subject: Re: Average-user-facing interface for tree-sitter
Date: Tue, 18 Oct 2022 13:58:40 -0700


> On Oct 18, 2022, at 1:49 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> 
>> How about a function mode-specific-value that takes any variable with the 
>> following shape:
>> 
>> ((MODE VALUE INHERIT)…)
>> 
>> And returns the right VALUE for the current mode? INHERIT decides
>> whether VALUE is inherited by MODE’s derived modes.
> 
> FWIW, `inherit` should be the default, IMO, so the third part should
> specify DONT-INHERIT.
> 
>> This function would handle derived mode ok, but I don’t know what are
>> the other problems you are think of, maybe you can tell me what this
>> function falls short for. And we can go from there.
> 
> The function is one thing.  Another question is when it is run, and
> hence how it interacts with other ways to enable/set/control the thing
> you want to control (in this case enabling `treesit-mode`, IIUC).
> 
> I recommend you focus on making the `treesit-mode` minor mode work
> regardless when it's called.  So it can be controlled by the usual
> (add-hook foo-mode-hook #'treesit-mode).
> 
> Then we can worry about how `global-treesit-mode` should be controlled
> (and worry about harmonizing it with `global-font-lock-mode`, for
> example, which relies on `font-lock-global-modes` which is also such
> a centralized way to specify the behavior per-mode (and a poor one at
> that if you ask me)).

I installed treesit-mode and global-treesit-mode. Errr global-treesit-mode uses 
define-globalized-minor-mode so it has a global-treesit-modes, sooo...

Yuan


reply via email to

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