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

From: Alan Mackenzie <[email-masked]>
Date: Mon, 16 Nov 2015 15:03:57 +0000

Hello, Eli.

On Mon, Nov 09, 2015 at 10:50:57PM +0200, Eli Zaretskii wrote:
> > Date: Mon, 9 Nov 2015 19:42:00 +0000
> > From: Alan Mackenzie <[email-masked]>
> > Cc: [email-masked], Pip Cet <[email-masked]>

> > > Probably bug#830 and bug#21333.

> > > Pip are you still alive?  Have your papers arrived?

Quick summary of the bug: with Follow Mode active, with a multi-line
display in the echo area, do C-f.  The echo area resizes to one line,
but the Follow Mode windows don't get resynchronised.

Quick summary of the cause: redisplay_internal calls prepare_menu_bars
(which invokes the window-size-change-functions hook) before it calls
echo_area_display (which resizes the echo area).  Thus changes to the
echo area size aren't yet in place when window-size-change-functions is
invoked.

> We had a patch in bug #21333 which was discussed and tested at
> length.  Please see if it works for your use case as well.  If not,
> please tell why not.

As I said last week, this patch didn't work, for the reasons outlined
above.

I propose the following strategy to fix the bug:

1. Call resize_mini_window from redisplay_internaal before the call to
  prepare_menu_bars.
2. Remove the call to resize_mini_window from display_echo_area_1, and
  make that function of type void.
3. Change the contract of echo_area_display, such that the echo area
  must have been set to the correct height before calling it.
4. Adapt message3_nolog (the only other function which calls
  echo_area_display) to call resize_mini_window.

As a result of these changes, any change in the size of the echo area
would be taken into account when invoking window-size-change-functions.

An advantage of this change is that a recursive invocation of
redisplay_internal inside echo_area_display could be removed, improving
performance.

If it would help, I could post an analysis to support the soundness of
the above strategy.

What do you think?

> Thanks.

-- 
Alan Mackenzie (Nuremberg, Germany).