GNU bug report logs - #70386
30.0.50; (recenter 0 t) does not put point on top of the window

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Sun, 14 Apr 2024 16:34:02 UTC

Severity: normal

Found in version 30.0.50

Done: Po Lu <luangruo <at> yahoo.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: luangruo <at> yahoo.com, 70386 <at> debbugs.gnu.org
Subject: bug#70386: 30.0.50; (recenter 0 t) does not put point on top of the window
Date: Sun, 12 May 2024 06:17:49 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>>   (push (point) point-list)
>>   (push (count-lines 1 (point)) current-line-list)
>>   ;; Call original recenter for final adjustment.
>>   (recenter 0 t)
>>   (push (point) point-list)
>>   (push (count-lines 1 (point)) current-line-list))
>> 
>> point-list ; -> 757 757 757 757
>> current-line-list ; -> 21 21 21 21
>
> Try harder, that's not all the truth.  In particular, what happens
> during the interpolation is not shown.

Why does it need to matter? Right before calling recenter, the point is
at 757, as you can see from point-list in my test.
Or do _previous_ point positions affect `recenter'?

> In addition, the way 'recenter' works, it is not guaranteed that point
> will end up on the line you ask it to place point.  It's a "best
> effort", no more.

May you please explain how I am supposed to know this from reading the
docstring?

    With a numeric prefix argument ARG, recenter putting point on screen line ARG
    relative to the selected window.  If ARG is negative, it counts up from the
    bottom of the window.  (ARG should be less than the height of the window.)

>> Maybe. But I do believe that my reproducer demonstrates a bug.
>
> Why do you still believe that?  What will it take to convince you that
> in the situation your recipe creates the result can sometimes be not
> what you want?

At least, a docstring that explains what `recenter' does better.
And even then, when scrolling current line to be on the top (which is
what (recenter 0 t) supposed to do), as a user, I will be surprised that
the current line remains at line 21! - what kind of "best effort" is
that when the result if off by 21 lines? surely, Emacs can do better.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




This bug report was last modified 362 days ago.

Previous Next


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