summary refs log tree commit diff
path: root/emacs
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-06-03 15:38:20 -0700
committerFranck Cuny <franck@fcuny.net>2022-06-03 15:38:20 -0700
commit69cc6c88cdbfd882b376878bd95de5a2f5bc6ddc (patch)
treea2568c68a55f4045095b71e23f995e1b3277c047 /emacs
parentfix(yasnippet): add my snippets to default path and enable yas mode (diff)
downloademacs.d-69cc6c88cdbfd882b376878bd95de5a2f5bc6ddc.tar.gz
feat(eglot): use LSP to format go buffers instead of gofmt
Change-Id: Iccef9b065eb4bee917b0084fb0b34e76f09223f2
Diffstat (limited to '')
-rw-r--r--emacs/custom/my-prog.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/emacs/custom/my-prog.el b/emacs/custom/my-prog.el
index 285befc..c63af84 100644
--- a/emacs/custom/my-prog.el
+++ b/emacs/custom/my-prog.el
@@ -67,7 +67,6 @@
 
 (defun my/go-mode-hook ()
   "Hooks for `go-mode'."
-  (add-hook 'before-save-hook 'gofmt-before-save)
   (setq tab-width 4)
 
   (set (make-local-variable 'compile-command)
@@ -112,6 +111,9 @@
 (dolist (hook '(go-mode-hook nix-mode-hook))
   (add-hook hook 'eglot-ensure))
 
+;; rely on eglot to do the formatting for go buffers
+(add-hook 'go-mode-hook #'(lambda() (add-hook 'before-save-hook 'eglot-format-buffer nil t)))
+
 (provide 'my-prog)
 
 ;;; my-prog.el ends here