Skip to content

Commit

Permalink
refactor: move +eglot-auto-enable and +lsp-auto-enable
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Jun 11, 2023
1 parent 7576d14 commit 1017235
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions modules/me-lsp.el
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
:straight t
:preface
(setq lsp-use-plists t)
:commands +lsp-auto-enable
:custom
(lsp-session-file (concat minemacs-local-dir "lsp/session.el"))
(lsp-server-install-dir (concat minemacs-local-dir "lsp/servers/"))
Expand Down Expand Up @@ -49,15 +48,14 @@
"Modes for which LSP-mode can be automatically enabled by `+lsp-auto-enable'."
:group 'minemacs-prog
:type '(repeat symbol))
:config
(defun +lsp-auto-enable ()
"Auto-enable LSP-mode in configured modes in `+lsp-auto-enable-modes'."
(interactive)
(dolist (mode +lsp-auto-enable-modes)
(let ((hook (intern (format "%s-hook" mode))))
(add-hook hook #'lsp-deferred)
(remove-hook hook #'eglot-ensure))))

:config
(+map! :keymaps 'lsp-mode-map
:infix "c"
"fF" #'lsp-format-buffer
Expand Down
4 changes: 1 addition & 3 deletions modules/me-prog.el
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

(use-package eglot
:straight `(:type ,(if (< emacs-major-version 29) 'git 'built-in))
:commands +eglot-auto-enable
:hook (eglot-managed-mode . eglot-inlay-hints-mode)
:custom
(eglot-autoshutdown t) ; shutdown after closing the last managed buffer
Expand All @@ -66,15 +65,14 @@
"Modes for which Eglot can be automatically enabled by `+eglot-auto-enable'."
:group 'minemacs-prog
:type '(repeat symbol))
:config
(defun +eglot-auto-enable ()
"Auto-enable Eglot in configured modes in `+eglot-auto-enable-modes'."
(interactive)
(dolist (mode +eglot-auto-enable-modes)
(let ((hook (intern (format "%s-hook" mode))))
(add-hook hook #'eglot-ensure)
(remove-hook hook #'lsp-deferred))))

:config
(+map! :keymaps 'eglot-mode-map
:infix "c"
"fF" #'eglot-format-buffer
Expand Down

0 comments on commit 1017235

Please sign in to comment.