Hi, this is an updated patch set. Changes to the previous revision: * Instead of changing requeued_events_pending_p, it's renamed to requeued_command_events_pending_p, and I've fixed the outdated comment that had misled me.  Then a new requeued_events_pending_p with different semantics is added and used in following commits. This addresses one of Eli's comments, and should make sure that existing callers of requeued_events_pending_p are not affected by the patch. * I've added a large comment to src/macro.c as an attempt to explain how we handle the end of a keyboard macro. * I've improved the commit message of (now) 6be0f5f.  Best, Tim