Subject: bug#70386: 30.0.50; (recenter 0 t) does not put point on top of the window

From: Ihor Radchenko <[email-masked]>
Date: Sat, 11 May 2024 19:09:34 +0000

Eli Zaretskii <[email-masked]> writes:

>> In my specific reproducer the point is not moved, AFAIK.
>
> Of course it can move: as the window is scrolled by
> pixel-scroll-precision-interpolate, point can become invisible.  If
> redisplay kicks in, it will move point to bring it back into the
> viewport.

But it is not what happens in the recording!
The point remains at the same line.
Or do you mean that the point is somehow moved around during the progn execution?
But it does not look like it is the case - when I try

(setq point-list nil)
(setq current-line-list nil)
(progn
  (push (point) point-list)
  (push (count-lines 1 (point)) current-line-list)
  (require 'pixel-scroll)
  (push (point) point-list)
  (push (count-lines 1 (point)) current-line-list)
  (pixel-scroll-precision-interpolate
   (* -1 (line-pixel-height)
      (max 0 (- (count-screen-lines (window-start) (point)) 2)))
   nil 1)
  (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

I still do not see "recenter putting point on screen line 0" (quote from
`recenter' docstring) after finishing progn and all the elements of
`point-list' are the same positions.

> ...
> That the behavior changed recently doesn't yet mean the previous
> behavior was correct and the new one is wrong.  It might mean your
> code is based on incorrect assumptions, and just happened to work
> previously by sheer luck.

Maybe. But I do believe that my reproducer demonstrates a bug.
I do not want to argue about my original code and want to focus on the
reproducer herein instead. I only mentioned this detail for some context.

-- 
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>