Just wanted to let you know I’ve spent a bit of time polishing neocaml and I think now it’s ready to be used (or at least tested) by more people. The font-locking and indentation are more or less done, and there’s also a basic integration with OCaml toplevels. Coupled with something like ocaml-eglot the existing functionality should get you pretty far.
You’ll still have to install it from the GitHub repo (you’ll find detailed instructions there), but I’ve also opened a MELPA recipe PR, so I hope the installation process will become simpler soon.
Feel free to share feedback and feature requests here and over at GitHub!
P.S. I know the name is a bit controversial (some people said it evokes nvim vibes), and the down the road I may just rename it to ocaml-mode or try to merge it with Tuareg. Naming remains hard…
I’m an old merlin user and I haven’t seriously considered switching to ocaml-eglot yet. Do you know if your mode works well with merlin on top? (I use (add-hook 'tuareg-mode-hook 'merlin-mode t) in my configuration file, is there a similar hook in neocaml?)
Skimming the source I have some naive questions (I’ve never looked at how tree-sitter-derived language modes are implemented before):
why do you need a list of keywords, isn’t this already provided by the tree-sitter grammar?
I wonder why the :feature 'type definition needs to list basically all type-forming grammar rules, this seems redundant with the grammar
I’m also clinging on old but trusty technology (merlin + caml-mode) but what would make me seriously consider shaking up that setup is support for syntax highlighting in .mld files. When I edit long documents and cookbooks I tend to get lost and a bit of color sign posting would help.
Adding support for .mld files should be pretty simple, provided there’s already an existing TreeSitter grammar for those. I guess I’ll have to check for this.
I’m hoping that neocaml will become the go-to replacement for caml-mode one day, but that will take a bit of extra work and a lot more users (so there’s more guidance for the development).
That’s a limitation of the Emacs TreeSitter API - it doesn’t support the .scm query files directly, so some things have to be repeated in Elisp queries. Probably this will change down the road, but for now we have to do some extra work. For the same reason the indent queries are in Elisp as well, even if the grammar provides some already.
I wonder why the :feature 'type definition needs to list basically all type-forming grammar rules, this seems redundant with the grammar
Pretty much the same as above. Also keep in mind that as grammar definitions vary wildly it’s not very easy to map them to the constructs in Emacs automatically. Although I think there’s some work done in Emacs 31, at least for some form of font-locking auto-derived from the scm files.
I’m an old merlin user and I haven’t seriously considered switching to ocaml-eglot yet. Do you know if your mode works well with merlin on top? (I use (add-hook 'tuareg-mode-hook 'merlin-mode t) in my configuration file, is there a similar hook in neocaml?)