changeset 71961:f2a11961b9d8

* subr.el (sit-for): Just sleep-for if noninteractive.
author Chong Yidong <cyd@stupidchicken.com>
date Tue, 18 Jul 2006 01:34:48 +0000
parents 1df664b7bac5
children 649d10148b82
files lisp/ChangeLog lisp/subr.el
diffstat 2 files changed, 21 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Jul 18 00:11:20 2006 +0000
+++ b/lisp/ChangeLog	Tue Jul 18 01:34:48 2006 +0000
@@ -1,3 +1,7 @@
+2006-07-17  Chong Yidong  <cyd@stupidchicken.com>
+
+	* subr.el (sit-for): Just sleep-for if noninteractive.
+
 2006-07-17  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* emacs-lisp/autoload.el (make-autoload): Use new arg.
--- a/lisp/subr.el	Tue Jul 18 00:11:20 2006 +0000
+++ b/lisp/subr.el	Tue Jul 18 01:34:48 2006 +0000
@@ -1721,22 +1721,23 @@
   (when (or obsolete (numberp nodisp))
     (setq seconds (+ seconds (* 1e-3 nodisp)))
     (setq nodisp obsolete))
-  (unless nodisp
-    (redisplay))
-  (or (<= seconds 0)
-      (let ((timer (timer-create))
-	    (echo-keystrokes 0))
-      	(if (catch 'sit-for-timeout
-      	      (timer-set-time timer (timer-relative-time
-				     (current-time) seconds))
-      	      (timer-set-function timer 'with-timeout-handler
-				  '(sit-for-timeout))
-      	      (timer-activate timer)
-	      (push (read-event) unread-command-events)
-      	      nil)
-      	    t
-      	  (cancel-timer timer)
-      	  nil))))
+  (if noninteractive
+      (progn (sleep-for seconds) t)
+    (unless nodisp (redisplay))
+    (or (<= seconds 0)
+	(let ((timer (timer-create))
+	      (echo-keystrokes 0))
+	  (if (catch 'sit-for-timeout
+		(timer-set-time timer (timer-relative-time
+				       (current-time) seconds))
+		(timer-set-function timer 'with-timeout-handler
+				    '(sit-for-timeout))
+		(timer-activate timer)
+		(push (read-event) unread-command-events)
+		nil)
+	      t
+	    (cancel-timer timer)
+	    nil)))))
 
 ;;; Atomic change groups.