Subject: Re: bug#42957: 28.0.50; Tool bar button click doesn't update the tool bar immediately

From: Mauro Aranda <[email-masked]>
Date: Sun, 13 Dec 2020 10:56:39 -0300

Lars Ingebrigtsen <[email-masked]> writes:

> Mauro Aranda <[email-masked]> writes:
>
>> 4. Now click the foo-refresh button.  I expected the button to get
>> disabled immediately, but that doesn't happen.
>> 5. Click in the buffer, and the button will be disabled.
>
> Yup; this problem is still present on the trunk.
>
>> Could Emacs update the tool bar immediately when the user clicks on a
>> tool bar button? Or am I forced (no pun intended) to use
>> `force-mode-line-update' in the commands that may alter the
>> enable/disable state of the tool bar buttons, even when the commands
>> run because of a tool bar button click?
>
> I don't know, but if Emacs can't do that, then this should be
> documented, at least.  This is documented in other context, like:
>
> --
>   The menu bar does not recalculate which items are enabled every time you
> look at a menu.  This is because the X toolkit requires the whole tree
> of menus in advance.  To force recalculation of the menu bar, call
> @code{force-mode-line-update} (@pxref{Mode Line Format}).
> --
>
> But not in the tool bar sections, as far as I can see.  But I guess if
> the menu bar doesn't update automatically on enabling, then it would
> perhaps be surprising that tool bars do.
>
> So I think we should just document this quirk?  Any opinions?

Hi Lars,

Thanks for taking a look, and sorry it took me so long to reply back.

If it can't be done easily, I'm fine with closing this report as a
wontfix.  It doesn't annoy me too much to put some
force-mode-line-update calls here and there.