changeset 9607:081040eb1863

(Voverriding_local_map_menu_flag): New variable. (syms_of_keyboard): Set up Lisp var. (menu_bar_items): Obey Voverriding_local_map_menu_flag.
author Richard M. Stallman <rms@gnu.org>
date Wed, 19 Oct 1994 09:00:37 +0000
parents a94dba376d9a
children 1a85137cb257
files src/keyboard.c
diffstat 1 files changed, 25 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Wed Oct 19 07:47:54 1994 +0000
+++ b/src/keyboard.c	Wed Oct 19 09:00:37 1994 +0000
@@ -172,6 +172,9 @@
 /* If non-nil, this is a map that overrides all other local maps.  */
 Lisp_Object Voverriding_local_map;
 
+/* If non-nil, Voverriding_local_map applies to the menu bar.  */
+Lisp_Object Voverriding_local_map_menu_flag;
+
 /* Current depth in recursive edits.  */
 int command_loop_level;
 
@@ -3773,14 +3776,26 @@
   { 
     Lisp_Object *tmaps;
 
-    if (!NILP (Voverriding_local_map))
+    /* Should overriding-local-map apply, here?  */
+    if (!NILP (Voverriding_local_map_menu_flag))
       {
-	nmaps = 2;
-	maps = (Lisp_Object *) alloca (nmaps * sizeof (maps[0]));
-	maps[0] = Voverriding_local_map;
+	if (NILP (Voverriding_local_map))
+	  {
+	    /* Yes, and it is nil.  Use just global map.  */
+	    nmaps = 1;
+	    maps = (Lisp_Object *) alloca (nmaps * sizeof (maps[0]));
+	  }
+	else
+	  {
+	    /* Yes, and it is non-nil.  Use it and the global map.  */
+	    nmaps = 2;
+	    maps = (Lisp_Object *) alloca (nmaps * sizeof (maps[0]));
+	    maps[0] = Voverriding_local_map;
+	  }
       }
     else
       {
+	/* No, so use major and minor mode keymaps.  */
 	nmaps = current_minor_maps (0, &tmaps) + 2;
 	maps = (Lisp_Object *) alloca (nmaps * sizeof (maps[0]));
 	bcopy (tmaps, maps, (nmaps - 2) * sizeof (maps[0]));
@@ -6278,6 +6293,12 @@
 buffer's local map, and the minor mode keymaps and text property keymaps.");
   Voverriding_local_map = Qnil;
 
+  DEFVAR_LISP ("overriding-local-map-menu-flag", &Voverriding_local_map_menu_flag,
+    "Non-nil means `overriding-local-map' applies to the menu bar.\n\
+Otherwise, the menu bar continues to reflect the buffer's local map\n\
+and the minor mode maps regardless of `overriding-local-map'.");
+  Voverriding_local_map_menu_flag = Qnil;
+
   DEFVAR_BOOL ("track-mouse", &do_mouse_tracking,
 	       "*Non-nil means generate motion events for mouse motion.");