# HG changeset patch # User Andrew Innes # Date 964476331 0 # Node ID 9abea5a69fb502ef0cf02e00c28e3e99644433d7 # Parent 5c815e469b1752cd7013925434f925a22fe604b9 (timer-activate-when-idle): Add optional parameter DONT-WAIT. Update docstring. (run-with-idle-timer): Specify extra parameter to timer-activate-when-idle, so that timer will be activated immediately if Emacs is already idle. diff -r 5c815e469b17 -r 9abea5a69fb5 lisp/timer.el --- a/lisp/timer.el Mon Jul 24 22:03:34 2000 +0000 +++ b/lisp/timer.el Mon Jul 24 22:05:31 2000 +0000 @@ -183,8 +183,11 @@ nil) (error "Invalid or uninitialized timer"))) -(defun timer-activate-when-idle (timer) - "Arrange to activate TIMER whenever Emacs is next idle." +(defun timer-activate-when-idle (timer &optional dont-wait) + "Arrange to activate TIMER whenever Emacs is next idle. +If optional argument DONT-WAIT is non-nil, then enable the +timer to activate immediately, or at the right time, if Emacs +is already idle." (if (and (timerp timer) (integerp (aref timer 1)) (integerp (aref timer 2)) @@ -206,7 +209,7 @@ (if last (setcdr last (cons timer timers)) (setq timer-idle-list (cons timer timers))) - (aset timer 0 t) + (aset timer 0 (not dont-wait)) (aset timer 7 t) nil) (error "Invalid or uninitialized timer"))) @@ -384,7 +387,7 @@ (let ((timer (timer-create))) (timer-set-function timer function args) (timer-set-idle-time timer secs repeat) - (timer-activate-when-idle timer) + (timer-activate-when-idle timer t) timer)) (defun with-timeout-handler (tag)