aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index fdfe3b5dfec..8dba1d098e9 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3597,19 +3597,25 @@ read_key_sequence (keybuf, bufsize, prompt)
3597 recognized a function key, to avoid searching for the function 3597 recognized a function key, to avoid searching for the function
3598 key's again in Vfunction_key_map. */ 3598 key's again in Vfunction_key_map. */
3599 int fkey_start = 0, fkey_end = 0; 3599 int fkey_start = 0, fkey_end = 0;
3600 Lisp_Object fkey_map = Vfunction_key_map; 3600 Lisp_Object fkey_map;
3601 3601
3602 /* If we receive a ``switch-frame'' event in the middle of a key sequence, 3602 /* If we receive a ``switch-frame'' event in the middle of a key sequence,
3603 we put it off for later. While we're reading, we keep the event here. */ 3603 we put it off for later. While we're reading, we keep the event here. */
3604 Lisp_Object delayed_switch_frame = Qnil; 3604 Lisp_Object delayed_switch_frame;
3605 3605
3606 Lisp_Object first_event;
3607
3608 int junk;
3609
3610 last_nonmenu_event = Qnil;
3611
3612 delayed_switch_frame = Qnil;
3613 fkey_map = Vfunction_key_map;
3606 3614
3607 /* If there is no function key map, turn off function key scanning. */ 3615 /* If there is no function key map, turn off function key scanning. */
3608 if (NILP (Fkeymapp (Vfunction_key_map))) 3616 if (NILP (Fkeymapp (Vfunction_key_map)))
3609 fkey_start = fkey_end = bufsize + 1; 3617 fkey_start = fkey_end = bufsize + 1;
3610 3618
3611 last_nonmenu_event = Qnil;
3612
3613 if (INTERACTIVE) 3619 if (INTERACTIVE)
3614 { 3620 {
3615 if (prompt) 3621 if (prompt)
@@ -3626,6 +3632,11 @@ read_key_sequence (keybuf, bufsize, prompt)
3626 echo_start = echo_length (); 3632 echo_start = echo_length ();
3627 keys_start = this_command_key_count; 3633 keys_start = this_command_key_count;
3628 3634
3635 /* Read the first char of the sequence specially, before setting
3636 up any keymaps, in case a filter runs and switches buffers on us. */
3637 first_event = read_char (!prompt, 0, submaps, last_nonmenu_event,
3638 &junk);
3639
3629 /* We jump here when the key sequence has been thoroughly changed, and 3640 /* We jump here when the key sequence has been thoroughly changed, and
3630 we need to rescan it starting from the beginning. When we jump here, 3641 we need to rescan it starting from the beginning. When we jump here,
3631 keybuf[0..mock_input] holds the sequence we should reread. */ 3642 keybuf[0..mock_input] holds the sequence we should reread. */
@@ -3724,8 +3735,14 @@ read_key_sequence (keybuf, bufsize, prompt)
3724 { 3735 {
3725 last_real_key_start = t; 3736 last_real_key_start = t;
3726 3737
3727 key = read_char (!prompt, nmaps, submaps, last_nonmenu_event, 3738 if (! NILP (first_event))
3728 &used_mouse_menu); 3739 {
3740 key = first_event;
3741 first_event = Qnil;
3742 }
3743 else
3744 key = read_char (!prompt, nmaps, submaps, last_nonmenu_event,
3745 &used_mouse_menu);
3729 3746
3730 /* read_char returns -1 at the end of a macro. 3747 /* read_char returns -1 at the end of a macro.
3731 Emacs 18 handles this by returning immediately with a 3748 Emacs 18 handles this by returning immediately with a