From 43b0368be40985156833d118fba8f57df4ea0d90 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Thu, 19 Mar 2026 12:56:49 +0200 Subject: [PATCH 1/2] Add neocaml-mode support to ocamlformat-before-save neocaml (https://github.com/bbatsov/neocaml) is a new tree-sitter based OCaml major mode for Emacs. Add `neocaml-mode` and `neocaml-interface-mode` to the mode whitelist in `ocamlformat-before-save` so format-on-save works in neocaml buffers. --- emacs/ocamlformat.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/ocamlformat.el b/emacs/ocamlformat.el index 47c0c0a9c3..7c652acdf8 100644 --- a/emacs/ocamlformat.el +++ b/emacs/ocamlformat.el @@ -101,7 +101,8 @@ nil (default)." \(add-hook \\='before-save-hook \\='ocamlformat-before-save)." (interactive) (when - (memq major-mode '(tuareg-mode caml-mode ocaml-ts-mode ocamli-ts-mode)) + (memq major-mode '(tuareg-mode caml-mode ocaml-ts-mode ocamli-ts-mode + neocaml-mode neocaml-interface-mode)) (ocamlformat))) (defun ocamlformat--goto-line (line) From 53e1c00e3f1235e010b563ff50269cd9ad6fe254 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Tue, 31 Mar 2026 17:17:57 +0300 Subject: [PATCH 2/2] Add changelog entry for neocaml-mode support --- CHANGES.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 0f2a70ab84..58e58e4d3a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -129,6 +129,11 @@ profile. This started with version 0.26.0. M.foo) ``` +### Emacs mode + +- Add `neocaml-mode` support to `ocamlformat-before-save` + (#2787, @bbatsov) + ## 0.28.1 ### Highlight