Subject: bug#31692: Emacs sometimes drops key events

From: Eli Zaretskii <[email-masked]>
Date: Thu, 07 Jun 2018 18:20:38 +0300

> From: Michael Heerdegen <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Thu, 07 Jun 2018 01:12:54 +0200
> 
> An automatic indent mode is a good example: you potentially want
> re-indenting after any editing operation, but it is potentially slow and
> would cause delays.  Using `while-no-input' let's you interrupt the
> indentation operation and continue typing.  If you later make a long
> enough typing pause, indentation will finish.  The `sit-for' is there to
> avoid that indenting fires immediately after hitting a key, so that
> interrupts are less common.

If this is the problem to solve, then why not something like below?

  (if (sit-for 3)
      (while-no-input
        (do-something-longish)))

IOW, what I don't understand is why put sit-for, which returns as soon
as there's input, inside while-no-input, which does something similar,
but using a radically different method?