emacs: disable other formatter modes when using eglot
Alan Pearce alan@alanpearce.eu
Sun, 16 Mar 2025 15:54:51 +0100
1 files changed, 6 insertions(+), 1 deletions(-)
jump to
M user/emacs/init.el → user/emacs/init.el
@@ -1226,7 +1226,12 @@ (define-minor-mode eglot-format-before-save-mode "Whether to ask the LSP to format the buffer before saving" :init-val nil (if eglot-format-before-save-mode - (add-hook 'before-save-hook #'eglot-format-buffer nil 'local) + (progn + (add-hook 'before-save-hook #'eglot-format-buffer nil 'local) + (when (bound-and-true-p apheleia-mode) + (apheleia-mode -1)) + (when (bound-and-true-p format-all-mode) + (format-all-mode -1))) (remove-hook 'before-save-hook #'eglot-format-buffer 'local))) (use-package eglot