GitHub - bbatsov/neocaml: A modern, TreeSitter-powered, Emacs major mode for OCaml

Hacker News
February 27, 2026
AI-Generated Deep Dive Summary
GitHub has introduced a new Emacs package called neocaml, designed as a modern major mode for OCaml programming that leverages TreeSitter technology. This innovative tool offers enhanced syntax highlighting, indentation, and navigation features, addressing the limitations of older modes like tuareg-mode and caml-mode, which are considered complex or outdated. Neocaml aims to provide a sleeker, more efficient alternative for developers working with OCaml in Emacs. The package includes several key features such as TreeSitter-powered font-locking with four levels of syntax highlighting for .ml and .mli files, support for cycle-indentation, and robust navigation tools like forward-sexp and M-a/M-e for sentence movement. It also integrates with the OCaml toplevel (REPL), enabling seamless interaction between code and the runtime environment. Additionally, neocaml supports imenu with language-specific categories, making it easier to jump between functions and definitions in large projects. One of the standout features of neocaml is its integration with Eglot, a Language Server Protocol (LSP) client for Emacs. This allows neocaml to work seamlessly with ocamllsp, providing advanced functionality like type enclosing and case analysis. The package also includes electric indentation on delimiter characters, comment continuation, and fill-paragraph support for better code readability. Neocaml is available on MELPA and can be installed directly from GitHub, making it accessible to a wide range of users. The development of neocaml was driven by the need for a more lightweight and user-friendly major mode that still leverages the power of TreeSitter for accurate syntax parsing. Unlike previous attempts at creating TreeSitter-powered modes for OCaml, which struggled due to developers' limited familiarity with Emacs Lisp, neocaml benefits from its creator's deep understanding
Verticals
techstartups
Originally published on Hacker News on 2/27/2026