From 0482e48c7fec99cc0793915ecdf38679fa543731 Mon Sep 17 00:00:00 2001 From: Laurens Miers Date: Thu, 19 Sep 2024 22:44:41 +0200 Subject: [PATCH] Ensure eglot does not take full control of Xref Eglot by default will take full control of xref and make the xref-backend-functions (eglot-xref-backend t) . To have dumb-jump as backup if eglot would fail, instruct eglot to stay out of Xref and add/remove eglot xref backend manually. --- config_new.org | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/config_new.org b/config_new.org index a6901a2..91dda14 100644 --- a/config_new.org +++ b/config_new.org @@ -484,19 +484,17 @@ Install and wait for hydra to be available since we are using it in this init.el ** Eglot #+BEGIN_SRC emacs-lisp -(use-package eglot - :ensure t - :defer t - ;; This doesn't work for some reason, workaround below - ;;:hook (prog-mode . eglot-ensure) - ;; :config - ;; (add-hook 'prog-mode-hook 'eglot-ensure) -) -#+END_SRC + (use-package eglot + :ensure t + ) -Workaround to enable eglot in all programming modes: -#+BEGIN_SRC emacs-lisp -(add-hook 'prog-mode-hook 'eglot-ensure) + (setq eglot-stay-out-of '(xref)) + (add-hook 'prog-mode-hook 'eglot-ensure) + (add-hook 'eglot-managed-mode-hook (lambda () + (if (eglot-managed-p) + (add-hook 'xref-backend-functions 'eglot-xref-backend) + (remove-hook 'xref-backend-functions 'eglot-xref-backend) + ))) #+END_SRC ** Yasnippet