[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tree-sitter api
From: |
Eli Zaretskii |
Subject: |
Re: Tree-sitter api |
Date: |
Tue, 07 Sep 2021 19:16:14 +0300 |
> From: Tuấn-Anh Nguyễn <ubolonton@gmail.com>
> Date: Tue, 7 Sep 2021 22:38:52 +0700
> Cc: Yuan Fu <casouri@gmail.com>, Theodor Thornhill <theo@thornhill.no>,
> Stephen Leake <stephen_leake@stephe-leake.org>,
> Clément Pit-Claudel <cpitclaudel@gmail.com>,
> Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel
> <emacs-devel@gnu.org>
>
> On Mon, Sep 6, 2021 at 12:33 PM Eli Zaretskii <eliz@gnu.org> wrote:
> > I understand that a language module gets compiled into a shared
> > library, either as part of building TS or separately. But what should
> > Emacs do to "load" the module, and when should it do that? And how do
> > we intend to handle the situation where a module is needed, but is not
> > available (i.e. its loading fails)?
>
> Emacs should "load" the module when it's asked to do so, by a function, e.g.
> `tree-sitter-load-lang`. When loading fails, it should signal an error.
So this has to be an explicit load initiated by a Lisp program? How
would that program know which module to load for a given language? (I
thought TS would load the module it needs whenever support for a
language is requested.)
> To locate the module, I think there are 2 possible approaches:
> 1. Emacs consults a new search path variable to look for the module, which is
> named `<lang>[.ext]`, and calls `dynlib_open` with the absolute path.
> 2. Emacs calls `dynlib_open` with the basename `tree-sitter-<lang>[.ext]`,
> relying on the module being correctly put on the system's library search
> path,
> e.g. by the distro's package manager.
>
> Option 2 sounds better to me, but option 1 is how people do it at the moment.
> (And no distro has packaged these AFAICT.)
I think 2 is better, since we are relying on others to build and
package these modules.
Thanks.
- Re: Tree-sitter api, (continued)
- Re: Tree-sitter api, Yuan Fu, 2021/09/04
- Re: Tree-sitter api, Tuấn-Anh Nguyễn, 2021/09/05
- Re: Tree-sitter api, Yuan Fu, 2021/09/05
- Re: Tree-sitter api, Tuấn-Anh Nguyễn, 2021/09/05
- Re: Tree-sitter api, Yuan Fu, 2021/09/05
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/06
- Re: Tree-sitter api, Tuấn-Anh Nguyễn, 2021/09/07
- Re: Tree-sitter api,
Eli Zaretskii <=
- Re: Tree-sitter api, Yuan Fu, 2021/09/07
- Re: Tree-sitter api, Yuan Fu, 2021/09/09
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/10
- Re: Tree-sitter api, Yuan Fu, 2021/09/10
- Re: Tree-sitter api, Tuấn-Anh Nguyễn, 2021/09/10
- Re: Tree-sitter api, Yuan Fu, 2021/09/11
- Re: Tree-sitter api, Tuấn-Anh Nguyễn, 2021/09/11
- Re: Tree-sitter api, Yuan Fu, 2021/09/11
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/11
- Re: Tree-sitter api, Yuan Fu, 2021/09/11