From: João Távora Date: Sun, 6 Jan 2019 12:55:21 +0000 (+0000) Subject: Fix test failure introduced by previous commit X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~343 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=84234b25ba59dd593e0f77bb4a54c03281519567;p=emacs.git Fix test failure introduced by previous commit 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. --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index fb002b85a8e..a7740e56904 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -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))