From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/12851 Path: main.gmane.org!not-for-mail From: Harald Meland Newsgroups: gmane.emacs.gnus.general Subject: Re: Idleness Date: 18 Nov 1997 03:46:02 +0100 Message-ID: References: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 X-Trace: main.gmane.org 1035152316 6033 80.91.224.250 (20 Oct 2002 22:18:36 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 22:18:36 +0000 (UTC) Cc: ding@ifi.uio.no Return-Path: Original-Received: from xemacs.org (xemacs.cs.uiuc.edu [128.174.252.16]) by altair.xemacs.org (8.8.8/8.8.8) with ESMTP id TAA20474 for ; Mon, 17 Nov 1997 19:58:59 -0800 Original-Received: from ifi.uio.no (ifi.uio.no [129.240.64.2]) by xemacs.org (8.8.5/8.8.5) with ESMTP id VAA06950 for ; Mon, 17 Nov 1997 21:59:23 -0600 (CST) Original-Received: from pat.uio.no (6089@pat.uio.no [129.240.130.16]) by ifi.uio.no (8.8.7/8.8.7/ifi0.2) with SMTP id DAA14250 for ; Tue, 18 Nov 1997 03:46:20 +0100 (MET) Original-Received: from octarine.uio.no (actually octarine.uio.no [129.240.186.25]) by pat.uio.no with SMTP (PP); Tue, 18 Nov 1997 03:46:04 +0100 Original-Received: by octarine.uio.no ; Tue, 18 Nov 1997 03:46:03 +0100 (MET) Original-To: Hrvoje Niksic In-Reply-To: Hrvoje Niksic's message of "18 Nov 1997 00:05:57 +0100" Original-Lines: 42 X-Mailer: Quassia Gnus v0.13/Emacs 20.2 Xref: main.gmane.org gmane.emacs.gnus.general:12851 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:12851 [Hrvoje Niksic] | I think that: | | * adding a new idle timer from the idle-timer callback | | is less of a hack. I wonder if it would work correctly? I just did some simple testing, and it doesn't look like it would. As I noted in my previous mail, it appears that Emacs needs to go from a non-idle state and remain idle for SECS seconds before FUNCTION is called. If you add an idle timer from the present idle timer FUNCTION, the new FUNCTION will not get called before Emacs goes non-idle and then idle again. Of course you could add a non-idle timer, but this would have to check whether Emacs has become non-idle every time it get's called, and I can't find any way of determining that -- short of the present hack in Gnus, and then we're back to square one, right? BTW, here's the code I used for my testing. Note that it will positively break if the SECS argument used in the callback is larger than the SECS argument in the separate `run-with-idle-timer' call, as that would imply removing the spurious timer before it gets called. (defvar harald-test-idle-timer-mother-timer nil) (defvar harald-test-idle-timer-spurious-timer nil) (defun harald-test-idle-timer-function () (when harald-test-idle-timer-spurious-timer (cancel-timer harald-test-idle-timer-spurious-timer)) (setq harald-test-idle-timer-spurious-timer (run-with-idle-timer 2 t 'harald-test-idle-timer-function)) (message (current-time-string))) (setq harald-test-idle-timer-mother-timer (run-with-idle-timer 5 t 'harald-test-idle-timer-function)) -- Harald