diff --git a/src/keyboard.c b/src/keyboard.c index 56ab79068ad..0eab8fdfae1 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -9596,7 +9596,16 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt, Fcons (make_lispy_switch_frame (frame), KVAR (interrupted_kboard, kbd_queue))); } - mock_input = 0; + if (FIXNUMP (key) && XFIXNUM (key) == -2) + mock_input = 0; + else + { + /* If interrupted while initializing terminal, we + need to replay the interrupting key. See + Bug#5095 and Bug#37782. */ + mock_input = 1; + keybuf[0] = key; + } goto replay_entire_sequence; } }