From 34f583d3960ee48f0df1fd1772894e26fd6bd8eb Mon Sep 17 00:00:00 2001 From: Patrick Norton Date: Fri, 15 Sep 2023 19:32:19 -0700 Subject: [PATCH] fix(ocaml): Prevent clobbering +format-with globally Previously, loading the `ocaml` module and opening a file in Tuareg mode would result in every buffer having its formatter set to `ocp-indent`. This now restricts the formatter override to the current buffer. --- modules/lang/ocaml/config.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/lang/ocaml/config.el b/modules/lang/ocaml/config.el index cb5cce429..4ab8956ca 100644 --- a/modules/lang/ocaml/config.el +++ b/modules/lang/ocaml/config.el @@ -109,7 +109,7 @@ :config ;; TODO Fix region-based formatting support (defun +ocaml-init-ocamlformat-h () - (setq +format-with 'ocp-indent) + (setq-local +format-with 'ocp-indent) (when (and (executable-find "ocamlformat") (locate-dominating-file default-directory ".ocamlformat")) (when buffer-file-name @@ -118,7 +118,7 @@ (setq-local ocamlformat-file-kind 'implementation)) ((equal ext ".eliomi") (setq-local ocamlformat-file-kind 'interface))))) - (setq +format-with 'ocamlformat)))) + (setq-local +format-with 'ocamlformat)))) ;; Tree sitter (eval-when! (modulep! +tree-sitter)