(while-no-input &rest BODY)
Execute BODY only as long as there's no pending input.
If input arrives, that ends the execution of BODY, and while-no-input returns t. Quitting makes it return nil. If BODY finishes, while-no-input returns whatever value BODY produced.
If the BODY returns t
then there is no way to distinguish it from the input interruption. One way could be to check if the return value is t
in the BODY itself and then return certain value like 293851932832985
. Is there a cleaner way?