1275 |
@section Timers for Delayed Execution |
@section Timers for Delayed Execution |
1276 |
@cindex timer |
@cindex timer |
1277 |
|
|
1278 |
You can set up a @dfn{timer} to call a function at a specified future time or |
You can set up a @dfn{timer} to call a function at a specified |
1279 |
after a certain length of idleness. |
future time or after a certain length of idleness. |
1280 |
|
|
1281 |
Emacs cannot run timers at any arbitrary point in a Lisp program; it |
Emacs cannot run timers at any arbitrary point in a Lisp program; it |
1282 |
can run them only when Emacs could accept output from a subprocess: |
can run them only when Emacs could accept output from a subprocess: |
1285 |
timer's execution may be delayed if Emacs is busy. However, the time of |
timer's execution may be delayed if Emacs is busy. However, the time of |
1286 |
execution is very precise if Emacs is idle. |
execution is very precise if Emacs is idle. |
1287 |
|
|
1288 |
|
Emacs binds @code{inhibit-quit} to @code{t} before calling the timer |
1289 |
|
function, because quitting out of many timer functions can leave |
1290 |
|
things in an inconsistent state. This is normally unproblematical |
1291 |
|
because most timer functions don't do a lot of work. Indeed, for a |
1292 |
|
timer to calls a function that takes substantial time to run is likely |
1293 |
|
to be annoying. |
1294 |
|
|
1295 |
@defun run-at-time time repeat function &rest args |
@defun run-at-time time repeat function &rest args |
1296 |
This function arranges to call @var{function} with arguments @var{args} |
This function arranges to call @var{function} with arguments @var{args} |
1297 |
at time @var{time}. The argument @var{function} is a function to call |
at time @var{time}. The argument @var{function} is a function to call |