mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-30 04:10:54 -08:00
(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.
This commit is contained in:
parent
9be978bae4
commit
7fe165d7c7
1 changed files with 7 additions and 4 deletions
|
|
@ -183,8 +183,11 @@ fire repeatedly that many seconds apart."
|
|||
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 @@ fire repeatedly that many seconds apart."
|
|||
(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 @@ This function returns a timer object which you can use in `cancel-timer'."
|
|||
(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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue