[Top][All Lists]

[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:16:49 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

address@hidden (Kim F. Storm) writes:

>>> With the latest version of current-idle-time, this now becomes:
>>>     (when (and jit-lock-stealth-buffers jit-lock-stealth-time)
>>>     ;; Call us again.
>>>      (let ((idle (current-idle-time)))
>>>        (when idle
>>>         (timer-set-idle-time jit-lock-stealth-repeat-timer idle)
>>>         (timer-inc-time jit-lock-stealth-repeat-timer delay)
>>>         (timer-activate-when-idle jit-lock-stealth-repeat-timer t)))
> It seems that reusing the idle timer is broken.
> This seems to work:
>         (let ((idle (current-idle-time)))
>           (when idle
>             (run-with-idle-timer (+ idle (max delay 0.1))
>                                     nil #'jit-lock-stealth-fontify)))

Reusing the idle timer is not broken.  Here is simple test case, which
works perfectly.

(setq my-count 0)

(defun my-test-timer ()
  (setq my-count (1+ my-count))
  (message (format "Count: %d" my-count))
  (when (< my-count 5)
    (timer-inc-time my-timer 1)
    (timer-activate-when-idle my-timer t)))

(setq my-timer (run-with-idle-timer 2 nil 'my-test-timer))

Once Emacs is idle for 2 seconds, the echo area message counts from 1
to 5 in intervals of 1 seconds.  If you comment out `timer-inc-time',
the interval becomes instantaneous, as expected.

reply via email to

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