|
From: | Dmitry Gutov |
Subject: | Re: An anonymous IRC user's opinion |
Date: | Sat, 12 Oct 2024 23:27:01 +0300 |
User-agent: | Mozilla Thunderbird |
On 12/10/2024 10:34, Eli Zaretskii wrote:
Actually, thinking back the last time we made such a move, we got a report from a user who preferred to have files in question (*.toml) in fundamental-mode, because they didn't want the hassle of installing the toml tree-sitter grammar (bug#60559). The said user didn't have Emacs compiled with tree-sitter, so if we wanted to revisit that issue, we could enable ts mode globally when Emacs is compiled with that support, and when it isn't, keep them out of auto-mode-alist.If we want to be selective, we should also check if the grammar library is installed. Or we could tell the user, when a Rust file is first visited and the grammar is not available, that we recommend to install the grammar.
Telling that the grammar is not installed is still useful. Even if we say "grammar xyz not available" only once per session, we still have to decide whether the major mode switch happens (with perhaps reduced features - such as non-working indentation/font-lock/etc, but with for example Eglot recognizing the file type now).
Either way, this is not very trivial, and someone should do the work of designing the best UI and coding it.I even pass --without-tree-sitter to configure now. It seemsparticularly surprising to me that I explicitly tell emacs "don't use tree-sitter" and then it immediately starts complaining to me that it doesn't have tree-sitter.Feel free to improve what we have. My point is that it is not very trivial; what we have is basically a compromise, which could be improved, at least for some languages, if we want to be smarter.
The proposal I'm quoting is straightforward: if Emacs is compiled with tree-sitter support, enable the modes and warn when the grammars are not available. If Emacs is not compiled with tree-sitter, do neither.
That kind of rule has predictability: for example if the grammar was not installed originally but the user did that while Emacs was running, the corresponding major mode will start working the next time the user tries to enable it. That wouldn't be the case if we conditionally alter auto-mode-alist based on grammar availability.
The above approach should be quite easy to implement, if there's agreement to it. Otherwise, the issue is about choosing the details of the UI first.
[Prev in Thread] | Current Thread | [Next in Thread] |