aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1993-07-12 23:32:43 +0000
committerRichard M. Stallman1993-07-12 23:32:43 +0000
commite58aa38535a2a7fa14bc66a19ec8b360aaaa7c7a (patch)
tree4d3de2e755cd6d1f9763e0764873d49b30187956 /src
parent039e9c8b9b9636be071f1b8772ee53573f2e4135 (diff)
downloademacs-e58aa38535a2a7fa14bc66a19ec8b360aaaa7c7a.tar.gz
emacs-e58aa38535a2a7fa14bc66a19ec8b360aaaa7c7a.zip
(Qundefined): New variable.
(syms_of_keyboard): Set up Qundefined. (menu_bar_items): Don't reverse the items. Process the maps in reverse order. (menu_bar_item): If definition is `undefined', delete any menu bar item already made, and don't make one.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 316811d49ba..06e47dabf99 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -242,6 +242,7 @@ unsigned long last_event_timestamp;
242Lisp_Object Qself_insert_command; 242Lisp_Object Qself_insert_command;
243Lisp_Object Qforward_char; 243Lisp_Object Qforward_char;
244Lisp_Object Qbackward_char; 244Lisp_Object Qbackward_char;
245Lisp_Object Qundefined;
245 246
246/* read_key_sequence stores here the command definition of the 247/* read_key_sequence stores here the command definition of the
247 key sequence that it reads. */ 248 key sequence that it reads. */
@@ -3186,7 +3187,7 @@ menu_bar_items ()
3186 3187
3187 result = Qnil; 3188 result = Qnil;
3188 3189
3189 for (mapno = 0; mapno < nmaps; mapno++) 3190 for (mapno = nmaps - 1; mapno >= 0; mapno--)
3190 { 3191 {
3191 if (! NILP (maps[mapno])) 3192 if (! NILP (maps[mapno]))
3192 def = get_keyelt (access_keymap (maps[mapno], Qmenu_bar, 1, 0)); 3193 def = get_keyelt (access_keymap (maps[mapno], Qmenu_bar, 1, 0));
@@ -3227,6 +3228,9 @@ menu_bar_one_keymap (keymap, result)
3227 result = menu_bar_item (key, item_string, 3228 result = menu_bar_item (key, item_string,
3228 Fcdr (binding), result); 3229 Fcdr (binding), result);
3229 } 3230 }
3231 else if (EQ (binding, Qundefined))
3232 result = menu_bar_item (key, item_string,
3233 Fcdr (binding), result);
3230 } 3234 }
3231 else if (XTYPE (item) == Lisp_Vector) 3235 else if (XTYPE (item) == Lisp_Vector)
3232 { 3236 {
@@ -3245,6 +3249,9 @@ menu_bar_one_keymap (keymap, result)
3245 result = menu_bar_item (key, item_string, 3249 result = menu_bar_item (key, item_string,
3246 Fcdr (binding), result); 3250 Fcdr (binding), result);
3247 } 3251 }
3252 else if (EQ (binding, Qundefined))
3253 result = menu_bar_item (key, item_string,
3254 Fcdr (binding), result);
3248 } 3255 }
3249 } 3256 }
3250 } 3257 }
@@ -3256,9 +3263,17 @@ static Lisp_Object
3256menu_bar_item (key, item_string, def, result) 3263menu_bar_item (key, item_string, def, result)
3257 Lisp_Object key, item_string, def, result; 3264 Lisp_Object key, item_string, def, result;
3258{ 3265{
3259 Lisp_Object tem, elt; 3266 Lisp_Object tem;
3260 Lisp_Object enabled; 3267 Lisp_Object enabled;
3261 3268
3269 if (EQ (def, Qundefined))
3270 {
3271 /* If a map has an explicit nil as definition,
3272 discard any previously made menu bar item. */
3273 tem = Fassq (key, result);
3274 return Fdelq (tem, result);
3275 }
3276
3262 /* See if this entry is enabled. */ 3277 /* See if this entry is enabled. */
3263 enabled = Qt; 3278 enabled = Qt;
3264 3279
@@ -3273,8 +3288,8 @@ menu_bar_item (key, item_string, def, result)
3273 3288
3274 /* Add an entry for this key and string 3289 /* Add an entry for this key and string
3275 if there is none yet. */ 3290 if there is none yet. */
3276 elt = Fassq (key, result); 3291 tem = Fassq (key, result);
3277 if (!NILP (enabled) && NILP (elt)) 3292 if (!NILP (enabled) && NILP (tem))
3278 result = Fcons (Fcons (key, Fcons (item_string, Qnil)), result); 3293 result = Fcons (Fcons (key, Fcons (item_string, Qnil)), result);
3279 3294
3280 return result; 3295 return result;
@@ -4910,6 +4925,9 @@ syms_of_keyboard ()
4910 Qdisabled = intern ("disabled"); 4925 Qdisabled = intern ("disabled");
4911 staticpro (&Qdisabled); 4926 staticpro (&Qdisabled);
4912 4927
4928 Qundefined = intern ("undefined");
4929 staticpro (&Qundefined);
4930
4913 Qpre_command_hook = intern ("pre-command-hook"); 4931 Qpre_command_hook = intern ("pre-command-hook");
4914 staticpro (&Qpre_command_hook); 4932 staticpro (&Qpre_command_hook);
4915 4933