Subject: Re: bug#32839: 27.0.50; recenter doesn't redisplay

From: Eli Zaretskii <[email-masked]>
Date: Wed, 26 Sep 2018 08:39:52 +0300

> From: Juri Linkov <[email-masked]>
> Cc: [email-masked]
> Date: Tue, 25 Sep 2018 23:55:15 +0300
> 
> >> 5. Typein *scratch* again: C-l C-l C-l
> >>    only when C-l puts point to the center of the window,
> >>    the *Messages* buffer gets redisplayed (but then for some reason
> >>    window-scroll-functions is not called in this case).
> >
> > That's a feature: you set recenter-redisplay to t, which causes a
> > complete redraw of the frame when you type C-l.
> 
> I thought that recenter-redisplay set to t, which causes a complete
> redraw of the frame, should also redraw the *Messages* buffer.

Only when you invoke 'recenter' with no arguments.

> > And window-scroll-functions aren't called when the window is
> > not scrolled.
> 
> I see that the window is scrolled while typing C-l C-l C-l ...
> (recenter-top-bottom).

My point was that C-l without arguments doesn't necessarily scroll.

When the window is scrolled, the hook is being called.  That's what I
see here.

> I tried in the middle of a large buffer
> like 'C-h C-t' (view-emacs-todo).
> 
> The first C-l puts the current line in the middle, refreshes
> the *Message* buffer, and displays the message in the echo area.
> 
> The second C-l puts the current line at the top, DOESN'T refresh
> the *Message* buffer, but displays the message in the echo area.
> 
> The third C-l puts the current line at the bottom, DOESN'T refresh
> the *Message* buffer, and DOESN'T display the message in the echo area,
> which means window-scroll-functions is not called at all in this case.
> 
> All three have a different effect.

Because each one calls 'recenter' with a different argument, or no
argument at all.  I see nothing unexpected in what you describe, FWIW.

You need to keep in mind that "scrolling" is well defined only for
scroll commands and functions (scroll-up, scroll-down, etc.).  For
other commands and functions that move the viewport in the buffer, it
is up to the display engine whether to apply a scroll-like redraw (in
which case window-scroll-functions will be called) or not.  I think
setting scroll-conservatively to a large value will make the display
engine scroll in many more situations, but even then C-l might not
always call window-scroll-functions.

Also, you are talking about 2 different functions -- 'recenter' and
'recenter-top-bottom' -- and that adds confusion to the discussion, so
maybe I misunderstood something you wanted to say.