emacs-devel
[Top][All Lists]
Advanced

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

Re: jit-lock timer etc.


From: Chong Yidong
Subject: Re: jit-lock timer etc.
Date: Thu, 24 Aug 2006 10:47:35 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

address@hidden (Kim F. Storm) writes:

>> Shall I fix current-idle-time to return a float or nil?

A more correct course of action is to leave current-idle-time the way
it is, and extend timer-set-idle-time to accept the internal time
format, analogously to timer-set-time.  Then we can submit the value
of current-idle-time directly to timer-set-idle-time.

*** emacs/lisp/emacs-lisp/timer.el.~1.12.~      2006-08-20 09:55:37.000000000 
-0400
--- emacs/lisp/emacs-lisp/timer.el      2006-08-24 10:45:48.000000000 -0400
***************
*** 60,73 ****
  
  (defun timer-set-idle-time (timer secs &optional repeat)
    "Set the trigger idle time of TIMER to SECS.
  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)
    (aset timer 4 repeat)
    timer)
  
--- 60,81 ----
  
  (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-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 time)) (car (cdr time)) (cdr time)))
!            (aset timer 3 (or (and (consp (cdr time)) (consp (cdr (cdr time)))
!                                   (nth 2 time))
!                              0)))
!     (aset timer 1 0)
!     (aset timer 2 0)
!     (aset timer 3 0)
!     (timer-inc-time timer secs))
    (aset timer 4 repeat)
    timer)
  
***************
*** 104,110 ****
  
  (defun timer-relative-time (time secs &optional usecs)
    "Advance TIME by SECS seconds and optionally USECS microseconds.
! SECS may be a fraction."
    (let ((high (car time))
        (low (if (consp (cdr time)) (nth 1 time) (cdr time)))
        (micro (if (numberp (car-safe (cdr-safe (cdr time))))
--- 112,118 ----
  
  (defun timer-relative-time (time secs &optional usecs)
    "Advance TIME by SECS seconds and optionally USECS microseconds.
! 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))))




reply via email to

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