diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2006-08-24 23:40:00 +0000 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2006-08-24 23:40:00 +0000 |
commit | 1063efe807c0195c62f2dc22bcc78c61cf25c376 (patch) | |
tree | 08f46a4c502a4fef248df2c1c36fa0167199e5a9 /lisp/emacs-lisp | |
parent | 8d8dafebb36347734c5f81f8154d0749ca16bfaf (diff) | |
download | emacs-1063efe807c0195c62f2dc22bcc78c61cf25c376.tar.gz emacs-1063efe807c0195c62f2dc22bcc78c61cf25c376.tar.bz2 emacs-1063efe807c0195c62f2dc22bcc78c61cf25c376.zip |
* emacs-lisp/timer.el (timer-set-idle-time, run-with-idle-timer):
Accept internal time format for SECS arg.
(timer-relative-time): Doc fix.
* jit-lock.el: "Stealth fontification by requeuing timers" patch,
adapted from Martin Rudalics.
(jit-lock-stealth-repeat-timer, jit-lock-stealth-buffers): New vars.
(jit-lock-mode): Create jit-lock-stealth-repeat-timer.
(jit-lock-stealth-fontify): Reschedule as a idle timer instead of
using sit-for.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/timer.el | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index ed85bc765f7..82eac50c874 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -60,14 +60,22 @@ fire repeatedly that many seconds apart." (defun timer-set-idle-time (timer secs &optional repeat) "Set the trigger idle time of TIMER to SECS. +SECS may be an integer, floating point number, or the internal +time format (HIGH LOW USECS) returned by, e.g., `current-idle-time'. If optional third argument REPEAT is non-nil, make the timer fire each time Emacs is idle for that many seconds." (or (timerp timer) (error "Invalid timer")) - (aset timer 1 0) - (aset timer 2 0) - (aset timer 3 0) - (timer-inc-time timer secs) + (if (consp secs) + (progn (aset timer 1 (car secs)) + (aset timer 2 (if (consp (cdr secs)) (car (cdr secs)) (cdr secs))) + (aset timer 3 (or (and (consp (cdr secs)) (consp (cdr (cdr secs))) + (nth 2 secs)) + 0))) + (aset timer 1 0) + (aset timer 2 0) + (aset timer 3 0) + (timer-inc-time timer secs)) (aset timer 4 repeat) timer) @@ -104,7 +112,7 @@ of SECS seconds since the epoch. SECS may be a fraction." (defun timer-relative-time (time secs &optional usecs) "Advance TIME by SECS seconds and optionally USECS microseconds. -SECS may be a fraction." +SECS may be either an integer or a floating point number." (let ((high (car time)) (low (if (consp (cdr time)) (nth 1 time) (cdr time))) (micro (if (numberp (car-safe (cdr-safe (cdr time)))) @@ -412,7 +420,8 @@ This function is for compatibility; see also `run-with-timer'." (defun run-with-idle-timer (secs repeat function &rest args) "Perform an action the next time Emacs is idle for SECS seconds. The action is to call FUNCTION with arguments ARGS. -SECS may be an integer or a floating point number. +SECS may be an integer, a floating point number, or the internal +time format (HIGH LOW USECS) returned by, e.g., `current-idle-time'. If Emacs is currently idle, and has been idle for N seconds (N < SECS), then it will call FUNCTION in SECS - N seconds from now. |