changeset 31206:fd9ff59434ff

(menu_bar_item): Detect duplicate entries for all items to better match the key-lookup behavior.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 27 Aug 2000 15:47:59 +0000
parents e61e8402b487
children 959fbf1ef6e6
files src/keyboard.c
diffstat 1 files changed, 15 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Sun Aug 27 13:02:01 2000 +0000
+++ b/src/keyboard.c	Sun Aug 27 15:47:59 2000 +0000
@@ -6346,29 +6346,27 @@
 		     &XVECTOR (menu_bar_items_vector)->contents[i],
 		     (menu_bar_items_index - i - 4) * sizeof (Lisp_Object));
 	    menu_bar_items_index -= 4;
-	    return;
 	  }
-
-      /* If there's no definition for this key yet,
-	 just ignore `undefined'.  */
-      return;
-    }
-
-  GCPRO1 (key);			/* Is this necessary? */
+    }
+
+  /* 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) || NILP (item))
+    return;
+
+  menu_bar_one_keymap_changed_items
+    = Fcons (key, menu_bar_one_keymap_changed_items);
+
+  /* We add to menu_bar_one_keymap_changed_items before doing the
+     parse_menu_item, so that if it turns out it wasn't a menu item,
+     it still correctly hides any further menu item.  */
+  GCPRO1 (key);
   i = parse_menu_item (item, 0, 1);
   UNGCPRO;
   if (!i)
     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];
 
   /* Find any existing item for this KEY.  */