Commit 83047ee3 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(while-no-input): Return t if there is input.

parent e3854e65
...@@ -1833,14 +1833,14 @@ is allowed once again." ...@@ -1833,14 +1833,14 @@ is allowed once again."
(defmacro while-no-input (&rest body) (defmacro while-no-input (&rest body)
"Execute BODY only as long as there's no pending input. "Execute BODY only as long as there's no pending input.
If input arrives, that ends the execution of BODY, If input arrives, that ends the execution of BODY,
and `while-no-input' returns nil. If BODY finishes, and `while-no-input' returns t. Quitting makes it return nil.
`while-no-input' returns whatever value BODY produced." If BODY finishes, `while-no-input' returns whatever value BODY produced."
(declare (debug t) (indent 0)) (declare (debug t) (indent 0))
(let ((catch-sym (make-symbol "input"))) (let ((catch-sym (make-symbol "input")))
`(with-local-quit `(with-local-quit
(catch ',catch-sym (catch ',catch-sym
(let ((throw-on-input ',catch-sym)) (let ((throw-on-input ',catch-sym))
(when (sit-for 0 0 t) (or (not (sit-for 0 0 t))
,@body)))))) ,@body))))))
(defmacro combine-after-change-calls (&rest body) (defmacro combine-after-change-calls (&rest body)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment