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: Stefan Monnier
Subject: Re: Average-user-facing interface for tree-sitter
Date: Tue, 18 Oct 2022 16:49:03 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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


        Stefan




reply via email to

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