emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tree-sitter introduction documentation


From: Yuan Fu
Subject: Re: Tree-sitter introduction documentation
Date: Sat, 31 Dec 2022 14:14:00 -0800


> On Dec 31, 2022, at 1:24 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Fri, 30 Dec 2022 16:03:42 -0800
>> Cc: Philip Kaludercic <philipk@posteo.net>,
>> monnier@iro.umontreal.ca,
>> dgutov@yandex.ru,
>> theophilusx@gmail.com,
>> emacs-devel@gnu.org
>> 
>>> I don't think treesit-language-source-alist is a good idea, especially
>>> if we don't intend populating it, at least not as a user-facing
>>> feature.  Instead, the command should ask the user for the relevant
>>> values, and offer recording the values on some file that would be read
>>> next time the user wants to install an updated library.
>> 
>> I consider this as a fallback method for installing language grammars. 
>> Because distress might not end up bundle language grammar for us, and even 
>> if they do, they can’t cover every grammar so some user would end up needing 
>> to install some grammar by themselves. If we don’t include this feature, 
>> someone will definitely write something like this and make it a third-party 
>> package (indeed, someone already has). So we might have it in Emacs and do 
>> it right.
>> 
>> This is the use case that I had in mind when writing this function: some 
>> major mode xxx-mode requires language grammar for xxx, so it has the 
>> following instruction in its readme:
>> 
>> Add installation recipe of tree-sitter-xxx to your config, and run 
>> treesit-install-language-grammar:
>> 
>> (add-to-list 'treesit-language-source-alist
>>             '(xxx "https://github.com/xxx/tree-sitter-xxx.git";))
> 
> This is a user command, so it must comply to some minimal level of
> usefulness and user-friendliness.  Right now, if you invoke the
> command after just loading treesit.el, you will be stuck at the first
> prompt, since Emacs says "No match" whatever language you try to type
> at the front.
> 
> Why not allow the user to specify all the necessary data needed for a
> language, if treesit-language-source-alist lacks those details for
> that language?  You can then update the data structure with those
> details.  Wouldn't this be much better and user-friendlier than asking
> users to read the readme and fill a data structure (which some of them
> could fill wrongly, not being Lisp programmers) in advance?

Makes sense, I can do that.

> 
>>> This command should also be mentioned in NEWS, where we describe how
>>> to install the grammar libraries.
>> 
>> I’ll do that if we decide this function is desirable and good.
> 
> ?? It's already on the branch, so I think we are past that point?

I thought that was my unilateral action which might be rejected, but anyway, 
I’ll add a NEWS entry :-)

Yuan




reply via email to

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