Subject: bug#53391: First keypress doesn't work when scratch buffer is killed in emacs 28, emacs daemon + emacs client is used

From: Евгений Курневский<[email-masked]>
Date: Thu, 20 Jan 2022 13:49:19 +0000

I have encountered a problem with emacs 28 - sometimes it skips the first
button press in a very specific case. To reproduce write the following as a
config file:

(kill-buffer "*scratch*")

Start emacs daemon with: emacs -Q -l this_init_file.el --daemon
Launch emacs client with: emacsclient -nw some_file.txt
Try to type some key, like 'x', and you will see 'x is undefined'

Probably I shouldn't have killed the scratch buffer in the first place, so
I'm fine if it's not considered as a bug. But this used to work fine with
emacs 27 and causes this strange behavior with emacs 28 which was
unexpected to me.

Emacs version I use: 28.0.91

Initially reported here: https://github.com/jwiegley/use-package/issues/973