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 #29 received at 70193 <at> debbugs.gnu.org (full text, mbox):

From: Alan Donovan <adonovan <at> google.com>
To: Felician Nemeth <felician.nemeth <at> gmail.com>
Cc: martin rudalics <rudalics <at> gmx.at>, Eli Zaretskii <eliz <at> gnu.org>,
 70193 <at> debbugs.gnu.org
Subject: Re: bug#70193: Acknowledgement (eglot: RFE: recenter buffer upon
 showDocument request)
Date: Sat, 13 Apr 2024 12:36:41 -0400
>  Alan, can you check whether your use-case is better served with `reposition-window' than with `recenter'?  However, the LSP specification does not guarantee that the target of showDocument is a source file, so Eglot needs window-recenter-region for completeness. Also I don't know if reposition-window supports every programming language or "go" in particular.

Thanks, I wasn't aware of `reposition-window', but it looks like
exactly what I want. I just tried it, and found that it positions the
point at the top of the frame, but is sufficiently aware of the syntax
of the language that if the point is in a declaration (as in my case)
then it uses the start of the preceding doc comment, if any.

It is clearly superior to recenter for my needs, and I would be quite
happy to use it instead.


On Sat, 13 Apr 2024 at 05:10, Felician Nemeth <felician.nemeth <at> gmail.com> wrote:
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> >> Cc: Alan Donovan <adonovan <at> google.com>, 70193 <at> debbugs.gnu.org
> >> Date: Sun, 7 Apr 2024 09:30:02 +0200
> >> From:  martin rudalics via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> >>
> >>  > But when I debug window-recenter-region-start-position, the height is
> >>  > set to 0.  The patch below seems to fix the problem.
> >> [...]
> >>  > +        (body-pixel-width (window-body-width window t))
> >>  > +        (body-pixel-height (window-body-height window t))
> >>
> >> You're right.  I meanwhile fixed the code to calculate how many lines to
> >> step backwards by using 'window-text-pixel-size' there too.  So now this
> >> should work with text scaling and varying line heights too.
> >>
> >> If you want to test it with 'recenter-region', then a rough estimate is
> >> that the number of lines shown after the first "L:" should be equal to
> >> or one less than the number of lines shown after the third "L:" in each
> >> message issued.
> >
> > I'm unsure how to proceed with this bug report.  Should it be closed,
> > or is there anything left to be done here, and if the latter, then
> > what has to be done to resolve the issues?
>
> Sorry, I meant to write back earlier.  I've done some limited test for
> varying line heights as well, the patch seems to work well.  The
> question, I think, is whether this is generally useful enough to have a
> polished window-recenter-region to be part of Emacs, or should it just
> be added to Eglot.
>
> In the original report, showDocument requested to show a source code
> file, where I think `reposition-window' would be more useful.  Alan, can
> you check whether your use-case is better served with
> `reposition-window' than with `recenter'?  However, the LSP
> specification does not guarantee that the target of showDocument is a
> source file, so Eglot needs window-recenter-region for completeness.
> Also I don't know if reposition-window supports every programing
> language or "go" in particular.




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

Previous Next


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