Subject: bug#21329: 25.0.50; Flyspell minor mode produces weird effects on keyboard macros

From: Stefan Monnier <[email-masked]>
Date: Thu, 27 Aug 2015 21:33:16 -0400

>> > Would it work to loop until input-pending-p returns non-nil?
>> Maybe that can be made to work, but it's likely to introduce
>> other problems.
> Which ones, for example?

Not sure.  I just know that we've already tried various different
alternatives for this code.  All the problems have been "corner cases",
IIRC, and many of them were nasty enough to make us rewrite the
function completely.

One possible problem is that input-pending-p might return t in cases where
the pending input is "not significant", in the sense that read-event
won't return it (maybe because it will consume it internally as in the
case of event bounds to special-event-map, IIRC).

>> I was thinking more about refactoring read-event so as to provide a new
>> `wait-for-event` which stops just before we actually consume the event.
> How will it be different from what input-pending-p already does?

It will be different in that it will wait until an event arrives.
But yes, maybe the implementation of the two can be shared.

        Stefan

PS: I suggest you try and install your suggested patch, in the
mean time.  I don't understand enough of its impact to judge its
quality, but it's worth a try.  Just make sure you add a good comment in
the code explaining the problem this is trying to fix.