I've pushed the patch that fixes this. The commit message hints at the steps needed to prevent a resurgence of this bug when more developments in eldoc.el are performed: Author: João Távora Date: Sun Jul 19 00:48:43 2020 +0100 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 On Sun, Jul 19, 2020 at 1:03 AM João Távora wrote: > Hello, I'm following up on a bug started in > https://github.com/joaotavora/eglot/issues/445. > > In the latest ElDoc, when the *eldoc* buffer is showing a lenghty > docstrings for some situation in a source buffer, switching to that > buffer scrolling around, then switching back to the same position in the > source buffer will lead to that very documentation being re-requested, > ultimately undoing the scrolling work done previously by the user. > > The attached patch prevents needless, superfluous doc requests when the > requester's state is found to be identical to the state recorded in a > visible *eldoc* buffer. > > These kinds of situation must be taken into account when redesigning the > mechanism for allowing multiple outlets for documentation. > > For now, the patch should fix the situation. Felicián, please try it > out. Notice that it probably needs the Emacs master version of eldoc.el > (where, BTW, I have already fixed the other bug you report in the Github > issue). > > João > > -- João Távora