Subject: Re: bug#60015: 29.0.60; multi-line messages truncated in non-selected minibuffer

From: Eli Zaretskii <[email-masked]>
Date: Thu, 15 Dec 2022 17:30:13 +0200

> Date: Thu, 15 Dec 2022 16:12:05 +0100
> From: martin rudalics <[email-masked]>
> Cc: [email-masked], [email-masked]
> 
>  > So the problem seems to be
>  > with 'set-message-functions' and there I'm lost.
> 
> BTW
> 
> (setq set-message-functions nil)
> 
> fixes it here.

Of course.  Because then the temporary-message-shown-as-overlay
feature is disabled, and we show messages via xdisp.c code.  Like I
said: this particular issue happens because in this scenario
set-minibuffer-message bypasses the "normal" code in message3_nolog
which displays messages "normally".  We just add an overlay to the
minibuffer, and expect redisplay_window to resize the mini-window as
part of its redrawing all the windows.  But redisplay_window doesn't.

Juri, does the patch below give good results?  It's a bit of overkill,
since the mini-window usually doesn't need any resizing, but maybe
that is not too bad.

If it seems to solve the problem, would you please run with this for a
couple of weeks, and report back if you see any problems?  If there
are no problems, I'll then install this on the emacs-29 branch.

diff --git a/src/xdisp.c b/src/xdisp.c
index d14cd46..45da496 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -19429,6 +19429,13 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
 	    blank_row (w, row, y);
 	  goto finish_scroll_bars;
 	}
+      else if (minibuf_level >= 1)
+	{
+	  /* We could have a message produced by set-minibuffer-message
+	     displayed in the mini-window as an overlay, so resize the
+	     mini-window if needed.  */
+	  resize_mini_window (w, false);
+	}
 
       clear_glyph_matrix (w->desired_matrix);
     }