all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Almer S. Tigelaar" <almer@tigelaar.dhs.org>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: Zone
Date: 17 Jun 2002 20:18:57 +0200	[thread overview]
Message-ID: <1024337958.600.7.camel@almer> (raw)
In-Reply-To: <jk660otdkj.fsf@glug.org>

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

  parent reply	other threads:[~2002-06-17 18:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-12  7:58 Zone Almer S. Tigelaar
2002-06-12 21:03 ` Zone Thien-Thi Nguyen
2002-06-13 20:39   ` Zone Jason Rumney
2002-06-13 22:46     ` Zone Richard Stallman
2002-06-17 18:18   ` Almer S. Tigelaar [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-05-08 20:32 zone A Soare
2007-05-08 21:16 ` zone Lennart Borgman (gmail)
2007-05-08 21:22 ` zone Jason Rumney
2007-05-08 21:57 ` zone Thien-Thi Nguyen
2007-05-08 22:06 ` zone Eli Zaretskii
2007-05-08 21:36 zone A Soare
2007-05-08 21:48 ` zone Taylor Venable
2007-05-08 22:06 ` zone Henrik Enberg
2007-05-08 22:08 ` zone Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1024337958.600.7.camel@almer \
    --to=almer@tigelaar.dhs.org \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.