Disabling Rust auto-formatting in Emacs per-project
Sometimes aggressive auto-formatting (via apheleia or rustic) happens to be
unwelcome for certain projects which prefer a more artisinal approach to
semantics 1. Disabling this generally requires setting
directory-local variables.
I found it necessary to inhibit apheleia and disable LSP formatting to prevent
the editor from mangling the code on save.
1;; .dir-locals.el
2((rustic-mode . ((rustic-format-on-save . nil)
3 (eval . (setq-local +format-with-lsp nil)))))
4((nil . ((eval . (progn
5 (setq-local apheleia-inhibit t)
6 (setq-local rustic-format-on-save nil)
7 (setq-local +format-with-lsp nil))))))
Probably ought to be a nicer way, perhaps something in the doom local
configuration.
like metatensor ↩︎
Comments
