Subject: Re: bug#31692: Emacs sometimes drops key events

From: Michael Heerdegen <[email-masked]>
Date: Tue, 05 Jun 2018 02:59:30 +0200

Eli Zaretskii <[email-masked]> writes:

> Is this in a text-mode frame or a GUI frame?

`aggressive-indent-mode' has been mentioned multiple times (defined in
Gnu Elpa package "aggressive-indent" btw).

I see a combination of `while-no-input' and `sit-for' in
`aggressive-indent--indent-if-changed':

#+begin_src emacs-lisp
(defun aggressive-indent--indent-if-changed ()
  "Indent any region that changed in the last command loop."
  (when aggressive-indent--changed-list
    (save-excursion
      (save-selected-window
        (unless (or (run-hook-wrapped 'aggressive-indent--internal-dont-indent-if #'eval)
                    (aggressive-indent--run-user-hooks))
          (while-no-input
            (sit-for aggressive-indent-sit-for-time t)
            (redisplay)
            (aggressive-indent--proccess-changed-list-and-indent)))))))
#+end_src

This test function behaves as described if you call it and hit a key
before sit-for has terminated:

(defun test ()
  (interactive)
  (while-no-input
    (sit-for 3))
  (message "Done"))

I then just get a "Quit" - the hitten key, and the (message "Done") call
are skipped.

Michael.