Commit 759860a6 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

In each active map, for each menu bar item, use only the first submap.

(menu_bar_one_keymap): Initialize menu_bar_one_keymap_changed_items.
(menu_bar_item): Update and test menu_bar_one_keymap_changed_items.
(syms_of_keyboard): Staticpro and init it.
parent e0a6ee5e
...@@ -5701,12 +5701,16 @@ menu_bar_items (old) ...@@ -5701,12 +5701,16 @@ menu_bar_items (old)
/* Scan one map KEYMAP, accumulating any menu items it defines /* Scan one map KEYMAP, accumulating any menu items it defines
in menu_bar_items_vector. */ in menu_bar_items_vector. */
static Lisp_Object menu_bar_one_keymap_changed_items;
static void static void
menu_bar_one_keymap (keymap) menu_bar_one_keymap (keymap)
Lisp_Object keymap; Lisp_Object keymap;
{ {
Lisp_Object tail, item, table; Lisp_Object tail, item, table;
menu_bar_one_keymap_changed_items = Qnil;
/* Loop over all keymap entries that have menu strings. */ /* Loop over all keymap entries that have menu strings. */
for (tail = keymap; CONSP (tail); tail = XCONS (tail)->cdr) for (tail = keymap; CONSP (tail); tail = XCONS (tail)->cdr)
{ {
...@@ -5739,6 +5743,7 @@ menu_bar_item (key, item) ...@@ -5739,6 +5743,7 @@ menu_bar_item (key, item)
{ {
struct gcpro gcpro1; struct gcpro gcpro1;
int i; int i;
Lisp_Object tem;
if (EQ (item, Qundefined)) if (EQ (item, Qundefined))
{ {
...@@ -5767,6 +5772,15 @@ menu_bar_item (key, item) ...@@ -5767,6 +5772,15 @@ menu_bar_item (key, item)
if (!i) if (!i)
return; return;
/* If this keymap has already contributed to this KEY,
don't contribute to it a second time. */
tem = Fmemq (key, menu_bar_one_keymap_changed_items);
if (!NILP (tem))
return;
menu_bar_one_keymap_changed_items
= Fcons (key, menu_bar_one_keymap_changed_items);
item = XVECTOR (item_properties)->contents[ITEM_PROPERTY_DEF]; item = XVECTOR (item_properties)->contents[ITEM_PROPERTY_DEF];
/* Find any existing item for this KEY. */ /* Find any existing item for this KEY. */
...@@ -9075,6 +9089,9 @@ syms_of_keyboard () ...@@ -9075,6 +9089,9 @@ syms_of_keyboard ()
read_key_sequence_cmd = Qnil; read_key_sequence_cmd = Qnil;
staticpro (&read_key_sequence_cmd); staticpro (&read_key_sequence_cmd);
menu_bar_one_keymap_changed_items = Qnil;
staticpro (&menu_bar_one_keymap_changed_items);
defsubr (&Sevent_convert_list); defsubr (&Sevent_convert_list);
defsubr (&Sread_key_sequence); defsubr (&Sread_key_sequence);
defsubr (&Sread_key_sequence_vector); defsubr (&Sread_key_sequence_vector);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment