[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tree-sitter maturity
From: |
Eli Zaretskii |
Subject: |
Re: Tree-sitter maturity |
Date: |
Sun, 29 Dec 2024 09:26:37 +0200 |
> From: Richard Stallman <rms@gnu.org>
> Cc: emacs-devel@gnu.org, manphiz@gmail.com
> Date: Sat, 28 Dec 2024 23:19:45 -0500
>
> > Oh, and another point I have been reminded of while writing this: The
> > recent addition of more and more -ts-modes without "regular" -modes has
> > been slightly concerning. While I understand that re-implementing a
> > "lua-mode" or "php-mode" from scratch is not an effort one wants to
> > impose on anymore,
>
> This is not clean, and might be a real problem. What should happen
> when someone who does not use tree-sitter visits a Lua file or a PHP
> file? What happens in those cases now?
Nothing happens. These modes are currently all optional, so the users
currently must load the mode manually (or in their init files) to have
auto-mode-alist modified to affect visiting the corresponding files.
For example, lua-ts-mode.el has this at top-level:
(when (treesit-ready-p 'lua)
(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-ts-mode))
(add-to-list 'interpreter-mode-alist '("\\<lua\\(?:jit\\)?" . lua-ts-mode)))
So to activate this, the user needs to load the mode, Emacs should be
compiled with tree-sitter support, and the grammar library should be
installed; otherwise auto-mode-alist will not be modified, and
visiting Lua files will use Fundamental mode.
> In general, Emacs should not have a FOO-ts-mode without a correspnding
> FOO-mode.
I disagree. I don't object having non-ts modes, of course, but see no
reason to mandate such modes when a tree-sitter-based mode exists. We
made those modes optional as above for that very reason: to make sure
they are activated only if the user says so and only if the necessary
prerequisites are fulfilled.
> Otherwise users will get surprised.
We made those modes optional to avoid surprising users.
> It might be simple to modify lua-ts-mode so that it can be directed to
> disable tree-sitter, perhaps by a global variable -- and then define
> lua-mode to call lua-ts-mode after specifying that.
The last part was exactly what prompted Alan Mackenzie to resign. It
sounds like you now agree with what the rest of us think: that
interpreting lua-mode as meaning invoke lua-ts-mode is fine?
- Re: Tree-sitter maturity, (continued)
- Re: Tree-sitter maturity, Yuan Fu, 2024/12/29
- Re: Tree-sitter maturity, Daniel Colascione, 2024/12/29
- Re: Tree-sitter maturity, Eli Zaretskii, 2024/12/29
- Re: Tree-sitter maturity, Daniel Colascione, 2024/12/29
- Re: Tree-sitter maturity, Eli Zaretskii, 2024/12/29
- Re: Tree-sitter maturity, Daniel Colascione, 2024/12/29
- Re: Tree-sitter maturity, tomas, 2024/12/29
- Re: Tree-sitter maturity, Yuan Fu, 2024/12/29
- Re: Tree-sitter maturity, Daniel Colascione, 2024/12/29
- Re: Tree-sitter maturity, Dmitry Gutov, 2024/12/29
- Re: Tree-sitter maturity,
Eli Zaretskii <=
- Message not available
- Message not available
- Message not available
- Re: Tree-sitter maturity, Philip Kaludercic, 2024/12/31
- Re: Tree-sitter maturity, Lynn Winebarger, 2024/12/29
- Re: Tree-sitter maturity, Daniel Colascione, 2024/12/29
- Re: Tree-sitter maturity, Björn Bidar, 2024/12/29
- Message not available
- Re: Tree-sitter maturity, Yuan Fu, 2024/12/29
- Re: Tree-sitter maturity, Daniel Colascione, 2024/12/29
- Re: Tree-sitter maturity, Yuan Fu, 2024/12/29
- Re: Tree-sitter maturity, Philip Kaludercic, 2024/12/31
- Re: Tree-sitter maturity, Lynn Winebarger, 2024/12/29
- Re: Tree-sitter maturity, Björn Bidar, 2024/12/30