aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer1995-06-16 05:42:42 +0000
committerKarl Heuer1995-06-16 05:42:42 +0000
commit217258d52e506f63673cace6f488d5da11646178 (patch)
tree7dd282001deb1f3409db62d75e2b5140b36d7608 /src
parentd46fb96ae4daab90cad40919340ab424fdde4c99 (diff)
downloademacs-217258d52e506f63673cace6f488d5da11646178.tar.gz
emacs-217258d52e506f63673cace6f488d5da11646178.zip
(init_kboard): Initialize it.
(syms_of_keyboard): Defvar it. (read_key_sequence, menu_bar_items): Check Voverriding_terminal_local_map before Voverriding_local_map. (command_loop_1): In special handling for commands that create a prefix arg, don't handle commands that merely preserve one that was previously created.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c85
1 files changed, 47 insertions, 38 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index affce27280a..f9980310c06 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1354,8 +1354,12 @@ command_loop_1 ()
1354 cancel_echoing, and 1354 cancel_echoing, and
1355 3) we want to leave this_command_key_count non-zero, so that 1355 3) we want to leave this_command_key_count non-zero, so that
1356 read_char will realize that it is re-reading a character, and 1356 read_char will realize that it is re-reading a character, and
1357 not echo it a second time. */ 1357 not echo it a second time.
1358 if (NILP (current_kboard->Vprefix_arg)) 1358
1359 If the command didn't actually create a prefix arg,
1360 but is merely a frame event that is transparent to prefix args,
1361 then the above doesn't apply. */
1362 if (NILP (current_kboard->Vprefix_arg) || CONSP (last_command_char))
1359 { 1363 {
1360 current_kboard->Vlast_command = this_command; 1364 current_kboard->Vlast_command = this_command;
1361 cancel_echoing (); 1365 cancel_echoing ();
@@ -4356,36 +4360,30 @@ menu_bar_items (old)
4356 { 4360 {
4357 Lisp_Object *tmaps; 4361 Lisp_Object *tmaps;
4358 4362
4359 /* Should overriding-local-map apply, here? */ 4363 /* Should overriding-terminal-local-map and overriding-local-map apply? */
4360 if (!NILP (Voverriding_local_map_menu_flag)) 4364 if (!NILP (Voverriding_local_map_menu_flag))
4361 { 4365 {
4362 if (NILP (Voverriding_local_map)) 4366 /* Yes, use them (if non-nil) as well as the global map. */
4363 { 4367 maps = (Lisp_Object *) alloca (3 * sizeof (maps[0]));
4364 /* Yes, and it is nil. Use just global map. */ 4368 nmaps = 0;
4365 nmaps = 1; 4369 if (!NILP (current_kboard->Voverriding_terminal_local_map))
4366 maps = (Lisp_Object *) alloca (nmaps * sizeof (maps[0])); 4370 maps[nmaps++] = current_kboard->Voverriding_terminal_local_map;
4367 } 4371 if (!NILP (Voverriding_local_map))
4368 else 4372 maps[nmaps++] = Voverriding_local_map;
4369 {
4370 /* Yes, and it is non-nil. Use it and the global map. */
4371 nmaps = 2;
4372 maps = (Lisp_Object *) alloca (nmaps * sizeof (maps[0]));
4373 maps[0] = Voverriding_local_map;
4374 }
4375 } 4373 }
4376 else 4374 else
4377 { 4375 {
4378 /* No, so use major and minor mode keymaps. */ 4376 /* No, so use major and minor mode keymaps. */
4379 nmaps = current_minor_maps (NULL, &tmaps) + 2; 4377 nmaps = current_minor_maps (NULL, &tmaps);
4380 maps = (Lisp_Object *) alloca (nmaps * sizeof (maps[0])); 4378 maps = (Lisp_Object *) alloca ((nmaps + 2) * sizeof (maps[0]));
4381 bcopy (tmaps, maps, (nmaps - 2) * sizeof (maps[0])); 4379 bcopy (tmaps, maps, nmaps * sizeof (maps[0]));
4382#ifdef USE_TEXT_PROPERTIES 4380#ifdef USE_TEXT_PROPERTIES
4383 maps[nmaps-2] = get_local_map (PT, current_buffer); 4381 maps[nmaps++] = get_local_map (PT, current_buffer);
4384#else 4382#else
4385 maps[nmaps-2] = current_buffer->keymap; 4383 maps[nmaps++] = current_buffer->keymap;
4386#endif 4384#endif
4387 } 4385 }
4388 maps[nmaps-1] = current_global_map; 4386 maps[nmaps++] = current_global_map;
4389 } 4387 }
4390 4388
4391 /* Look up in each map the dummy prefix key `menu-bar'. */ 4389 /* Look up in each map the dummy prefix key `menu-bar'. */
@@ -5155,34 +5153,38 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
5155 { 5153 {
5156 Lisp_Object *maps; 5154 Lisp_Object *maps;
5157 5155
5158 if (!NILP (Voverriding_local_map)) 5156 if (!NILP (current_kboard->Voverriding_terminal_local_map)
5157 || !NILP (Voverriding_local_map))
5159 { 5158 {
5160 nmaps = 2; 5159 if (3 > nmaps_allocated)
5161 if (nmaps > nmaps_allocated)
5162 { 5160 {
5163 submaps = (Lisp_Object *) alloca (nmaps * sizeof (submaps[0])); 5161 submaps = (Lisp_Object *) alloca (3 * sizeof (submaps[0]));
5164 defs = (Lisp_Object *) alloca (nmaps * sizeof (defs[0])); 5162 defs = (Lisp_Object *) alloca (3 * sizeof (defs[0]));
5165 nmaps_allocated = nmaps; 5163 nmaps_allocated = 3;
5166 } 5164 }
5167 submaps[0] = Voverriding_local_map; 5165 nmaps = 0;
5166 if (!NILP (current_kboard->Voverriding_terminal_local_map))
5167 submaps[nmaps++] = current_kboard->Voverriding_terminal_local_map;
5168 if (!NILP (Voverriding_local_map))
5169 submaps[nmaps++] = Voverriding_local_map;
5168 } 5170 }
5169 else 5171 else
5170 { 5172 {
5171 nmaps = current_minor_maps (0, &maps) + 2; 5173 nmaps = current_minor_maps (0, &maps);
5172 if (nmaps > nmaps_allocated) 5174 if (nmaps + 2 > nmaps_allocated)
5173 { 5175 {
5174 submaps = (Lisp_Object *) alloca (nmaps * sizeof (submaps[0])); 5176 submaps = (Lisp_Object *) alloca ((nmaps+2) * sizeof (submaps[0]));
5175 defs = (Lisp_Object *) alloca (nmaps * sizeof (defs[0])); 5177 defs = (Lisp_Object *) alloca ((nmaps+2) * sizeof (defs[0]));
5176 nmaps_allocated = nmaps; 5178 nmaps_allocated = nmaps + 2;
5177 } 5179 }
5178 bcopy (maps, submaps, (nmaps - 2) * sizeof (submaps[0])); 5180 bcopy (maps, submaps, nmaps * sizeof (submaps[0]));
5179#ifdef USE_TEXT_PROPERTIES 5181#ifdef USE_TEXT_PROPERTIES
5180 submaps[nmaps-2] = orig_local_map; 5182 submaps[nmaps++] = orig_local_map;
5181#else 5183#else
5182 submaps[nmaps-2] = current_buffer->keymap; 5184 submaps[nmaps++] = current_buffer->keymap;
5183#endif 5185#endif
5184 } 5186 }
5185 submaps[nmaps-1] = current_global_map; 5187 submaps[nmaps++] = current_global_map;
5186 } 5188 }
5187 5189
5188 /* Find an accurate initial value for first_binding. */ 5190 /* Find an accurate initial value for first_binding. */
@@ -6650,6 +6652,7 @@ void
6650init_kboard (kb) 6652init_kboard (kb)
6651 KBOARD *kb; 6653 KBOARD *kb;
6652{ 6654{
6655 kb->Voverriding_terminal_local_map = Qnil;
6653 kb->Vlast_command = Qnil; 6656 kb->Vlast_command = Qnil;
6654 kb->Vprefix_arg = Qnil; 6657 kb->Vprefix_arg = Qnil;
6655 kb->kbd_queue = Qnil; 6658 kb->kbd_queue = Qnil;
@@ -7140,6 +7143,12 @@ implementing hook functions that alter the set of hook functions.");
7140The elements of the list are event types that may have menu bar bindings."); 7143The elements of the list are event types that may have menu bar bindings.");
7141 Vmenu_bar_final_items = Qnil; 7144 Vmenu_bar_final_items = Qnil;
7142 7145
7146 DEFVAR_KBOARD ("overriding-terminal-local-map",
7147 Voverriding_terminal_local_map,
7148 "Keymap that overrides all other local keymaps.\n\
7149If this variable is non-nil, it is used as a keymap instead of the\n\
7150buffer's local map, and the minor mode keymaps and text property keymaps.");
7151
7143 DEFVAR_LISP ("overriding-local-map", &Voverriding_local_map, 7152 DEFVAR_LISP ("overriding-local-map", &Voverriding_local_map,
7144 "Keymap that overrides all other local keymaps.\n\ 7153 "Keymap that overrides all other local keymaps.\n\
7145If this variable is non-nil, it is used as a keymap instead of the\n\ 7154If this variable is non-nil, it is used as a keymap instead of the\n\