]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix test failure introduced by previous commit
authorJoão Távora <joaotavora@gmail.com>
Sun, 6 Jan 2019 12:55:21 +0000 (12:55 +0000)
committerJoão Távora <joaotavora@gmail.com>
Sun, 6 Jan 2019 12:55:21 +0000 (12:55 +0000)
Remove the hack of unsetting eldoc-last-message in
eglot--eldoc-message.  This allows any subsequent eglot-eldoc-function
calls (prompted by simple cursor movement) to return it immediately,
thus refreshing the help buffer with the same contents.  For this to
work, we also have to set eglot--eldoc-hint globally in
eglot-eldoc-function.

An alternative to making the test pass would be to keep the hack of
unsetting eldoc-last-message only in the case that we actually get to
display the help buffer.  This would actually be more efficient, but
potentially more hacky.

The bottom line here is that eldoc doesn't have a good API to deal
with asynchronous docstring fetching.  See this thread:

https://lists.gnu.org/archive/html/emacs-devel/2018-05/msg00151.html

* eglot.el (eglot--eldoc-message): Don't unset eldoc-last-message.
(eglot-eldoc-function): Set eglot--eldoc-hint for synchronous
operation too.

lisp/progmodes/eglot.el

index fb002b85a8e51ed83a56234d77c7ba13dc79ac7e..a7740e56904280634021ce15767fed5f7eb377c6 100644 (file)
@@ -2068,12 +2068,12 @@ Buffer is displayed with `display-buffer', which obeys
           (erase-buffer)
           (insert string)
           (goto-char (point-min))
-          (setq eldoc-last-message nil)
-          (if eglot-auto-display-eldoc-extra-buffer
-              (display-buffer (current-buffer))
-            (unless (get-buffer-window (current-buffer))
-              (eglot--message "Help for %s in in %s buffer" eglot--eldoc-hint
-                              (buffer-name eglot--help-buffer))))
+          (cond (eglot-auto-display-eldoc-extra-buffer
+                 (display-buffer (current-buffer)))
+                (t
+                 (unless (get-buffer-window (current-buffer))
+                   (eglot--message "Help for %s is in %s buffer" eglot--eldoc-hint
+                                   (buffer-name eglot--help-buffer)))))
           (help-mode)
           t)))))
 
@@ -2085,6 +2085,7 @@ If SKIP-SIGNATURE, don't try to send textDocument/signatureHelp."
          (position-params (eglot--TextDocumentPositionParams))
          sig-showing
          (thing-at-point (thing-at-point 'symbol)))
+    (setq eglot--eldoc-hint thing-at-point)
     (cl-macrolet ((when-buffer-window
                    (&body body) ; notice the exception when testing with `ert'
                    `(when (or (get-buffer-window buffer) (ert-running-test))