diff options
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/custom/my-prog.el | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/emacs/custom/my-prog.el b/emacs/custom/my-prog.el index a198ce2..dad14f2 100644 --- a/emacs/custom/my-prog.el +++ b/emacs/custom/my-prog.el @@ -101,23 +101,25 @@ (dolist (hook '(prog-mode-hook conf-mode-hook)) (add-hook hook 'turn-on-eldoc-mode)) -;; format nix buffers on save -(customize-set-variable 'nix-nixfmt-bin "nixpkgs-fmt") -(add-hook 'before-save-hook 'nix-format-before-save) - +(require 'eglot) ;; List of settings for gopls: ;; https://github.com/golang/tools/blob/master/gopls/doc/settings.md -;; https://github.com/golang/tools/blob/master/gopls/doc/settings.md#experimentalworkspacemodule-bool -(customize-set-variable 'eglot-workspace-configuration - '((:gopls . - ((staticcheck . t) - (experimentalWorkspaceModule . t) - (matcher . "CaseSensitive") - (usePlaceholders . t))))) +(setq eglot-workspace-configuration + '((:gopls . + ((staticcheck . t) + (experimentalWorkspaceModule . t) + (matcher . "CaseSensitive") + (usePlaceholders . t))))) + +(defun my/eglot-install-save-hook () + "Install the local hooks that are executed before saving a buffer." + ;; the last thing we do is to format the buffer + (add-hook 'before-save-hook #'eglot-format-buffer 100 t)) ;; ensure we load eglot for some specific modes (dolist (hook '(go-mode-hook nix-mode-hook)) - (add-hook hook 'eglot-ensure)) + (add-hook hook 'eglot-ensure) + (add-hook hook #'my/eglot-install-save-hook)) (provide 'my-prog) |