Subject: Re: bug#64596: 30.0.50; On FIXME: in src/buffer.c:1481 (force-mode-line-update)

From: Stefan Monnier <[email-masked]>
Date: Sat, 15 Jul 2023 13:15:39 -0400

> Not entirely true, AFAIU.  For example, what does update_mode_lines
> have to do with preparing the menu bar?
>
>   static void
>   prepare_menu_bars (void)
>   {
>     bool all_windows = windows_or_buffers_changed || update_mode_lines;
>     bool some_windows = REDISPLAY_SOME_P ();

Indeed `update_mode_lines` means more than just mode-lines.  It includes
of course header-lines (of course), frame names (less obvious), and also
the menu-bar, and some of those links are indeed not 100% clear.

WDYT about the patch below?
I'll try to update the docs to clarify this.

        Stefan

diff --git a/src/window.h b/src/window.h
index 2f793ebe438..48d3fd3dc82 100644
--- a/src/window.h
+++ b/src/window.h
@@ -1114,9 +1114,12 @@ #define WINDOW_TEXT_TO_FRAME_PIXEL_X(W, X)	\
 
 extern Lisp_Object echo_area_window;
 
-/* Non-zero if we should redraw the mode lines on the next redisplay.
+/* Non-zero if we should redraw the mode line*s* on the next redisplay.
    Usually set to a unique small integer so we can track the main causes of
-   full redisplays in `redisplay--mode-lines-cause'.  */
+   full redisplays in `redisplay--mode-lines-cause'.
+   Here "mode lines" includes also header-lines and frame names, and
+   apparently also menu-bars.  The link with header-lines is clear,
+   but a bit less so for frame names and the menu-bar.  */
 
 extern int update_mode_lines;
 
@@ -1134,6 +1137,11 @@ #define WINDOW_TEXT_TO_FRAME_PIXEL_X(W, X)	\
 extern void wset_redisplay (struct window *w);
 extern void fset_redisplay (struct frame *f);
 extern void bset_redisplay (struct buffer *b);
+
+/* Routines to indicate that the mode-lines might need to be redisplayed.
+   Just as for `update_mode_lines`, this includes header-lines, frame names
+   and menu-bars, and the link with frame names and menu-bars is still
+   unclear.   */
 extern void bset_update_mode_line (struct buffer *b);
 extern void wset_update_mode_line (struct window *w);
 /* Call this to tell redisplay to look for other windows than selected-window