The function process-pending-messages
processes all the pending messages in the current process, and then returns nil
. It is useful when your code needs to continuously do something, but also needs to respond to user input or other messages.
CAPI User Guide and Reference Manual (Unix version) - 3 Aug 2017