Mercurial > emacs
changeset 30436:9abea5a69fb5
(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.
author | Andrew Innes <andrewi@gnu.org> |
---|---|
date | Mon, 24 Jul 2000 22:05:31 +0000 |
parents | 5c815e469b17 |
children | e9b2398c24e1 |
files | lisp/timer.el |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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)