[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 22:52:33 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
>> BTW, I see that `global-treesit-mode--turn-on` is currently a (non
>> official) alias of `treesit-mode`, but I think it should only call
>> `treesit-mode` in those buffers where there is some indication that the
>> major mode provides some treesit-mode support (e.g., currently that
>> could be if `major-mode-backend-function` is set).
>
> I’m changing it to what you described in another email. (So
> major-mode-backend-function is goner). I can use treesit-font-lock-settings
> as the minimum criterion.
>
>>
>> And then maybe `treesit-mode` should signal an error (and turn itself
>> off) if it's enabled in a buffer whose major mode does not provide any
>> support for `treesit-mode`.
>
> So currently treesit-mode signals a warning if it can’t activate tree-sitter
> and (eq this-command ’treesit-mode), but if it is called in find-file-hook,
> etc set up by global-treesit-mode, it doesn’t signal a warning.
That's why define-globalized-minor-mode has a TURN-ON function
argument separately from the MODE argument: the TURN-ON function has
to determine whether to enable the minor mode or not. It shouldn't
blindly call `treesit-mode` but first check whether `treesit-mode`
is applicable.
This way, `treesit-mode` can always signal an error when called in
a buffer where it's not applicable: it's always the responsibility of
the caller to check beforehand.
Stefan
- Re: Average-user-facing interface for tree-sitter, (continued)
- Re: Average-user-facing interface for tree-sitter, Yuan Fu, 2022/10/14
- Re: Average-user-facing interface for tree-sitter, Stefan Monnier, 2022/10/14
- Re: Average-user-facing interface for tree-sitter, Yuan Fu, 2022/10/15
- Re: Average-user-facing interface for tree-sitter, Yuan Fu, 2022/10/17
- Re: Average-user-facing interface for tree-sitter, Lars Ingebrigtsen, 2022/10/17
- Re: Average-user-facing interface for tree-sitter, Yuan Fu, 2022/10/18
- Re: Average-user-facing interface for tree-sitter, Stefan Monnier, 2022/10/18
- Re: Average-user-facing interface for tree-sitter, Yuan Fu, 2022/10/18
- Re: Average-user-facing interface for tree-sitter, Stefan Monnier, 2022/10/18
- Re: Average-user-facing interface for tree-sitter, Yuan Fu, 2022/10/18
- Re: Average-user-facing interface for tree-sitter,
Stefan Monnier <=
- RE: [External] : Re: Average-user-facing interface for tree-sitter, Drew Adams, 2022/10/18
- Re: Average-user-facing interface for tree-sitter, Yuan Fu, 2022/10/19
- Re: Average-user-facing interface for tree-sitter, Theodor Thornhill, 2022/10/19
- Re: Average-user-facing interface for tree-sitter, Yuan Fu, 2022/10/19
- Re: Average-user-facing interface for tree-sitter, Theodor Thornhill, 2022/10/20
- Re: Average-user-facing interface for tree-sitter, Stefan Monnier, 2022/10/20
- Re: Average-user-facing interface for tree-sitter, Theodor Thornhill, 2022/10/20
- Re: Average-user-facing interface for tree-sitter, Theodor Thornhill, 2022/10/20
- Re: Average-user-facing interface for tree-sitter, Yuan Fu, 2022/10/20
- Re: Average-user-facing interface for tree-sitter, Yuan Fu, 2022/10/21