emacs-devel
[Top][All Lists]
Advanced

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

Re: Should `cancel-timer' use `delete' instead of `delq'?


From: Stefan Monnier
Subject: Re: Should `cancel-timer' use `delete' instead of `delq'?
Date: Wed, 06 Sep 2006 10:00:44 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> Well, I think that's exactly what I used in my defvar (after having been
> bitten once), so I could henceforth re-eval it ("abnormally") without worry
> or forethought. In any case, the "traditional" way to do that is apparently
> to use `define-minor-mode'...

The traditional example I showed is not exempt from the OP.
When you re-evaluate the defvar with C-M-x, the timer var is forcefully
reset to nil, thus potentially forgetting a running timer, which then
becomes again difficult to stop.

Maybe you did realize that, but I got the feeling that you thought it didn't
suffer from this problem.

And the same thing could/would happen if you use `timer-create'.
The problem is not how you define/create your timer, but simply the fact
that if you "forget" your timer object, it'll still be active as long as
it's in the timer-list.

One way to "solve" this problem is to change C-M-x so that in the case the
variable's current value is a timer, it first cancels it, before resetting
the var.  Similarly to my "recent" patch which cancels timers when unloading
a package.


        Stefan




reply via email to

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