From f2250ba24400c71040fbfb6e9c2f90b1f87dbb59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Wed, 21 Jan 2026 23:01:00 +0000 Subject: [PATCH] Eglot: simplify Imenu setup again See https://github.com/joaotavora/eglot/issues/1569. * lisp/progmodes/eglot.el (eglot--managed-mode): Tweak. * etc/EGLOT-NEWS: Tweak. --- etc/EGLOT-NEWS | 6 +++--- lisp/progmodes/eglot.el | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/etc/EGLOT-NEWS b/etc/EGLOT-NEWS index 89870c64641..20c2208c54c 100644 --- a/etc/EGLOT-NEWS +++ b/etc/EGLOT-NEWS @@ -45,10 +45,10 @@ thinks responses to inflight requests are no longer useful. The current 2026 LSP landscape (especially gopls and ocamllsp) suggests this is beneficial and helps servers avoid costly useless work. -** Imenu setup no longer uses advice (github#1569) +** Imenu setup is more predictable (github#1569) -Eglot now sets 'imenu-create-index-function' directly without using -advice, making the integration cleaner and more predictable. +Eglot now sets 'imenu-create-index-function' using ':override' advice, +making the integration cleaner and more predictable. ** Fixed textDocument/prepareRename support (github#1554) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index b6bdcd79aee..80099a26ee8 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2375,7 +2375,8 @@ the previous reports for TOKEN.") #'eldoc-documentation-compose) (unless (or (eglot--stay-out-of-p 'imenu) (not (eglot-server-capable :documentSymbolProvider))) - (eglot--setq-saving imenu-create-index-function #'eglot-imenu)) + (add-function :override (local 'imenu-create-index-function) + #'eglot-imenu)) (unless (eglot--stay-out-of-p 'flymake) (flymake-mode 1)) (unless (eglot--stay-out-of-p 'eldoc) (dolist (f (list #'eglot-signature-eldoc-function