From 53254d6bee3ecb9c9e05e227e0ab79cb3c2966de Mon Sep 17 00:00:00 2001 From: Thibaut Benjamin Date: Thu, 28 Nov 2024 10:08:42 +0000 Subject: [PATCH] Add compatibility with emacs ocaml tree-sitter modes (#2600) --- CHANGES.md | 4 +++- emacs/ocamlformat.el | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 12dd5eedb3..bebf3aa19d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -43,7 +43,9 @@ profile. This started with version 0.26.0. ### Added -- Allow a custom command to be used to run ocamlformat in the emacs plugin (#2577, @gridbugs) +- Improve the emacs plugin (#2577, #2600, @gridbugs, @thibautbenjamin) + Allow a custom command to be used to run ocamlformat and add compatibility + with emacs ocaml tree-sitter modes. - Added option `let-binding-deindent-fun` (#2521, @henrytill) to control the indentation of the `fun` in: diff --git a/emacs/ocamlformat.el b/emacs/ocamlformat.el index 9d0d7adb17..47c0c0a9c3 100644 --- a/emacs/ocamlformat.el +++ b/emacs/ocamlformat.el @@ -100,7 +100,9 @@ nil (default)." \(add-hook \\='before-save-hook \\='ocamlformat-before-save)." (interactive) - (when (memq major-mode '(tuareg-mode caml-mode)) (ocamlformat))) + (when + (memq major-mode '(tuareg-mode caml-mode ocaml-ts-mode ocamli-ts-mode)) + (ocamlformat))) (defun ocamlformat--goto-line (line) "Move point to the line numbered LINE."