diff options
| author | Richard M. Stallman <rms@gnu.org> | 1993-05-30 04:49:24 +0000 |
|---|---|---|
| committer | Richard M. Stallman <rms@gnu.org> | 1993-05-30 04:49:24 +0000 |
| commit | 4efda7dde879fba0c2cc1a66d5f70bcafe957c91 (patch) | |
| tree | 8dd619a9afcd3e63308ac025f5ef63c46ed3911a | |
| parent | 739f2f5336420c4a5c2623ec90e6117b144f7d42 (diff) | |
| download | emacs-4efda7dde879fba0c2cc1a66d5f70bcafe957c91.tar.gz | |
(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) recognized a function key, to avoid searching for the function key's again in Vfunction_key_map. */ int fkey_start = 0, fkey_end = 0; - Lisp_Object fkey_map = Vfunction_key_map; + Lisp_Object fkey_map; /* If we receive a ``switch-frame'' event in the middle of a key sequence, we put it off for later. While we're reading, we keep the event here. */ - Lisp_Object delayed_switch_frame = Qnil; + Lisp_Object delayed_switch_frame; + Lisp_Object first_event; + + int junk; + + last_nonmenu_event = Qnil; + + delayed_switch_frame = Qnil; + fkey_map = Vfunction_key_map; /* If there is no function key map, turn off function key scanning. */ if (NILP (Fkeymapp (Vfunction_key_map))) fkey_start = fkey_end = bufsize + 1; - last_nonmenu_event = Qnil; - if (INTERACTIVE) { if (prompt) @@ -3626,6 +3632,11 @@ read_key_sequence (keybuf, bufsize, prompt) echo_start = echo_length (); keys_start = this_command_key_count; + /* Read the first char of the sequence specially, before setting + up any keymaps, in case a filter runs and switches buffers on us. */ + first_event = read_char (!prompt, 0, submaps, last_nonmenu_event, + &junk); + /* We jump here when the key sequence has been thoroughly changed, and we need to rescan it starting from the beginning. When we jump here, keybuf[0..mock_input] holds the sequence we should reread. */ @@ -3724,8 +3735,14 @@ read_key_sequence (keybuf, bufsize, prompt) { last_real_key_start = t; - key = read_char (!prompt, nmaps, submaps, last_nonmenu_event, - &used_mouse_menu); + if (! NILP (first_event)) + { + key = first_event; + first_event = Qnil; + } + else + key = read_char (!prompt, nmaps, submaps, last_nonmenu_event, + &used_mouse_menu); /* read_char returns -1 at the end of a macro. Emacs 18 handles this by returning immediately with a |
