emacs-devel
[Top][All Lists]
Advanced

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

Re: Tree-sitter introduction documentation


From: Eli Zaretskii
Subject: Re: Tree-sitter introduction documentation
Date: Sun, 01 Jan 2023 08:54:38 +0200

> From: Richard Stallman <rms@gnu.org>
> Cc: emacs-devel@gnu.org
> Date: Sat, 31 Dec 2022 22:03:56 -0500
> 
>   > (setq treesit-language-source-alist
>   >       '((python "https://github.com/tree-sitter/tree-sitter-python.git";)
>   >         (typescript 
> "https://github.com/tree-sitter/tree-sitter-typescript.git";
>   >                     "typescript/src" "typescript")))
> 
> A GNU package should not load other programs straight off of someone
> else's repository.  That is vulnerable to surprise changes, in the
> code and in its license.  We can hardly count on Github to make sure
> these run without any nonfree software.

The above was an example of user customizations.  There's no such text
anywhere in Emacs, nor there will be.  Emacs will be distributed with
that variable having the nil value, and users will have to download
and install the grammar libraries by themselves.  The major modes we
distribute all use grammars whose licenses are free, and as long as we
take care to verify this aspect, there should be no problem here from
this aspect.

> There are three proper ways for Emacs to handle it needs.
> 
> * To assume that they are already installed.  Normally they would be
> part of some other package in your system distro.  This is what we do
> with many standard tools and libraries.
> 
> With this method, we outsource the vetting of those programs to the
> GNU/Linux distro.  If you use a free distro, you can count it to make
> free versions of those programs available to install.
> 
> We could in principle handle tree-sitter grammars this way,
> but only if and when GNU/Linux distros generally package them.
> Is that the case today?
> 
> * To include their source code in Emacs the Emacs release, and build
> them along with the rest of Emacs.
> 
> * To tell the user, "Installing these external programs is your
> responsibility."  That is the least helpful method, but it's
> acceptable.

We currently assume either the 1st or the 3rd alternative.  For the
details, see the text in NEWS about installing the grammar libraries.

> How does the current tree-sitter code obtain grammars to run?

It doesn't.  It expects these grammar libraries to be installed "by
other means".  The tree-sitter code just checks that the grammar is
available, and if not, emits a warning to that effect and doesn't
enable the related features.

> Does it download those straight from Github too?

There's a command to download and install a grammar library, but it
leaves it to the user to specify from where to download the library
the user wants.



reply via email to

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