From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Almer S. Tigelaar" Newsgroups: gmane.emacs.bugs Subject: Re: Zone Date: 17 Jun 2002 20:18:57 +0200 Sender: bug-gnu-emacs-admin@gnu.org Message-ID: <1024337958.600.7.camel@almer> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1024338071 868 127.0.0.1 (17 Jun 2002 18:21:11 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 17 Jun 2002 18:21:11 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17K17n-0000Dt-00 for ; Mon, 17 Jun 2002 20:21:11 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17K17p-0001ip-00; Mon, 17 Jun 2002 14:21:13 -0400 Original-Received: from d85070.upc-d.chello.nl ([213.46.85.70] helo=tanya.tigelaar.dhs.org) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 17K162-0001av-00 for ; Mon, 17 Jun 2002 14:19:22 -0400 Original-Received: from almer ([192.168.1.25] helo=localhost.localdomain ident=almer) by tanya.tigelaar.dhs.org with esmtp (Exim 3.12 #1 (Debian)) id 17K12R-0000Tc-00; Mon, 17 Jun 2002 20:15:39 +0200 Original-To: Thien-Thi Nguyen In-Reply-To: X-Signature: Fam. Tigelaar Errors-To: bug-gnu-emacs-admin@gnu.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.bugs:2102 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:2102 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