   :straight t
   :defer t
   :init
-  (defun sm/elixir-format-on-save ()
-    (when (eq major-mode 'elixir-mode)
-      (elixir-format)))
+  (defun sm/set-elixir-format-hook ()
+    (add-hook 'before-save-hook #'elixir-format nil t))
 
   (defvar sm/iex-name "iex"
     "Command for iex.")

    (flycheck-remove-next-checker 'lsp 'golangci-lint))

  :hook ((go-mode . lsp)
         (before-save . seanmacs/gofmt-before-save))
  :bind(:map go-mode-map
             ("C-c C-d" . lsp-describe-thing-at-point)
             ("C-c r r" . lsp-rename)))

  (sm/set-goto-def-keybind 'elixir-mode-map #'lsp-find-definition)

  :hook ((elixir-mode . lsp)
         (elixir-mode . sm/set-elixir-format-hook))
  :bind(:map elixir-mode-map
             ("C-c C-d" . lsp-describe-thing-at-point)
             ("C-c r r" . lsp-rename)
