safe_run_hooks (Qpost_command_hook);
/* If displaying a message, resize the echo area window to fit
- that message's size exactly. */
- if (!NILP (echo_area_buffer[0]))
+ that message's size exactly. Do this only if the echo area
+ window is the minibuffer window of the selected frame. See
+ Bug#34317. */
+ if (!NILP (echo_area_buffer[0])
+ && (EQ (echo_area_window,
+ FRAME_MINIBUF_WINDOW (XFRAME (selected_frame)))))
resize_echo_area_exactly ();
/* If there are warnings waiting, process them. */
/* Set global variable indicating that multiple frames exist. */
multiple_frames = CONSP (tail);
- /* Switch to the buffer of selected window of the frame. Set up
- mode_line_target so that display_mode_element will output into
- mode_line_noprop_buf; then display the title. */
- record_unwind_protect (unwind_format_mode_line,
- format_mode_line_unwind_data
- (f, current_buffer, selected_window, false));
/* select-frame calls resize_mini_window, which could resize the
mini-window and by that undo the effect of this redisplay
cycle wrt minibuffer and echo-area display. Binding
inhibit-redisplay to t makes the call to resize_mini_window a
no-op, thus avoiding the adverse side effects. */
+
+ /* The following was moved before the record_unwind_protect form
+ below to inhibit redisplay also when restoring the selected
+ window/frame: This avoids that resize_mini_window sizes back
+ the minibuffer window of a temporarily selected frame. See
+ Bug#34317. */
specbind (Qinhibit_redisplay, Qt);
+ /* Switch to the buffer of selected window of the frame. Set up
+ mode_line_target so that display_mode_element will output into
+ mode_line_noprop_buf; then display the title. */
+ record_unwind_protect (unwind_format_mode_line,
+ format_mode_line_unwind_data
+ (f, current_buffer, selected_window, false));
+
Fselect_window (f->selected_window, Qt);
set_buffer_internal_1
(XBUFFER (XWINDOW (f->selected_window)->contents));