bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Zone


From: Almer S. Tigelaar
Subject: Re: Zone
Date: 17 Jun 2002 20:18:57 +0200

Dear Thien-Thi,

(sorry for the late reply)

On Wed, 2002-06-12 at 23:03, Thien-Thi Nguyen wrote:
>    I noticed an error in the "zone" package, it seems that the argument to
>    "zone-when-idle" is not in seconds but in 1/10ths of a second.
>    Reproduction:
>    try "M-x zone-when-idle 180"
>    Sit back and don't touch anything, notice that it zones out after 18
>    seconds, not 180 as the documentation suggests.
>
> i suggest trying a more recent emacs.  if the problem persists, could you
> write a small test case using run-with-idle-timer and describe its behavior
> more precisely?

After some tinkering I think i've found the problem. I've tested this with
GNU Emacs 21.2.1

The problem was that the "zone" function calls "zone-when-idle" with
"zone-idle" as argument for the seconds. This doesn't work to well when
a user chooses to invoke the "zone-when-idle" function and pass the
number of seconds to it.

What happens when doing "M-x zone-when-idle" and entering 60 seconds as
idle time is this :
(1) "zone-when-idle" sets up an idle timer which is invoked after 60
    seconds.
(2) After 60 seconds of idle time the "zone" function is actually 
    invoked.
(3) At the end of the "zone" function the "zone-when-idle" function is
    called with an argument of "zone-idle" seconds (which is still at
    the default value of "20")
(4) "zone-when-idle" sets up an idle timer which is invoked after 20
    seconds of idle time.
(5) Now, after 20 seconds of idle time the "zone" function is invoked
    again.

Obviously not good, the user would expect the idle timer to trigger
after 60 seconds, not 60 the first time and 20 all other times.

There are a couple of solutions to this problem :
(1) When using the "zone-when-idle" function also set the "zone-idle" 
    variable, like :
    (setq zone-idle 180)
    (zone-when-idle 180)
(2) Explicitely set the "zone-idle" variable in the "zone-when-idle"   
    function (use the value the user passed, the "secs" variable)
(3) Remove the call to "zone-when-idle" at the end of the "zone"
    functions, if the idle timer works correctly it should repeat the
    invocation every  "secs" seconds anyway.

Yours sincerely,

Almer S. Tigelaar




reply via email to

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