summary refs log tree commit diff
path: root/emacs/custom/my-lang-nix.el
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-10-17 18:29:37 -0700
committerFranck Cuny <franck@fcuny.net>2022-10-17 18:29:37 -0700
commit7084581ae2df832689f362ccdf5305b34c8bf0cf (patch)
treef17130e46cdc82e605534d750fc003091931a9ea /emacs/custom/my-lang-nix.el
parentref(prog): wrap comments at column 120 (diff)
downloademacs.d-7084581ae2df832689f362ccdf5305b34c8bf0cf.tar.gz
ref(lsp): switch from lsp-mode to eglot
The experimentation was a disaster: lsp-mode was buggy, slow, littering
the interface with a lot of things I did not understood or needed.

eglot is definitely simpler and works better for me.

Change-Id: Ie7e7e6f1c8e7b26aa5cb79d636f3ad53c1493617
Diffstat (limited to '')
-rw-r--r--emacs/custom/my-lang-nix.el18
1 files changed, 4 insertions, 14 deletions
diff --git a/emacs/custom/my-lang-nix.el b/emacs/custom/my-lang-nix.el
index 7d197e2..6e17ee3 100644
--- a/emacs/custom/my-lang-nix.el
+++ b/emacs/custom/my-lang-nix.el
@@ -5,21 +5,11 @@
 
 ;;; Code:
 
-(require 'lsp-mode)
+(require 'eglot)
+(require 'nix-mode)
 
-(add-to-list 'lsp-language-id-configuration '(nix-mode . "nix"))
-(lsp-register-client
- (make-lsp-client :new-connection
-                  (lsp-stdio-connection '("rnix-lsp"))
-                  :major-modes '(nix-mode)
-                  :server-id 'nix))
-
-(defun my/lsp-nix-install-save-hooks ()
-  "Set up before-save hooks to format buffer."
-  (add-hook 'before-save-hook #'lsp-format-buffer t t))
-
-(add-hook 'nix-mode-hook #'my/lsp-nix-install-save-hooks)
-(add-hook 'nix-mode-hook #'lsp-deferred)
+(add-hook 'nix-mode-hook 'eglot-ensure)
+(add-hook 'nix-mode-hook #'(lambda() (add-hook 'before-save-hook 'eglot-format-buffer nil t)))
 
 (provide 'my-lang-nix)