Subject: bug#36156: [PATCH] Make toolbar show keyboard equivalents in its tooltips

From: Juri Linkov <[email-masked]>
Date: Sun, 25 Aug 2019 23:18:20 +0300

>> > Are we sure TOOL_BAR_ITEM_CAPTION will always produce human-readable
>> > text?
>>
>> I think so, because we do this above (quoted to avoid gmail mangling the code):
>
> That just makes sure it's a string, but what kind of string is that?
> A caption can be something unpalatable, like "OpNuFil".

Currently HELP's fallback to CAPTION is a standard way
to handle absence of HELP:

note_tool_bar_highlight has this code:

  help_echo_string = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_HELP);
  if (NILP (help_echo_string))
    help_echo_string = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_CAPTION);

xg_tool_bar_help_callback has this code:

      help = AREF (f->tool_bar_items, idx + TOOL_BAR_ITEM_HELP);
      if (NILP (help))
        help = AREF (f->tool_bar_items, idx + TOOL_BAR_ITEM_CAPTION);

The patch added the same handling to parse_tool_bar_item:

       Lisp_Object orig = PROP (TOOL_BAR_ITEM_HELP);
+      if (NILP (orig))
+        orig = PROP (TOOL_BAR_ITEM_CAPTION);