]> git.eshelyaron.com Git - emacs.git/commit
Don't needlessly request docs from ElDoc functions
authorJoão Távora <joaotavora@gmail.com>
Sat, 18 Jul 2020 23:48:43 +0000 (00:48 +0100)
committerJoão Távora <joaotavora@gmail.com>
Thu, 23 Jul 2020 10:57:27 +0000 (11:57 +0100)
commitfcd43287b3d36a5706760d68b7d88502ebe43a47
treec7ec4a1dd15ba9dabbdcfb2135cf687efbe6f3ef
parent1bae7ba53b8239201853ce755e9e21a96ad279c0
Don't needlessly request docs from ElDoc functions

Fixes: bug#42421
Do this conservatively for now: if the ElDoc helper buffer (as
returned by eldoc--doc-buffer) is visible and showing documentation
for the very same "situation" (as computed by the the new
eldoc--request-state helper), don't request that documentation from
sources again.

Before this change, not only was that request inefficient but if the
user invoked scroll-other-window to see more of the helper buffer,
that would eventually cause it to be reformatted and unexpectedly
recentered.

Later on, when a customizable list of documentation "sinks" is offered
to the user, say, something like eldoc-display-functions, this process
must be consolidated.  In those circumstances, as soon as one of those
sinks signals that it doesn't have up-to-date documentation for the
state computed by eldoc--request-state, documentation will have to be
requested anew from eldoc-documentation-functions via
eldoc--invoke-strategy.

* lisp/emacs-lisp/eldoc.el (eldoc--request-docs-p): Rework from
eglot-display-message-p.
(eldoc--last-request-state): New variable.
(eldoc--request-state): New helper.
(eldoc--handle-docs): Memorize state of request in doc buffer.
(eldoc-print-current-symbol-info): Pass a token to
eldoc--request-docs-p.
(Version): Bump to 1.6.0
lisp/emacs-lisp/eldoc.el