Subject: Re: bug#56155: 29.0.50; Options menu, toggle menu items not updated

From: Gerd Möllmann <[email-masked]>
Date: Tue, 28 Jun 2022 14:06:22 +0200

> On 2022-06-23,, at 12:15 , Eli Zaretskii <[email-masked]> wrote:
> 
>> From: Gerd Möllmann <[email-masked]>
>> Date: Thu, 23 Jun 2022 11:09:16 +0200
>> 
>> 1. emacs -Q
>> 2. From the Options menu, select Save Places in Files...
>> 3. The toggle mark on the menu item remains unchanged
>> 
>> This seems to work for some menu items, but not for others.  Maybe NS
>> specific, I don't know.
> 
> I don't see it here, so it's probably NS specific, yes.

I think I have it.

Some toggle menu items lead to a force-mode-line-update, others don't.  For instance, Options -> Hightlight Active Region does lead to a f-m-l-u, Options -> Enter Debugger on Error doesn't.  Consequently, the next redisplay after selecting the toggle either decides to call set_frame_menubar or not.  If it isn't run, the toggle marks are not updated in the menu.

What I don't know is if this can only be seen on macOS.  On macOS, one can select an option from the menu bar, re-open the Options menu and select another, wihout Emacs running anything in between the two selections that can itself set update_mode_lines.  If anything else sets update_mode_lines, the ill effect will not show up.  Just clicking in the text area runs a command...

A possible fix that works for me is attached.

Passing t to force-mode-line-update in the patch is be a bit brutal, perhaps.  I didn't want to play games after some brutal debugging.