Commit 4efda7dd authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(read_key_sequence): Read the first char specially

before the main loop.
parent 739f2f53
......@@ -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 (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,
/* 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,
if (! NILP (first_event))
key = first_event;
first_event = Qnil;
key = read_char (!prompt, nmaps, submaps, last_nonmenu_event,
/* read_char returns -1 at the end of a macro.
Emacs 18 handles this by returning immediately with a
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment