From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: Should `cancel-timer' use `delete' instead of `delq'? Date: Tue, 05 Sep 2006 23:56:19 +0200 Message-ID: <85d5aaj7uk.fsf@lola.goethe.zz> References: <87zmdfytmw.fsf@catnip.gol.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1157493515 8119 80.91.229.2 (5 Sep 2006 21:58:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 5 Sep 2006 21:58:35 +0000 (UTC) Cc: Emacs-Devel , Drew Adams , Miles Bader Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 05 23:58:28 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GKivM-0000i3-TW for ged-emacs-devel@m.gmane.org; Tue, 05 Sep 2006 23:57:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GKivM-0000De-0T for ged-emacs-devel@m.gmane.org; Tue, 05 Sep 2006 17:57:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GKiv8-00009G-7q for emacs-devel@gnu.org; Tue, 05 Sep 2006 17:57:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GKiv7-00008D-85 for emacs-devel@gnu.org; Tue, 05 Sep 2006 17:57:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GKiv7-000089-1x for emacs-devel@gnu.org; Tue, 05 Sep 2006 17:57:25 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GKiv7-000061-Ik for emacs-devel@gnu.org; Tue, 05 Sep 2006 17:57:25 -0400 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1GKiv6-0003h1-AP; Tue, 05 Sep 2006 17:57:24 -0400 Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id EAE761C4D3A4; Tue, 5 Sep 2006 23:56:19 +0200 (CEST) Original-To: Stefan Monnier In-Reply-To: (Stefan Monnier's message of "Tue, 05 Sep 2006 11:38:50 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:59401 Archived-At: Stefan Monnier writes: >> It's almost certainly intentional that it uses delq. A timer is a >> unique entity. > >> If application code can create multiple timers and doesn't save all the >> corresponding cookies for deletion, it's obviously a bug in that >> application code. > > While I somewhat agree with Miles, I also agree with Drew that it > can lead to undesirable situations where it's very difficult to > return to a "normal" session, other than by restarting Emacs. > > I've been tempted to change timer-idle-list and timer-list so that > they use weak-pointers. I.e. if you don't hold on to your timer by > storing it in a global var or somesuch, then it'll get > cancelled/destroyed at the next GC. I think this could work if we > only do it for timers that use `repeat'. Does not sound too hot to me: after all, garbage collection happens nondeterministically, and there are valid cases for repetitive timers that will never need to be cancelled (a running clock somewhere, or a yearly birthday reminder...). It would surprise the user if his timers suddenly stopped without reason when they ran perfectly well for a while. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum