Anyone interested in helping with Emacs erlang-ts mode?

I have started a new emacs mode for erlang using treesitter.

Since the documentation was included in erlang source the “old” emacs mode doesn’t work well enough, and it is time to start from fresh.

Currently the ‘erlang-ts’ mode handle syntax-highlighting only and relies on the old mode for
everything else.

I could use some help maintaining and updating this, my emacs (lisp and packaging) skills are lacking.

emacs erlang-ts-mode

5 Likes

Is there a list of tasks that need help? I have some experience with elisp, but I haven’t studied code of erlang-mode in detail.

We want to supply it melpa, I guess?

Emacs treesitter is able handle several modes so
do we want automagicly switch to markdown (treesitter) mode in documentation parts?
Then it needs to be implemented.

Convert the old erlang-mode functionality to be in the new erlang-ts-mode so we can phase out
the old mode completely.

I’ve done some reading about the whole tree-sitter thing, and it left me more confused than excited so far.

  • Tree-sitter grammars are implemented as 3rd party native libraries created from obfuscated autogenerated c code: https://github.com/WhatsApp/tree-sitter-erlang/blob/main/src/parser.c (55kLOC) I’m pretty sure nobody reviews this generated code. Call me paranoid, but it is a perfect spot for a supply-chain attack.
  • Nothing really works without these *.so files (Emacs “NIFs”, if you will). They should be provided by the distro (mine doesn’t happen to have a package for erlang at the moment) or downloaded from melpa. tree-sitter-langs package on melpa has the binaries, but they are incompatible with my distro. D’oh.
  • Ok, no problem, if there’s no package, I can contribute it myself. But if I want to to be a diligent maintainer of tree-sitter-erlang package for my distro, and I decide to verify the generated parser.c, I need a tool written in Rust, which itself requires a massive toolchain. Complexity just snowballs.

Compared to the dependency-free pure elisp solution that “just works”, I’m not sure if the cost/benefit adds up. Maybe I misunderstood everything, though. I may take another stab at this later, but first look at the tree-sitter infra gives off slight “X rewritten in Rust!” vibe. Sorry for the downer.

It requires emacs 29, emacs builds the libs for you, you just point out the github repo. See the emacs-erlang-ts Readme

Den lör 11 jan. 2025 15:02Ie Qu1 via Erlang Forums <noreply@erlangforums.com> skrev: