emacs-devel
[Top][All Lists]
Advanced

[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: Mon, 13 Sep 2021 14:47:27 +0300

> From: Yuan Fu <casouri@gmail.com>
> Date: Sun, 12 Sep 2021 21:15:31 -0700
> Cc: Tuấn-Anh Nguyễn <ubolonton@gmail.com>,
>  Theodor Thornhill <theo@thornhill.no>,
>  Clément Pit-Claudel <cpitclaudel@gmail.com>,
>  Emacs developers <emacs-devel@gnu.org>,
>  Stefan Monnier <monnier@iro.umontreal.ca>,
>  stephen_leake@stephe-leake.org
> 
> Not the end-user, no. But not really “Lisp Program”, either. I mean the human 
> being writing the major-mode and adapting the major-mode to utilize 
> tree-sitter features. The major mode writer should be able to figure out the 
> correct symbol to use, if she go checks out the project name for the language 
> definition, or the package name of the language definition in her package 
> manager, or by some other means. For example, one should be able to figure 
> out that tree-sitter-c is the symbol for C language definition, and 
> tree-sitter-c-sharp that C#. Then Emacs automatically translate tree-sitter-c 
> to libtree-sitter-c.so, and tree-sitter-c-sharp to libtree-sitter-c-sharp.so; 
> basically adding “lib” and “.so” (or “dylib” etc). If that doesn’t give the 
> correct library name for a quirky language, the major-mode writer can add an 
> entry to tree-sitter-library-name-override-list—(tree-sitter-quirky-lang 
> “libtree-sitter-qlang” “tree_sitter_qlang”)—and Emacs will use that. (Or she 
> can just use tree-sitter-qlang as the symbol, and Emacs’ auto translation 
> would just fine.)

It makes little sense to me to request each major mode to figure this
out.  It should IMO be a service provided by the TS integration into
Emacs.

> To summarize, we have 
> 
>       "load-suffixes” (".elc" ".el”, with M_SUFFIX & M_SEC_SUFFIX if modules 
> enabled), 
>       "module-file-suffix” (M_SUFFIX if modules enabled), 
>       "load-file-rep-suffixes” ("" ".gz"). 
> 
> All contribute to the possible file names Emacs tries when loading a file (be 
> it a Elisp file or an Emacs module). I will add a "shared-library-suffix” 
> specifically for loading dynamic libraries, its value will be MODULES_SUFFIX 
> regardless if module is enabled.

Maybe the other way around: define a shared-library-suffix, and make
MODULES_SUFFIX use that if Emacs is built with modules.

Otherwise, SGTM, thanks.




reply via email to

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