Subject: Re: bug#21869: Redisplay: after echo area diminishes in size, Follow Mode windows aren't resynchronised.

From: Alan Mackenzie <[email-masked]>
Date: Mon, 9 Nov 2015 18:18:33 +0000 (UTC)

Alan Mackenzie <[email-masked]> wrote:
> With a recent copy of the git master, in either X windows or a Linux tty,

> emacs -Q

> If necessary, make the window wide with the mouse.

> C-x C-f src/xdisp.c       ; or any other non-small file.
> C-x 3
> M-x follow-mode

> Note the content of the lines around the window division.

> M-: (message "x\ny\nz") <CR>

> The echo area expands, and the two Follow Mode windows get correctly
> synchronised.  Again, note the content of the lines around the window
> division.

> C-f

> The echo area shrinks back to its normal size.  Note the content of the
> lines around the window division.  The two lines at the bottom of the
> left hand window are also displayed at the top of the right hand window.
> The windows have NOT been synchronised after the change in the echo area
> size.  This is a bug.

> #########################################################################

> Tentative analysis:

> Follow Mode puts a function on window-size-change-functions which should be
> called any time a window changes size.  At the C-f above,
> window-size-change-functions is not being invoked.

> The one single place where window-size-change-functions is invoked is in
> the function prepare_menu_bars in xdisp.c.

> The one single place where prepare_menu_bars is called is fairly early on
> in redisplay_internal, at L+137.  This is before the echo area is resized
> at L+164.  Thus, the check on changed window sizes happens too early,
> before the change in the echo area size.

I withdraw my complaint: the doc of w-s-c-functions says it is called
BEFORE REDISPLAY when a window size has changed.  It says nothing about
being called when the window sizes change DURING redisplay.

However, that leaves a gap: how is application software to be informed
that this change in window sizes has happened?  Perhaps changing the
hook's definition, such that it would be invoked both before redisplay
and during it would be a neat solution.  It seems that the chances of the
hook being invoked twice on a redisplay cycle would not be high.

-- 
Alan Mackenzie (Nuremberg, Germany).