all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to tell tree-sitter to look for libtree-sitter-go-mod.so instead of libtree-sitter-gomod.so?
@ 2023-09-26  7:58 Pankaj Jangid
  2023-09-26  8:30 ` Augustin Chéneau (BTuin)
  0 siblings, 1 reply; 3+ messages in thread
From: Pankaj Jangid @ 2023-09-26  7:58 UTC (permalink / raw)
  To: Emacs Development

I am on emacs-29 branch.

I have following settings for go in the ~/.emacs.d/init.el,

#+begin_src elisp
  (setq treesit-language-source-alist
	'((go . ("https://github.com/tree-sitter/tree-sitter-go.git"))
	  (go-mod . ("https://github.com/camdencheek/tree-sitter-gomod.git"))))
  (add-to-list 'auto-mode-alist
	       `("\\.go\\'" . go-ts-mode))
  (add-to-list 'auto-mode-alist
	       `("\\go.mod\\'" . go-mod-ts-mode))
#+end_src

whenever I load .go or go.mod files, I get this error,

--8<---------------cut here---------------start------------->8---
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for gomod is unavailable (not-found): (libtree-sitter-gomod libtree-sitter-gomod.0 libtree-sitter-gomod.0.0 libtree-sitter-gomod.so libtree-sitter-gomod.so.0 libtree-sitter-gomod.so.0.0) No such file or directory
--8<---------------cut here---------------end--------------->8---

Emacs is looking for libtree-sitter-gomod.so, but in fact the library's
name is libtree-sitter-go-mod.so. Where can I tell tree-sitter to look
for the appropriate file.

Or is this a bug?



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

* Re: How to tell tree-sitter to look for libtree-sitter-go-mod.so instead of libtree-sitter-gomod.so?
  2023-09-26  7:58 How to tell tree-sitter to look for libtree-sitter-go-mod.so instead of libtree-sitter-gomod.so? Pankaj Jangid
@ 2023-09-26  8:30 ` Augustin Chéneau (BTuin)
  2023-09-26  8:43   ` Pankaj Jangid
  0 siblings, 1 reply; 3+ messages in thread
From: Augustin Chéneau (BTuin) @ 2023-09-26  8:30 UTC (permalink / raw)
  To: pankaj; +Cc: Emacs Development

Le 26/09/2023 à 09:58, Pankaj Jangid a écrit :
> I am on emacs-29 branch.
> 
> I have following settings for go in the ~/.emacs.d/init.el,
> 
> #+begin_src elisp
>    (setq treesit-language-source-alist
> 	'((go . ("https://github.com/tree-sitter/tree-sitter-go.git"))
> 	  (go-mod . ("https://github.com/camdencheek/tree-sitter-gomod.git"))))
>    (add-to-list 'auto-mode-alist
> 	       `("\\.go\\'" . go-ts-mode))
>    (add-to-list 'auto-mode-alist
> 	       `("\\go.mod\\'" . go-mod-ts-mode))
> #+end_src
> 
> whenever I load .go or go.mod files, I get this error,
> 
> --8<---------------cut here---------------start------------->8---
> ⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for gomod is unavailable (not-found): (libtree-sitter-gomod libtree-sitter-gomod.0 libtree-sitter-gomod.0.0 libtree-sitter-gomod.so libtree-sitter-gomod.so.0 libtree-sitter-gomod.so.0.0) No such file or directory
> --8<---------------cut here---------------end--------------->8---
> 
> Emacs is looking for libtree-sitter-gomod.so, but in fact the library's
> name is libtree-sitter-go-mod.so. Where can I tell tree-sitter to look
> for the appropriate file.
> 
> Or is this a bug?
> 

You need to use the symbol 'gomod' and not 'go-mod' in
treesit-language-source-alist.

Here is your fixed init.el:

#+begin_src emacs-lisp
(setq treesit-language-source-alist
  	  '((go . ("https://github.com/tree-sitter/tree-sitter-go.git"))
  		(gomod . ("https://github.com/camdencheek/tree-sitter-gomod.git"))))
(add-to-list 'auto-mode-alist
  			 `("\\.go\\'" . go-ts-mode))
(add-to-list 'auto-mode-alist
  			 `("\\go.mod\\'" . go-mod-ts-mode))
#+end_src





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

* Re: How to tell tree-sitter to look for libtree-sitter-go-mod.so instead of libtree-sitter-gomod.so?
  2023-09-26  8:30 ` Augustin Chéneau (BTuin)
@ 2023-09-26  8:43   ` Pankaj Jangid
  0 siblings, 0 replies; 3+ messages in thread
From: Pankaj Jangid @ 2023-09-26  8:43 UTC (permalink / raw)
  To: Augustin Chéneau (BTuin); +Cc: Emacs Development

"Augustin Chéneau (BTuin)" <btuin@mailo.com> writes:

> You need to use the symbol 'gomod' and not 'go-mod' in
> treesit-language-source-alist.
>
Thanks. It worked.



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

end of thread, other threads:[~2023-09-26  8:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-26  7:58 How to tell tree-sitter to look for libtree-sitter-go-mod.so instead of libtree-sitter-gomod.so? Pankaj Jangid
2023-09-26  8:30 ` Augustin Chéneau (BTuin)
2023-09-26  8:43   ` 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.