emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/timer.el,v


From: Chong Yidong
Subject: [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/timer.el,v
Date: Thu, 24 Aug 2006 23:40:02 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      06/08/24 23:40:00

Index: emacs-lisp/timer.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/timer.el,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- emacs-lisp/timer.el 20 Aug 2006 12:16:26 -0000      1.12
+++ emacs-lisp/timer.el 24 Aug 2006 23:40:00 -0000      1.13
@@ -60,14 +60,22 @@
 
 (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"))
+  (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)
+    (timer-inc-time timer secs))
   (aset timer 4 repeat)
   timer)
 
@@ -104,7 +112,7 @@
 
 (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 @@
 (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.
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]