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

From: Eli Zaretskii <[email-masked]>
Date: Sat, 15 Jul 2023 22:04:53 +0300

> From: Stefan Monnier <[email-masked]>
> Cc: [email-masked],  [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?

That's an improvement, thanks.  But it still isn't everything.  For
example, what about resize_echo_area_exactly: why does it set this
variable?  Also, this variable is tested in update_tool_bar and
update_tab_bar, so the comment you suggest should mention tool bar and
tab bar as well.  Unless you know the answers to these questions, I
guess more digging is in order.

And I'd be happier if, instead of a single variable for so many
purposes we would have either several separate variables or make this
one a bitmap, where each bit says something very specific about the
part of the display that needs updating.  Any takers?

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

Btw, we need some function to show the information in
redisplay--mode-lines-cause in human-readable format, or at least a
documentation for how to examine it.  Without that, this variable is
probably useful only to a very small group of people.