* treesit-language-source-alist: Presets and/or custom variable?
@ 2023-01-18 11:50 Arash Esbati
2023-01-18 12:52 ` Ruijie Yu via Emacs development discussions.
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Arash Esbati @ 2023-01-18 11:50 UTC (permalink / raw)
To: emacs-devel
Hi all,
just for the fun of it, I eval'd:
(setq treesit-language-source-alist
'((python . ("https://github.com/tree-sitter/tree-sitter-bash.git"))
(markdown . ("https://github.com/ikatyang/tree-sitter-markdown.git"))
(rust . ("https://github.com/tree-sitter/tree-sitter-rust.git"))
(elisp . ("https://github.com/Wilfred/tree-sitter-elisp.git"))))
and did `M-x treesit-install-language-grammar RET LANG RET' four times
with languages above. I'm on Win10, so Emacs built 4 .dll files and put
them under ~/.emacs.d/tree-sitter/ -- that went smooth. In order to
make this more convenient for others, would it make sense to preset this
variable with parsers available from this site[1]?
Further, it seems to me that this is a user-settable variable, so I'd
suggest to make it customizable.
Best, Arash
Footnotes:
[1] https://tree-sitter.github.io/tree-sitter/#available-parsers
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: treesit-language-source-alist: Presets and/or custom variable?
2023-01-18 11:50 treesit-language-source-alist: Presets and/or custom variable? Arash Esbati
@ 2023-01-18 12:52 ` Ruijie Yu via Emacs development discussions.
2023-01-18 12:53 ` Eli Zaretskii
2023-01-19 12:15 ` Pankaj Jangid
2 siblings, 0 replies; 7+ messages in thread
From: Ruijie Yu via Emacs development discussions. @ 2023-01-18 12:52 UTC (permalink / raw)
To: Arash Esbati; +Cc: emacs-devel
Arash Esbati <arash@gnu.org> writes:
> Hi all,
>
> just for the fun of it, I eval'd:
>
> (setq treesit-language-source-alist
> '((python . ("https://github.com/tree-sitter/tree-sitter-bash.git"))
> (markdown . ("https://github.com/ikatyang/tree-sitter-markdown.git"))
> (rust . ("https://github.com/tree-sitter/tree-sitter-rust.git"))
> (elisp . ("https://github.com/Wilfred/tree-sitter-elisp.git"))))
>
> and did `M-x treesit-install-language-grammar RET LANG RET' four times
> with languages above. I'm on Win10, so Emacs built 4 .dll files and put
> them under ~/.emacs.d/tree-sitter/ -- that went smooth. In order to
> make this more convenient for others, would it make sense to preset this
> variable with parsers available from this site[1]?
>
> Further, it seems to me that this is a user-settable variable, so I'd
> suggest to make it customizable.
>
> Best, Arash
>
> Footnotes:
> [1] https://tree-sitter.github.io/tree-sitter/#available-parsers
If I am understanding the situation correctly, this is impossible due to
GNU's policy against nonfree things in general. Someone might be able
to find the ML thread discussing this.
Best,
RY
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: treesit-language-source-alist: Presets and/or custom variable?
2023-01-18 11:50 treesit-language-source-alist: Presets and/or custom variable? Arash Esbati
2023-01-18 12:52 ` Ruijie Yu via Emacs development discussions.
@ 2023-01-18 12:53 ` Eli Zaretskii
2023-01-18 13:43 ` Arash Esbati
2023-01-19 12:15 ` Pankaj Jangid
2 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-01-18 12:53 UTC (permalink / raw)
To: Arash Esbati; +Cc: emacs-devel
> From: Arash Esbati <arash@gnu.org>
> Date: Wed, 18 Jan 2023 12:50:19 +0100
>
> (setq treesit-language-source-alist
> '((python . ("https://github.com/tree-sitter/tree-sitter-bash.git"))
> (markdown . ("https://github.com/ikatyang/tree-sitter-markdown.git"))
> (rust . ("https://github.com/tree-sitter/tree-sitter-rust.git"))
> (elisp . ("https://github.com/Wilfred/tree-sitter-elisp.git"))))
>
> and did `M-x treesit-install-language-grammar RET LANG RET' four times
> with languages above. I'm on Win10, so Emacs built 4 .dll files and put
> them under ~/.emacs.d/tree-sitter/ -- that went smooth. In order to
> make this more convenient for others, would it make sense to preset this
> variable with parsers available from this site[1]?
Sorry, no. This was already discussed, and the decision was not to
populate the variable by default, so as not to increase our
maintenance burden. Making grammar libraries available for Emacs
users is the job of downstream distros, not ours. We have enough on
our plate already.
> Further, it seems to me that this is a user-settable variable, so I'd
> suggest to make it customizable.
It isn't supposed to be a defcustom, as it's supposed to be populated
as you compile libraries.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: treesit-language-source-alist: Presets and/or custom variable?
2023-01-18 12:53 ` Eli Zaretskii
@ 2023-01-18 13:43 ` Arash Esbati
0 siblings, 0 replies; 7+ messages in thread
From: Arash Esbati @ 2023-01-18 13:43 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
> Sorry, no. This was already discussed, and the decision was not to
> populate the variable by default, so as not to increase our
> maintenance burden.
Ah, sorry, I must have missed that discussion.
> It isn't supposed to be a defcustom, as it's supposed to be populated
> as you compile libraries.
Ok, thanks.
Best, Arash
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: treesit-language-source-alist: Presets and/or custom variable?
2023-01-18 11:50 treesit-language-source-alist: Presets and/or custom variable? Arash Esbati
2023-01-18 12:52 ` Ruijie Yu via Emacs development discussions.
2023-01-18 12:53 ` Eli Zaretskii
@ 2023-01-19 12:15 ` Pankaj Jangid
2023-01-19 15:17 ` Arash Esbati
2 siblings, 1 reply; 7+ messages in thread
From: Pankaj Jangid @ 2023-01-19 12:15 UTC (permalink / raw)
To: emacs-devel
Arash Esbati <arash@gnu.org> writes:
> just for the fun of it, I eval'd:
>
> (setq treesit-language-source-alist
> '((python . ("https://github.com/tree-sitter/tree-sitter-bash.git"))
> (markdown . ("https://github.com/ikatyang/tree-sitter-markdown.git"))
> (rust . ("https://github.com/tree-sitter/tree-sitter-rust.git"))
> (elisp . ("https://github.com/Wilfred/tree-sitter-elisp.git"))))
>
> and did `M-x treesit-install-language-grammar RET LANG RET' four times
> with languages above.
How to compile for langs like "tsx", which requires different value for
"sourcedir" and "grammardir" in the helper build.sh script?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: treesit-language-source-alist: Presets and/or custom variable?
2023-01-19 12:15 ` Pankaj Jangid
@ 2023-01-19 15:17 ` Arash Esbati
2023-01-20 4:23 ` Pankaj Jangid
0 siblings, 1 reply; 7+ messages in thread
From: Arash Esbati @ 2023-01-19 15:17 UTC (permalink / raw)
To: Pankaj Jangid; +Cc: emacs-devel
Pankaj Jangid <pankaj@codeisgreat.org> writes:
> How to compile for langs like "tsx", which requires different value for
> "sourcedir" and "grammardir" in the helper build.sh script?
,----[ C-h v treesit-language-source-alist RET ]
| treesit-language-source-alist is a variable defined in ‘treesit.el’.
|
| Its value is nil
|
| Configuration for downloading and installing tree-sitter language grammars.
|
| The value should be an alist where each element has the form
|
| (LANG . (URL REVISION SOURCE-DIR CC C++))
|
| Only LANG and URL are mandatory. LANG is the language symbol.
| URL is the Git repository URL for the grammar.
|
| REVISION is the Git tag or branch of the desired version,
| defaulting to the latest default branch.
|
| SOURCE-DIR is the relative subdirectory in the repository in which
| the grammar’s parser.c file resides, defaulting to "src".
|
| CC and C++ are C and C++ compilers, defaulting to "cc" and
| "c++", respectively.
|
`----
IIUC, SOURCE-DIR is what you're looking for. Something like this should
do the trick:
(setq treesit-language-source-alist
'((tsx . ("https://github.com/tree-sitter/tree-sitter-typescript.git"
nil "tsx/src"))))
Best, Arash
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-01-20 4:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-18 11:50 treesit-language-source-alist: Presets and/or custom variable? Arash Esbati
2023-01-18 12:52 ` Ruijie Yu via Emacs development discussions.
2023-01-18 12:53 ` Eli Zaretskii
2023-01-18 13:43 ` Arash Esbati
2023-01-19 12:15 ` Pankaj Jangid
2023-01-19 15:17 ` Arash Esbati
2023-01-20 4:23 ` Pankaj Jangid
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.