Lisp_Object Qself_insert_command;
Lisp_Object Qforward_char;
Lisp_Object Qbackward_char;
+Lisp_Object Qundefined;
/* read_key_sequence stores here the command definition of the
key sequence that it reads. */
result = Qnil;
- for (mapno = 0; mapno < nmaps; mapno++)
+ for (mapno = nmaps - 1; mapno >= 0; mapno--)
{
if (! NILP (maps[mapno]))
def = get_keyelt (access_keymap (maps[mapno], Qmenu_bar, 1, 0));
result = menu_bar_item (key, item_string,
Fcdr (binding), result);
}
+ else if (EQ (binding, Qundefined))
+ result = menu_bar_item (key, item_string,
+ Fcdr (binding), result);
}
else if (XTYPE (item) == Lisp_Vector)
{
result = menu_bar_item (key, item_string,
Fcdr (binding), result);
}
+ else if (EQ (binding, Qundefined))
+ result = menu_bar_item (key, item_string,
+ Fcdr (binding), result);
}
}
}
menu_bar_item (key, item_string, def, result)
Lisp_Object key, item_string, def, result;
{
- Lisp_Object tem, elt;
+ Lisp_Object tem;
Lisp_Object enabled;
+ if (EQ (def, Qundefined))
+ {
+ /* If a map has an explicit nil as definition,
+ discard any previously made menu bar item. */
+ tem = Fassq (key, result);
+ return Fdelq (tem, result);
+ }
+
/* See if this entry is enabled. */
enabled = Qt;
/* Add an entry for this key and string
if there is none yet. */
- elt = Fassq (key, result);
- if (!NILP (enabled) && NILP (elt))
+ tem = Fassq (key, result);
+ if (!NILP (enabled) && NILP (tem))
result = Fcons (Fcons (key, Fcons (item_string, Qnil)), result);
return result;
Qdisabled = intern ("disabled");
staticpro (&Qdisabled);
+ Qundefined = intern ("undefined");
+ staticpro (&Qundefined);
+
Qpre_command_hook = intern ("pre-command-hook");
staticpro (&Qpre_command_hook);