aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-01-16 23:40:22 +0000
committerRichard M. Stallman1994-01-16 23:40:22 +0000
commit9dd3131cef4c12d4df7b763b3a68b692afb0345b (patch)
tree6029ea70a68c3b39b7ef821320db45f54c9ea275 /src
parent7d92e3291af6581697f71f1cc8fda3af1c14e33f (diff)
downloademacs-9dd3131cef4c12d4df7b763b3a68b692afb0345b.tar.gz
emacs-9dd3131cef4c12d4df7b763b3a68b692afb0345b.zip
(Voverriding_local_map): New variable.
(syms_of_keyboard): Set up Lisp variable. (read_key_sequence, menu_bar_items): Handle Voverriding_local_map.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c58
1 files changed, 45 insertions, 13 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index d75f48e21aa..9c302dba8ae 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -159,6 +159,9 @@ int quit_char;
159extern Lisp_Object current_global_map; 159extern Lisp_Object current_global_map;
160extern int minibuf_level; 160extern int minibuf_level;
161 161
162/* If non-nil, this is a map that overrides all other local maps. */
163Lisp_Object Voverriding_local_map;
164
162/* Current depth in recursive edits. */ 165/* Current depth in recursive edits. */
163int command_loop_level; 166int command_loop_level;
164 167
@@ -3463,14 +3466,23 @@ menu_bar_items ()
3463 { 3466 {
3464 Lisp_Object *tmaps; 3467 Lisp_Object *tmaps;
3465 3468
3466 nmaps = current_minor_maps (0, &tmaps) + 2; 3469 if (!NILP (Voverriding_local_map))
3467 maps = (Lisp_Object *) alloca (nmaps * sizeof (maps[0])); 3470 {
3468 bcopy (tmaps, maps, (nmaps - 2) * sizeof (maps[0])); 3471 nmaps = 2;
3472 maps = (Lisp_Object *) alloca (nmaps * sizeof (maps[0]));
3473 maps[0] = Voverriding_local_map;
3474 }
3475 else
3476 {
3477 nmaps = current_minor_maps (0, &tmaps) + 2;
3478 maps = (Lisp_Object *) alloca (nmaps * sizeof (maps[0]));
3479 bcopy (tmaps, maps, (nmaps - 2) * sizeof (maps[0]));
3469#ifdef USE_TEXT_PROPERTIES 3480#ifdef USE_TEXT_PROPERTIES
3470 maps[nmaps-2] = get_local_map (PT, current_buffer); 3481 maps[nmaps-2] = get_local_map (PT, current_buffer);
3471#else 3482#else
3472 maps[nmaps-2] = current_buffer->keymap; 3483 maps[nmaps-2] = current_buffer->keymap;
3473#endif 3484#endif
3485 }
3474 maps[nmaps-1] = current_global_map; 3486 maps[nmaps-1] = current_global_map;
3475 } 3487 }
3476 3488
@@ -4133,19 +4145,33 @@ read_key_sequence (keybuf, bufsize, prompt)
4133 { 4145 {
4134 Lisp_Object *maps; 4146 Lisp_Object *maps;
4135 4147
4136 nmaps = current_minor_maps (0, &maps) + 2; 4148 if (!NILP (Voverriding_local_map))
4137 if (nmaps > nmaps_allocated)
4138 { 4149 {
4139 submaps = (Lisp_Object *) alloca (nmaps * sizeof (submaps[0])); 4150 nmaps = 2;
4140 defs = (Lisp_Object *) alloca (nmaps * sizeof (defs[0])); 4151 if (nmaps > nmaps_allocated)
4141 nmaps_allocated = nmaps; 4152 {
4153 submaps = (Lisp_Object *) alloca (nmaps * sizeof (submaps[0]));
4154 defs = (Lisp_Object *) alloca (nmaps * sizeof (defs[0]));
4155 nmaps_allocated = nmaps;
4156 }
4157 submaps[0] = Voverriding_local_map;
4142 } 4158 }
4143 bcopy (maps, submaps, (nmaps - 2) * sizeof (submaps[0])); 4159 else
4160 {
4161 nmaps = current_minor_maps (0, &maps) + 2;
4162 if (nmaps > nmaps_allocated)
4163 {
4164 submaps = (Lisp_Object *) alloca (nmaps * sizeof (submaps[0]));
4165 defs = (Lisp_Object *) alloca (nmaps * sizeof (defs[0]));
4166 nmaps_allocated = nmaps;
4167 }
4168 bcopy (maps, submaps, (nmaps - 2) * sizeof (submaps[0]));
4144#ifdef USE_TEXT_PROPERTIES 4169#ifdef USE_TEXT_PROPERTIES
4145 submaps[nmaps-2] = get_local_map (PT, current_buffer); 4170 submaps[nmaps-2] = get_local_map (PT, current_buffer);
4146#else 4171#else
4147 submaps[nmaps-2] = current_buffer->keymap; 4172 submaps[nmaps-2] = current_buffer->keymap;
4148#endif 4173#endif
4174 }
4149 submaps[nmaps-1] = current_global_map; 4175 submaps[nmaps-1] = current_global_map;
4150 } 4176 }
4151 4177
@@ -5795,6 +5821,12 @@ Buffer modification stores t in this variable.");
5795The elements of the list are event types that may have menu bar bindings."); 5821The elements of the list are event types that may have menu bar bindings.");
5796 Vmenu_bar_final_items = Qnil; 5822 Vmenu_bar_final_items = Qnil;
5797 5823
5824 DEFVAR_LISP ("overriding-local-map", &Voverriding_local_map,
5825 "Keymap that overrides all other local keymaps.\n\
5826If this variable is non-nil, it is used as a keymap instead of the\n\
5827buffer's local map, and the minor mode keymaps and text property keymaps.");
5828 Voverriding_local_map = Qnil;
5829
5798 DEFVAR_BOOL ("track-mouse", &do_mouse_tracking, 5830 DEFVAR_BOOL ("track-mouse", &do_mouse_tracking,
5799 "*Non-nil means generate motion events for mouse motion."); 5831 "*Non-nil means generate motion events for mouse motion.");
5800 5832