4 ms·
That's not the impression I got from TFA. It sounds like, once you have Emacs compiled with tree-sitter, you also need to have a language binding in a shared li
by audiodude 3y ago
That's not the impression I got from TFA. It sounds like, once you have Emacs compiled with tree-sitter, you also need to have a language binding in a shared library in a known location (that you have to compile yourself or depend on the kindness of strangers). And once you have that, you actually need someone to write a major mode that utilizes it at all. And if you want to make that major mode the default for that file type, there are a few other things you need to do. Etc.
- slondr 3y agoI use emacs 29 beta right now and that is just not how it works. For example for elixir you just install elixir-ts-mode like any other package, answer yes to the prompt to install the elixir ts library, and you’re done. Even that setup step will be unnecessary in emacs 30, when all this stuff will be shipped by default.
- audiodude 3y agoOkay, that's a good thing! From the article: > Neither tree-sitter nor Emacs come installed with language grammars > ...it’ll only work if you don’t have an exceptional setup (so it won’t work well unless you have GCC and run some flavor of Linux.) > Determining if a grammar is available is not intuitive nor obvious unless you use elisp > Note that, just because you have installed a grammar, does not mean Emacs supports it. Someone still has to write the – admittedly, way easier – syntax and indentation logic and all that good stuff. > Annoyingly, there’s no easy way to see if you’re using the normal or the TS-powered major mode > If you use Customize, then you don’t have to do anything, but if you normally use setq, you’ll have to use customize-set-variable instead to ensure the setter is called properly. > That sounds like a great idea until you realize that it is not possible to make one-size-fits all commands that do this. Believe me: I’ve tried.
- natrys 3y ago> once you have Emacs compiled with tree-sitter Once Emacs 29 releases, your distro will package Emacs compiled with tree-sitter. > you also need to have a language binding in a shared library in a known location Emacs already ships with command that clones grammar repo, compiles, and installs the shared library to that known location - this was explained in the article. The only manual thing you need to do is to associate a language with a git repo in your configuration. > And once you have that, you actually need someone to write a major mode that utilizes it at all. Emacs developers have been also been working on covering major languages to provide tree-sitter based major modes. I count 23 major modes already being maintained as part of Emacs that will be shipped soon as part of 29.1, not to mention there are a lot more in Melpa (centralised community package repository). In any case, whole thing with the tree-sitter is that it really makes writing major modes easy. It's all declarative now, including indentation rules that had traditionally been tricky to get right.