Mercurial > emacs
comparison lisp/emacs-lisp/timer.el @ 92948:73a01bf5cb80
* faces.el (xw-defined-colors):
* simple.el (widget-convert, shell-mode): Declare as functions
instead of autoloading.
* abbrev.el:
* button.el:
* cus-face.el:
* ediff-hook.el:
* emacs-lisp/backquote.el:
* emacs-lisp/timer.el:
* facemenu.el:
* faces.el:
* menu-bar.el:
* simple.el:
* subr.el:
* textmodes/fill.el:
* textmodes/paragraphs.el: Remove autoloads, redundant when the
files are preloaded.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Fri, 14 Mar 2008 17:42:18 +0000 |
parents | 107ccd98fa12 |
children | f969e238af3c |
comparison
equal
deleted
inserted
replaced
92947:04e711bb2db2 | 92948:73a01bf5cb80 |
---|---|
249 (aset timer 0 (not dont-wait)) | 249 (aset timer 0 (not dont-wait)) |
250 (aset timer 7 t) | 250 (aset timer 7 t) |
251 nil) | 251 nil) |
252 (error "Invalid or uninitialized timer"))) | 252 (error "Invalid or uninitialized timer"))) |
253 | 253 |
254 ;;;###autoload | |
255 (defalias 'disable-timeout 'cancel-timer) | 254 (defalias 'disable-timeout 'cancel-timer) |
256 ;;;###autoload | 255 |
257 (defun cancel-timer (timer) | 256 (defun cancel-timer (timer) |
258 "Remove TIMER from the list of active timers." | 257 "Remove TIMER from the list of active timers." |
259 (or (timerp timer) | 258 (or (timerp timer) |
260 (error "Invalid timer")) | 259 (error "Invalid timer")) |
261 (setq timer-list (delq timer timer-list)) | 260 (setq timer-list (delq timer timer-list)) |
272 (setq timer-list (delq timer timer-list))) | 271 (setq timer-list (delq timer timer-list))) |
273 (if cell2 | 272 (if cell2 |
274 (setq timer-idle-list (delq timer timer-idle-list))) | 273 (setq timer-idle-list (delq timer timer-idle-list))) |
275 (or cell1 cell2))) | 274 (or cell1 cell2))) |
276 | 275 |
277 ;;;###autoload | |
278 (defun cancel-function-timers (function) | 276 (defun cancel-function-timers (function) |
279 "Cancel all timers which would run FUNCTION. | 277 "Cancel all timers which would run FUNCTION. |
280 This affects ordinary timers such as are scheduled by `run-at-time', | 278 This affects ordinary timers such as are scheduled by `run-at-time', |
281 and idle timers such as are scheduled by `run-with-idle-timer'." | 279 and idle timers such as are scheduled by `run-with-idle-timer'." |
282 (interactive "aCancel timers of function: ") | 280 (interactive "aCancel timers of function: ") |
357 (and (listp event) (eq (car event) 'timer-event))) | 355 (and (listp event) (eq (car event) 'timer-event))) |
358 | 356 |
359 | 357 |
360 (declare-function diary-entry-time "diary-lib" (s)) | 358 (declare-function diary-entry-time "diary-lib" (s)) |
361 | 359 |
362 ;;;###autoload | |
363 (defun run-at-time (time repeat function &rest args) | 360 (defun run-at-time (time repeat function &rest args) |
364 "Perform an action at time TIME. | 361 "Perform an action at time TIME. |
365 Repeat the action every REPEAT seconds, if REPEAT is non-nil. | 362 Repeat the action every REPEAT seconds, if REPEAT is non-nil. |
366 TIME should be one of: a string giving an absolute time like | 363 TIME should be one of: a string giving an absolute time like |
367 \"11:23pm\" (the acceptable formats are those recognized by | 364 \"11:23pm\" (the acceptable formats are those recognized by |
419 (timer-set-time timer time repeat) | 416 (timer-set-time timer time repeat) |
420 (timer-set-function timer function args) | 417 (timer-set-function timer function args) |
421 (timer-activate timer) | 418 (timer-activate timer) |
422 timer)) | 419 timer)) |
423 | 420 |
424 ;;;###autoload | |
425 (defun run-with-timer (secs repeat function &rest args) | 421 (defun run-with-timer (secs repeat function &rest args) |
426 "Perform an action after a delay of SECS seconds. | 422 "Perform an action after a delay of SECS seconds. |
427 Repeat the action every REPEAT seconds, if REPEAT is non-nil. | 423 Repeat the action every REPEAT seconds, if REPEAT is non-nil. |
428 SECS and REPEAT may be integers or floating point numbers. | 424 SECS and REPEAT may be integers or floating point numbers. |
429 The action is to call FUNCTION with arguments ARGS. | 425 The action is to call FUNCTION with arguments ARGS. |
430 | 426 |
431 This function returns a timer object which you can use in `cancel-timer'." | 427 This function returns a timer object which you can use in `cancel-timer'." |
432 (interactive "sRun after delay (seconds): \nNRepeat interval: \naFunction: ") | 428 (interactive "sRun after delay (seconds): \nNRepeat interval: \naFunction: ") |
433 (apply 'run-at-time secs repeat function args)) | 429 (apply 'run-at-time secs repeat function args)) |
434 | 430 |
435 ;;;###autoload | |
436 (defun add-timeout (secs function object &optional repeat) | 431 (defun add-timeout (secs function object &optional repeat) |
437 "Add a timer to run SECS seconds from now, to call FUNCTION on OBJECT. | 432 "Add a timer to run SECS seconds from now, to call FUNCTION on OBJECT. |
438 If REPEAT is non-nil, repeat the timer every REPEAT seconds. | 433 If REPEAT is non-nil, repeat the timer every REPEAT seconds. |
439 This function is for compatibility; see also `run-with-timer'." | 434 This function is for compatibility; see also `run-with-timer'." |
440 (run-with-timer secs repeat function object)) | 435 (run-with-timer secs repeat function object)) |
441 | 436 |
442 ;;;###autoload | |
443 (defun run-with-idle-timer (secs repeat function &rest args) | 437 (defun run-with-idle-timer (secs repeat function &rest args) |
444 "Perform an action the next time Emacs is idle for SECS seconds. | 438 "Perform an action the next time Emacs is idle for SECS seconds. |
445 The action is to call FUNCTION with arguments ARGS. | 439 The action is to call FUNCTION with arguments ARGS. |
446 SECS may be an integer, a floating point number, or the internal | 440 SECS may be an integer, a floating point number, or the internal |
447 time format (HIGH LOW USECS) returned by, e.g., `current-idle-time'. | 441 time format (HIGH LOW USECS) returned by, e.g., `current-idle-time'. |
464 | 458 |
465 (defun with-timeout-handler (tag) | 459 (defun with-timeout-handler (tag) |
466 "This is the timer function used for the timer made by `with-timeout'." | 460 "This is the timer function used for the timer made by `with-timeout'." |
467 (throw tag 'timeout)) | 461 (throw tag 'timeout)) |
468 | 462 |
469 ;;;###autoload (put 'with-timeout 'lisp-indent-function 1) | 463 (put 'with-timeout 'lisp-indent-function 1) |
470 | 464 |
471 (defvar with-timeout-timers nil | 465 (defvar with-timeout-timers nil |
472 "List of all timers used by currently pending `with-timeout' calls.") | 466 "List of all timers used by currently pending `with-timeout' calls.") |
473 | 467 |
474 ;;;###autoload | |
475 (defmacro with-timeout (list &rest body) | 468 (defmacro with-timeout (list &rest body) |
476 "Run BODY, but if it doesn't finish in SECONDS seconds, give up. | 469 "Run BODY, but if it doesn't finish in SECONDS seconds, give up. |
477 If we give up, we run the TIMEOUT-FORMS and return the value of the last one. | 470 If we give up, we run the TIMEOUT-FORMS and return the value of the last one. |
478 The timeout is checked whenever Emacs waits for some kind of external | 471 The timeout is checked whenever Emacs waits for some kind of external |
479 event (such as keyboard input, input from subprocesses, or a certain time); | 472 event (such as keyboard input, input from subprocesses, or a certain time); |