0

My Emacs (29.1) comes with the some tree-sitter modes:

c-ts-mode
go-ts-mode
js-ts-mode
...

I downloaded the compiled .dll and they work out of box.

However, there are some languages that tree-sitter seems to support, but I don't know how to enable them in Emacs. For example, it supports lua, but there is no lua-ts-mode in my Emacs, and not list-package doesn't show it either. So where could I get lua-ts-mode? Or the major modes of some languge simply don't exist even tree-sitter already support them?

2
  • 1
    emacs-tree-sitter is not the tree-sitter support that is build into Emacs 29. That github repository is an earlier approach to integrating the two things. They are quite different, and so I don't know whether that tree-sitter-langs section has any relevance.
    – phils
    Commented Sep 13, 2023 at 8:13
  • @phils an early approach that supports more languages... the ecosystem is a bit weird. But thank you for the answer Commented Sep 13, 2023 at 9:34

2 Answers 2

1

Someone has to write one.

language specific tree-sitter major mode wont show up” is a similar question, with an answer that goes into more detail about what needs to be written.

3
  • Thank you. I made the same (wrong) assumption that tree-sitter is a simple protocol that once you have the compiled library your edit can pick it up and work perfectly. Commented Sep 13, 2023 at 9:34
  • You’re welcome. Its an easy assumption to make, apparently.
    – db48x
    Commented Sep 13, 2023 at 9:45
  • masteringemacs.org/article/lets-write-a-treesitter-major-mode just crossed my desk; you may find it helpful.
    – db48x
    Commented Sep 14, 2023 at 10:26
0

A package lua-ts-mode was submitted for inclusion to ELPA in July 2023 and then added upstream, to Emacs 30 (currently under development).

I'm also linking the initial source.

See also How to Get Started with Tree-Sitter. It covers foundational points, so may provide a couple of conceptual insights.

2
  • Sorry for this super noob question, but how could I get it from ELPA (besides downloading the source file directly)? Even after package-refresh-content it still doesn't show up. Edit: Ah the README has installation instructions. But I'm still a bit confused why package-refresh-content doesn't work if it's already on ELPA. Commented Sep 13, 2023 at 10:14
  • The package was added upstream. I've updated the answer to reflect this.
    – Y. E.
    Commented Sep 16, 2023 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.