But, it takes a lot of work to get there. I still don’t have everything working super well, debugging is way easier for me in VS Code. But, I’m still learning (after 25+ years as an Emacs user), and that brings me joy.
It’s like when I’m working on electronics. There’s a genuine joy I get from using my Hakko soldering station, Mitutoyo calipers, or my Engineer hand tools. Using something that is supremely well designed for a purpose brings me joy.
And org-mode. Seriously, org-mode.
Even that setup step will be unnecessary in emacs 30, when all this stuff will be shipped by default.
> 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.
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.