Subject: bug#70193: Acknowledgement (eglot: RFE: recenter buffer upon showDocument request)

From: martin rudalics <[email-masked]>
Date: Fri, 5 Apr 2024 11:07:58 +0200

> +cc Martin Rudalics (as suggested by Joao Tavora)

I refer to the following text from

https://github.com/joaotavora/eglot/discussions/1382

 > A variant of recenter that centers the whole selection if
 > (and only if) it fits might be a useful addition, perhaps to the the
 > core elisp library. In our case, which I suspect is fairly typical, the
 > selection is a single identifier such as a function or type declaration,
 > so the behavior of recenter is ideal, as it allows you to see the doc
 > comments above the declaration and (at least the start of) the function
 > body below it.

The attached 'window-recenter-region-start-position' should address
that.  I am not aware of whether we have a function on master to get the
line height of a specific window as if a specific buffer were displayed
in it so I used 'frame-char-height' for the window in question.  The
rest of the function is straightforward but there might be off-by-one
glitches.

Roughly tested with the also contained 'recenter-region'.

martin