emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 e83c78b8c77: Eglot: respect user's Eldoc configuration by defau


From: João Távora
Subject: emacs-29 e83c78b8c77: Eglot: respect user's Eldoc configuration by default
Date: Mon, 20 Feb 2023 18:08:23 -0500 (EST)

branch: emacs-29
commit e83c78b8c7784254c2c6f043530ab325c2fa7f16
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Eglot: respect user's Eldoc configuration by default
    
    This change addresses the problems reported in many Elglot reports
    dating back to early 2021 at least:
    
      https://github.com/joaotavora/eglot/issues/648
      https://github.com/joaotavora/eglot/issues/894
      https://github.com/joaotavora/eglot/issues/920
      https://github.com/joaotavora/eglot/issues/1031
      https://github.com/joaotavora/eglot/issues/1171
    
    In one form or another, the reports point out that the multiple pieces
    of information about the "thing at point" made available by the LSP
    server are not all being considered by the ElDoc system.
    
    The reason for this is Eglot setting/trampling the variables
    'eldoc-documentation-strategy' and 'eldoc-documentation-functions' in
    its minor more entry function.
    
    The reason it did that is historical and is partially described in the
    issues above.  But, evidently, it never made much sense, because so
    many people want to override it, which requires setting
    'eldoc-documentation-strategy' to the non-default value
    'eldoc-documentation-compose'.
    
    The problem was made worse by the fact that setting it as usual in
    either the Customize menu or their init file didn't work, requiring a
    fairly complex Elisp snippet.  That is now solved as of this commit.
    
    If the user does not do any setting, then Eglot works basically the
    same as before (i.e. shows only one piece of information).
    
    It is arguable that the default value for
    'eldoc-documentation-strategy' should change globally to
    'eldoc-documentation-compose', but that has other subtle implications
    and is not part of this commit.
    
    * lisp/progmodes/eglot.el (eglot--managed-mode): Don't set Eldoc
    variables greedily.
---
 lisp/progmodes/eglot.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index d941aec4688..abc090aea51 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1760,11 +1760,6 @@ Use `eglot-managed-p' to determine if current buffer is 
managed.")
     (add-hook 'change-major-mode-hook #'eglot--managed-mode-off nil t)
     (add-hook 'post-self-insert-hook 'eglot--post-self-insert-hook nil t)
     (add-hook 'pre-command-hook 'eglot--pre-command-hook nil t)
-    (eglot--setq-saving eldoc-documentation-functions
-                        '(eglot-signature-eldoc-function
-                          eglot-hover-eldoc-function))
-    (eglot--setq-saving eldoc-documentation-strategy
-                        #'eldoc-documentation-enthusiast)
     (eglot--setq-saving xref-prompt-for-identifier nil)
     (eglot--setq-saving flymake-diagnostic-functions '(eglot-flymake-backend))
     (eglot--setq-saving company-backends '(company-capf))
@@ -1773,7 +1768,12 @@ Use `eglot-managed-p' to determine if current buffer is 
managed.")
       (add-function :before-until (local 'imenu-create-index-function)
                     #'eglot-imenu))
     (unless (eglot--stay-out-of-p 'flymake) (flymake-mode 1))
-    (unless (eglot--stay-out-of-p 'eldoc) (eldoc-mode 1))
+    (unless (eglot--stay-out-of-p 'eldoc)
+      (add-hook 'eldoc-documentation-functions #'eglot-hover-eldoc-function
+                nil t)
+      (add-hook 'eldoc-documentation-functions #'eglot-signature-eldoc-function
+                nil t)
+      (eldoc-mode 1))
     (cl-pushnew (current-buffer) (eglot--managed-buffers 
(eglot-current-server))))
    (t
     (remove-hook 'after-change-functions 'eglot--after-change t)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]