diff options
| author | Richard M. Stallman | 1993-05-30 04:49:24 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-05-30 04:49:24 +0000 |
| commit | 4efda7dde879fba0c2cc1a66d5f70bcafe957c91 (patch) | |
| tree | 8dd619a9afcd3e63308ac025f5ef63c46ed3911a | |
| parent | 739f2f5336420c4a5c2623ec90e6117b144f7d42 (diff) | |
| download | emacs-4efda7dde879fba0c2cc1a66d5f70bcafe957c91.tar.gz emacs-4efda7dde879fba0c2cc1a66d5f70bcafe957c91.zip | |
(read_key_sequence): Read the first char specially
before the main loop.
| -rw-r--r-- | src/keyboard.c | 29 |
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 |