Subject: Re: bug#18618: 25.0.50; `window-end win t` produces erroenous result with `window-scroll-functions` hook.

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 29 May 2021 05:37:18 +0200

Keith David Bershatsky <[email-masked]> writes:

> Steps to reproduce the issue.
>
> 1.  Create a function that reports (e.g., a message) the value of `(window-end win t)` and attach that function to the `window-scroll-functions` hook.
>
> 2.  Open a long file in either fundamental-mode or text-mode.
>
> 3.  M-x end-of-buffer
>
> 4.  M-x beginning-of-buffer
>
> The result of step 4 reports an erroneous window-end value that is at
> the very end of the buffer, instead of the correct window-end (i.e.,
> which is much closer to the beginning of the buffer).

(I'm going through old bug reports that unfortunately got no response at
the time.)

This problem is still present in Emacs 28.  Here's an easier test case:

(defun foo (win _)
  (message "End: %s" (window-end win t))
  nil)
(push 'foo window-scroll-functions)

This reports the same number in both 3) and 4) when transient-mark-mode
is switched on, but not when it's off.  It's also correct if that mode
is on, and the region is active.

I haven't tried to debug further -- perhaps it's immediately obvious to
somebody what could be causing this glitch?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no