bug#81593: [PATCH] Respect eglot-stay-out-of when disabling eglot--managed-mode
Aaron Zeng via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
Tags: patch Hello, A user at my site who configured eglot-stay-out-of to include eldoc, but then added eglot-signature-eldoc-function (and only that function) to eldoc-documentation-functions, noticed that signature help seems to mysteriously stop working occasionally. I found out that eldoc-documentation-functions was nil in these buffers, and that reverting the buffer fixed the issue. It seems that eglot--managed-mode's teardown can remove the eldoc-documentation-functions added in mode setup regardless of eglot-stay-out-of. This patch makes the teardown symmetric and respect eglot-stay-out-of, so that if somebody enables only some of the features Eglot offers, like in this case, Eglot will not touch the variables either way. (This is especially important because the mode can be disabled and then re-enabled implicitly by eglot-autoreconnect.) Thanks, Aaron Zeng In GNU Emacs 31.0.91 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.18.4, Xaw scroll bars) Repository revision: d4b0c58ece90c50b60345ad4a03d4ccc6f58c6d7 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Rocky Linux 8.10 (Green Obsidian) Configured using: 'configure --prefix=/nix/store/gsjs85fqs3iljhf6j33pwlyi1vn2qp59-emacs-30.2 --disable-build-details --with-modules --with-x-toolkit=lucid --with-cairo --without-xft --disable-gc-mark-trace --without-compress-install --with-toolkit-scroll-bars --with-native-compilation --without-imagemagick --with-mailutils --without-small-ja-dic --with-tree-sitter --with-xinput2 --without-xwidgets --with-dbus --without-selinux --without-gif --without-libotf --without-m17n-flt --without-xaw3d --without-webp'
0001-Respect-eglot-stay-out-of-when-disabling-eglot-manag.patch
(text/x-patch, 2.5 KB)
From bc5263f155c36e80a06570d7aed94d424afb97c1 Mon Sep 17 00:00:00 2001 From: "Aaron L. Zeng" <[email protected]> Date: Mon, 10 Aug 2026 17:43:21 -0400 Subject: [PATCH] Respect eglot-stay-out-of when disabling eglot--managed-mode * lisp/progmodes/eglot.el (eglot--managed-mode): Respect `eglot-stay-out-of' during teardown/reconnect. --- lisp/progmodes/eglot.el | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 1c9569434cf..ee36b66a8b6 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2477,21 +2477,24 @@ eglot--managed-mode #'eglot--after-set-visited-file-name-hook t) (remove-hook 'before-save-hook #'eglot--signal-textDocument/willSave t) (remove-hook 'after-save-hook #'eglot--signal-textDocument/didSave t) - (remove-hook 'xref-backend-functions #'eglot-xref-backend t) + (unless (eglot--stay-out-of-p 'xref) + (remove-hook 'xref-backend-functions #'eglot-xref-backend t)) (remove-hook 'completion-at-point-functions #'eglot-completion-at-point t) (remove-hook 'completion-in-region-mode-hook #'eglot--capf-session-flush t) (remove-hook 'company-after-completion-hook #'eglot--capf-session-flush t) (remove-hook 'change-major-mode-hook #'eglot--managed-mode-off t) (remove-hook 'post-self-insert-hook #'eglot--post-self-insert-hook t) (remove-hook 'pre-command-hook #'eglot--pre-command-hook t) - (dolist (f (list #'eglot-hover-eldoc-function - #'eglot-signature-eldoc-function - #'eglot-highlight-eldoc-function - #'eglot-code-action-suggestion)) - (remove-hook 'eldoc-documentation-functions f t)) + (unless (eglot--stay-out-of-p 'eldoc) + (dolist (f (list #'eglot-hover-eldoc-function + #'eglot-signature-eldoc-function + #'eglot-highlight-eldoc-function + #'eglot-code-action-suggestion)) + (remove-hook 'eldoc-documentation-functions f t))) (cl-loop for (var . saved-binding) in eglot--saved-bindings do (set (make-local-variable var) saved-binding)) - (remove-function (local 'imenu-create-index-function) #'eglot-imenu) + (unless (eglot--stay-out-of-p 'imenu) + (remove-function (local 'imenu-create-index-function) #'eglot-imenu)) (eglot--flymake-reset) (setq eglot--flymake-report-fn nil) (run-hooks 'eglot-managed-mode-hook) -- 2.43.7