unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* tree-sitter and language support
@ 2022-11-25  5:20 T.V Raman
  2022-11-25  6:51 ` Yuan Fu
  2022-11-25 12:28 ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: T.V Raman @ 2022-11-25  5:20 UTC (permalink / raw)
  To: emacs-devel

I installed from elpa/melpa:

ls -1 -d tree-sitter-*
tree-sitter-20220212.1632/
tree-sitter-langs-20221122.645/
21:18:06 elpa $ 

but emacs compiled from latest Git Head still produces the completely
unhelpful message 
tree-support for language <x> is unavailable if I invoke c-ts-mode or
c++-ts-mode

A note in the News file detailing what bits one needs to install might
be the shoes we need to help us walk the final mile on this long road
to tree-sitter integration.

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: tree-sitter and language support
  2022-11-25  5:20 tree-sitter and language support T.V Raman
@ 2022-11-25  6:51 ` Yuan Fu
  2022-11-25 10:41   ` Roman Rudakov
  2022-11-25 17:57   ` T.V Raman
  2022-11-25 12:28 ` Eli Zaretskii
  1 sibling, 2 replies; 7+ messages in thread
From: Yuan Fu @ 2022-11-25  6:51 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel



> On Nov 24, 2022, at 9:20 PM, T.V Raman <raman@google.com> wrote:
> 
> I installed from elpa/melpa:
> 
> ls -1 -d tree-sitter-*
> tree-sitter-20220212.1632/
> tree-sitter-langs-20221122.645/
> 21:18:06 elpa $ 
> 
> but emacs compiled from latest Git Head still produces the completely
> unhelpful message 
> tree-support for language <x> is unavailable if I invoke c-ts-mode or
> c++-ts-mode
> 
> A note in the News file detailing what bits one needs to install might
> be the shoes we need to help us walk the final mile on this long road
> to tree-sitter integration.

We are just starting to work on tree-sitter’s user-facing documentation, including the (emacs) manual and NEWS file. I’ll definitely improve the error message. In the meantime, find files that looks like libtree-sitter-xxx.so and put them under ~/.emacs.d/tree-sitter (or a standard library location like /usr/local/lib), and Emacs should be able to find them.

Yuan


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: tree-sitter and language support
  2022-11-25  6:51 ` Yuan Fu
@ 2022-11-25 10:41   ` Roman Rudakov
  2022-11-25 12:05     ` Eli Zaretskii
  2022-11-25 17:57   ` T.V Raman
  1 sibling, 1 reply; 7+ messages in thread
From: Roman Rudakov @ 2022-11-25 10:41 UTC (permalink / raw)
  To: Yuan Fu; +Cc: T.V Raman, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1744 bytes --]


Yuan Fu <casouri@gmail.com> writes:

>> On Nov 24, 2022, at 9:20 PM, T.V Raman <raman@google.com> wrote:
>>
>> I installed from elpa/melpa:
>>
>> ls -1 -d tree-sitter-*
>> tree-sitter-20220212.1632/
>> tree-sitter-langs-20221122.645/
>> 21:18:06 elpa $
>>
>> but emacs compiled from latest Git Head still produces the 
>> completely
>> unhelpful message
>> tree-support for language <x> is unavailable if I invoke c-ts-mode 
>> or
>> c++-ts-mode
>>
>> A note in the News file detailing what bits one needs to install 
>> might
>> be the shoes we need to help us walk the final mile on this long 
>> road
>> to tree-sitter integration.
>
> We are just starting to work on tree-sitter’s user-facing
> documentation, including the (emacs) manual and NEWS file. I’ll
> definitely improve the error message. In the meantime, find files 
> that
> looks like libtree-sitter-xxx.so and put them under
> ~/.emacs.d/tree-sitter (or a standard library location like
> /usr/local/lib), and Emacs should be able to find them.
>
> Yuan

Hi Yuan!

I have a question. Are these paths hardcoded? I use MacOS, I've built 
a grammar for java using custom homebrew formula, it produces the file 
/opt/homebrew/lib/libtree-sitter-java.dylib, but when I open any java 
source file and try to activate java-ts-mode, I'm getting the error:

Warning (treesit): Cannot activate tree-sitter, because language 
definition for java is unavailable (not-found): 
(libtree-sitter-java.so libtree-sitter-java.dylib) No such file or 
directory

I can fix it by adding /opt/homebrew/lib to treesit-extra-load-path, 
but I'm wondering how to install grammar properly to avoid setting 
this variable.
--
Best regards, Roman

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: tree-sitter and language support
  2022-11-25 10:41   ` Roman Rudakov
@ 2022-11-25 12:05     ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2022-11-25 12:05 UTC (permalink / raw)
  To: rrudakov; +Cc: casouri, raman, emacs-devel

> From: Roman Rudakov <rrudakov@fastmail.com>
> Cc: "T.V Raman" <raman@google.com>, emacs-devel@gnu.org
> Date: Fri, 25 Nov 2022 11:41:47 +0100
> 
> > We are just starting to work on tree-sitter’s user-facing
> > documentation, including the (emacs) manual and NEWS file. I’ll
> > definitely improve the error message. In the meantime, find files 
> > that
> > looks like libtree-sitter-xxx.so and put them under
> > ~/.emacs.d/tree-sitter (or a standard library location like
> > /usr/local/lib), and Emacs should be able to find them.
> >
> > Yuan
> 
> Hi Yuan!
> 
> I have a question. Are these paths hardcoded?

This is Emacs; how can you assume such hard-coded paths are even possible?

Of course, they aren't hard-coded!  Emacs looks in the standard directories
for shared libraries, then in user-emacs-directory, then in the directories
mentioned in treesit-extra-load-path.

> I can fix it by adding /opt/homebrew/lib to treesit-extra-load-path, 
> but I'm wondering how to install grammar properly to avoid setting 
> this variable.

Adding this to treesit-extra-load-path is fine.  Alternatively, install the
shared library where you have the other shared libraries on your system
(a.k.a. "standard places").



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: tree-sitter and language support
  2022-11-25  5:20 tree-sitter and language support T.V Raman
  2022-11-25  6:51 ` Yuan Fu
@ 2022-11-25 12:28 ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2022-11-25 12:28 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

> Date: Thu, 24 Nov 2022 21:20:29 -0800
> From: "T.V Raman" <raman@google.com>
> 
> I installed from elpa/melpa:
> 
> ls -1 -d tree-sitter-*
> tree-sitter-20220212.1632/
> tree-sitter-langs-20221122.645/
> 21:18:06 elpa $ 
> 
> but emacs compiled from latest Git Head still produces the completely
> unhelpful message 
> tree-support for language <x> is unavailable if I invoke c-ts-mode or
> c++-ts-mode

The tree-sitter-20220212 package is an external Emacs module, so it is
incompatible with the tree-sitter enabled modes you see on the master
branch.  Instead, you should simply install the tree-sitter library using
whatever distro you use to update your system.  Or build the tree-sitter
library yourself, from its Git repository, and then install it.

And the tree-sitter-langs-20221122 package requires you to run procedures to
download, compile, and install the language support libraries.  Did you run
those procedures?  If not, you won't have the language support libraries
where Emacs looks for them.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: tree-sitter and language support
  2022-11-25  6:51 ` Yuan Fu
  2022-11-25 10:41   ` Roman Rudakov
@ 2022-11-25 17:57   ` T.V Raman
  2022-11-25 19:48     ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: T.V Raman @ 2022-11-25 17:57 UTC (permalink / raw)
  To: Yuan Fu; +Cc: emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 446 bytes --]

Understood, apologies for having been over-enthusiastic.

Incidentally, if one installs tree-sitter-lang from melpa, it
automatically builds the modules; but it then requires tree-sitter from
Feb 2022 which is older than what is in the emacs tree.

We could ease a lot of pain if we brought the language modules into the
emacs tree?

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
7©4 Id: kg:/m/0285kf1  •0Ü8



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: tree-sitter and language support
  2022-11-25 17:57   ` T.V Raman
@ 2022-11-25 19:48     ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2022-11-25 19:48 UTC (permalink / raw)
  To: T.V Raman; +Cc: casouri, emacs-devel

> From: "T.V Raman" <raman@google.com>
> Cc: emacs-devel@gnu.org
> Date: Fri, 25 Nov 2022 09:57:05 -0800
> 
> Incidentally, if one installs tree-sitter-lang from melpa, it
> automatically builds the modules; but it then requires tree-sitter from
> Feb 2022 which is older than what is in the emacs tree.

We need a version that supports custom memory-allocation function, because
Emacs needs to control how memory is allocated, and what happens when
tree-sitter runs out of memory.

> We could ease a lot of pain if we brought the language modules into the
> emacs tree?

That's impractical, and probably won't happen, at least in the near future.
Those modules are developed by their own teams, unrelated to Emacs.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-11-25 19:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25  5:20 tree-sitter and language support T.V Raman
2022-11-25  6:51 ` Yuan Fu
2022-11-25 10:41   ` Roman Rudakov
2022-11-25 12:05     ` Eli Zaretskii
2022-11-25 17:57   ` T.V Raman
2022-11-25 19:48     ` Eli Zaretskii
2022-11-25 12:28 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).