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

From: Alan Mackenzie <[email-masked]>
Date: Tue, 10 Nov 2015 13:49:58 +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?

> > Here's a proposed fix.  It seems to work.  Do you think there are any
> > problems with it?

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

I had to struggle with the posts in that bug archive.  I'm not entirely
certain whether there was more than one patch in the thread, and if so
whether I tried out the one you mean.  For clarity, the patch I tried
was the one from Pip Cet's opening post in the thread, this one:

#########################################################################
>From 243be700591979554e61bbdff0f00f30cc386f7b Mon Sep 17 00:00:00 2001
From: Philip <[email-masked]>
Date: Sun, 23 Aug 2015 21:46:42 +0000
Subject: [PATCH] Call `window-size-change-functions' after mini-window size
 changes.

	* window.c (resize_frame_windows): Set
	FRAME_WINDOW_SIZES_CHANGED flag.  (grow_mini_window):
	Likewise.  (shrink_mini_window): Likewise.
---
 src/window.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/window.c b/src/window.c
index 863a792..68bc9e5 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4094,6 +4094,7 @@ resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise)
     }
 
   fset_redisplay (f);
+  FRAME_WINDOW_SIZES_CHANGED (f) = true;
 }

@@ -4531,6 +4532,7 @@ grow_mini_window (struct window *w, int delta, bool pixelwise)
 	  /* Enforce full redisplay of the frame.  */
 	  /* FIXME: Shouldn't window--resize-root-window-vertically do it?  */
 	  fset_redisplay (f);
+	  FRAME_WINDOW_SIZES_CHANGED (f) = true;
 	  adjust_frame_glyphs (f);
 	  unblock_input ();
 	}
@@ -4570,6 +4572,7 @@ shrink_mini_window (struct window *w, bool pixelwise)
 	  /* Enforce full redisplay of the frame.  */
 	  /* FIXME: Shouldn't window--resize-root-window-vertically do it?  */
 	  fset_redisplay (f);
+	  FRAME_WINDOW_SIZES_CHANGED (f) = true;
 	  adjust_frame_glyphs (f);
 	  unblock_input ();
 	}
#########################################################################

This patch didn't solve my problem.  I think the reason is that
window-size-change-functions is called at the start of redisplay, but
the shrinking of the echo area back to 1 line only takes place later.
Hence there is no way that window-size-change-functions can then be
invoked.

In my proposed change, I change the definition of w-s-c-functions, so
that they get called both when a user action has changed window sizes
(as at present) and when redisplay changes the echo area/minibuffer
size.

> Thanks.

-- 
Alan Mackenzie (Nuremberg, Germany).