[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tree-sitter api
From: |
Stefan Monnier |
Subject: |
Re: Tree-sitter api |
Date: |
Sun, 08 Aug 2021 19:24:38 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Yuan Fu [2021-08-08 17:56:33] wrote:
>> On Aug 7, 2021, at 10:47 AM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>>> We should have a user option to control tree-sitter on major mode
>>> level. Maybe an alist where each car is a major node symbol and each cdr is
>>> a Boolean value toggling tree-sitter for that node.
>> The more traditional approach is to use a buffer-local var set by the
>> major mode or set via (add-hook '<MODE>-hook ...).
> The major-mode would setup things like font-lock-defaults and
> tree-sitter-defaults before major-mode-hook runs, so I think
> enabling/disabling tree-sitter in the hook is too late, no?
I don't see why. Presumably the major mode would set some vars relevant
to the tree-sitter support, but then whether those vars are used will
depend on the buffer-local boolean var (let's call it `tree-sitter-mode`).
I'm sure there will be issues w.r.t initialization order, e.g. in case
`font-lock-mode` is enabled before `tree-sitter-mode`, but that doesn't
seem very serious (`font-lock-mode` doesn't do much anyway, since the
real work is postponed until the next redisplay by jit-lock, so we could
"refresh" font-lock settings fairly cheaply within `tree-sitter-mode`).
Stefan
- Re: [SPAM UNSURE] Re: Tree-sitter api, (continued)
- Re: Tree-sitter api, Stefan Monnier, 2021/08/24
- Re: Tree-sitter api, Yuan Fu, 2021/08/21
- Re: Tree-sitter api, Yuan Fu, 2021/08/21
- Re: Tree-sitter api, Eli Zaretskii, 2021/08/22
- Re: Tree-sitter api, Eli Zaretskii, 2021/08/22
- Re: Tree-sitter api, Stefan Monnier, 2021/08/24
- Re: Tree-sitter api, Yuan Fu, 2021/08/27
- Re: Tree-sitter api, Yuan Fu, 2021/08/08
- Re: Tree-sitter api,
Stefan Monnier <=
- Re: Tree-sitter api, Yuan Fu, 2021/08/08