GNU bug report logs - #70193
eglot: RFE: recenter buffer upon showDocument request

Previous Next

Package: emacs;

Reported by: Alan Donovan <adonovan <at> google.com>

Date: Thu, 4 Apr 2024 13:18:02 UTC

Severity: normal

Full log


Message #14 received at 70193 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Alan Donovan <adonovan <at> google.com>, 70193 <at> debbugs.gnu.org
Subject: Re: bug#70193: Acknowledgement (eglot: RFE: recenter buffer upon
 showDocument request)
Date: Fri, 5 Apr 2024 11:07:58 +0200
[Message part 1 (text/plain, inline)]
> +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
[recenter-region.el (text/x-emacs-lisp, attachment)]

This bug report was last modified 1 year and 107 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.