aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2019-06-09 04:27:09 +0200
committerEli Zaretskii2019-06-22 12:12:34 +0300
commit54256143ef770a48ece146e1f7884447fce8cfd8 (patch)
treecbc19dce868bdb753b157317069a4b024e9eac5a
parentefda44fb72d0f1ed7f8a6506f2cb1ddd504d93b8 (diff)
downloademacs-54256143ef770a48ece146e1f7884447fce8cfd8.tar.gz
emacs-54256143ef770a48ece146e1f7884447fce8cfd8.zip
Make toolbar show keyboard equivalents in its tooltips
* src/keyboard.c (parse_tool_bar_item): Add equivalent key binding to the tooltip string of toolbar buttons. * etc/NEWS: Announce it. * etc/TODO: Remove its entry. (Bug#36156)
-rw-r--r--etc/NEWS3
-rw-r--r--etc/TODO2
-rw-r--r--src/keyboard.c13
3 files changed, 16 insertions, 2 deletions
diff --git a/etc/NEWS b/etc/NEWS
index f0d7457a627..0cfac248a32 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -125,6 +125,9 @@ This is intended mostly to help developers.
125** Emacs now requires GTK 2.24 and GTK 3.10 for the GTK 2 and GTK 3 125** Emacs now requires GTK 2.24 and GTK 3.10 for the GTK 2 and GTK 3
126builds respectively. 126builds respectively.
127 127
128---
129** The toolbar now shows the equivalent key binding in its tooltips.
130
128 131
129* Startup Changes in Emacs 27.1 132* Startup Changes in Emacs 27.1
130 133
diff --git a/etc/TODO b/etc/TODO
index 273455c386e..34de81b147c 100644
--- a/etc/TODO
+++ b/etc/TODO
@@ -176,8 +176,6 @@ See the 'test' directory for examples.
176** In Emacs Info, examples of using Customize should be clickable 176** In Emacs Info, examples of using Customize should be clickable
177 and they should create Custom buffers. 177 and they should create Custom buffers.
178 178
179** The toolbar should show keyboard equivalents in its tooltips.
180
181** Add function to redraw the tool bar. 179** Add function to redraw the tool bar.
182 180
183** Redesign the load-history data structure so it can cope better 181** Redesign the load-history data structure so it can cope better
diff --git a/src/keyboard.c b/src/keyboard.c
index ab6ca36219d..0d7f124f5f3 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -8297,6 +8297,19 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8297 if (CONSP (get_keymap (PROP (TOOL_BAR_ITEM_BINDING), 0, 1))) 8297 if (CONSP (get_keymap (PROP (TOOL_BAR_ITEM_BINDING), 0, 1)))
8298 return 0; 8298 return 0;
8299 8299
8300 /* If there is a key binding, add it to the help, which will be
8301 displayed as a tooltip for this entry. */
8302 Lisp_Object binding = PROP (TOOL_BAR_ITEM_BINDING);
8303 Lisp_Object keys = Fwhere_is_internal (binding, Qnil, Qt, Qnil, Qnil);
8304 if (!NILP (keys))
8305 {
8306 AUTO_STRING (beg, " (");
8307 AUTO_STRING (end, ")");
8308 Lisp_Object orig = PROP (TOOL_BAR_ITEM_HELP);
8309 Lisp_Object desc = Fkey_description (keys, Qnil);
8310 set_prop (TOOL_BAR_ITEM_HELP, CALLN (Fconcat, orig, beg, desc, end));
8311 }
8312
8300 /* Enable or disable selection of item. */ 8313 /* Enable or disable selection of item. */
8301 if (!EQ (PROP (TOOL_BAR_ITEM_ENABLED_P), Qt)) 8314 if (!EQ (PROP (TOOL_BAR_ITEM_ENABLED_P), Qt))
8302 set_prop (TOOL_BAR_ITEM_ENABLED_P, 8315 set_prop (TOOL_BAR_ITEM_ENABLED_P,