[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/subr.el
From: |
Richard M . Stallman |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/subr.el |
Date: |
Mon, 13 Dec 2004 14:49:23 -0500 |
Index: emacs/lisp/subr.el
diff -c emacs/lisp/subr.el:1.429 emacs/lisp/subr.el:1.430
*** emacs/lisp/subr.el:1.429 Mon Dec 6 15:11:51 2004
--- emacs/lisp/subr.el Mon Dec 13 19:26:42 2004
***************
*** 1862,1867 ****
--- 1862,1880 ----
,@body)
(quit (setq quit-flag t) nil)))
+ (defmacro 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 nil. If BODY finishes,
+ `while-no-input' returns whatever value BODY produced."
+ (declare (debug t) (indent 0))
+ (let ((catch-sym (make-symbol "input")))
+ `(with-local-quit
+ (catch ',catch-sym
+ (let ((throw-on-input ',catch-sym))
+ (when (sit-for 0 0 t)
+ ,@body))))))
+
(defmacro combine-after-change-calls (&rest body)
"Execute BODY, but don't call the after-change functions till the end.
If BODY makes changes in the buffer, they are recorded