Subject: bug#14156: 24.3.50; Timer firing after being canceled

From: Stefan Monnier <[email-masked]>
Date: Sun, 07 Apr 2013 22:09:01 -0400

> If you call `start-the-timer', you get the message "Why is this ever
> reached?" over and over.  This obviously should not happen.

As mentioned elsewhere, this seems to be due to patch

   revno: 110138
   fixes bugs: http://debbugs.gnu.org/12447 http://debbugs.gnu.org/12326

I installed the patch below which seems to fix it.

        Stefan

=== modified file 'lisp/emacs-lisp/timer.el'
--- lisp/emacs-lisp/timer.el	2013-01-13 01:23:48 +0000
+++ lisp/emacs-lisp/timer.el	2013-04-08 01:53:53 +0000
@@ -314,7 +314,11 @@
               (save-current-buffer
                 (apply (timer--function timer) (timer--args timer)))
 	    (error (message "Error in timer: %S" err)))
-	  (if retrigger
+	  (when (and retrigger
+                     ;; If the timer's been canceled, don't "retrigger" it
+                     ;; since it might still be in the copy of timer-list kept
+                     ;; by keyboard.c:timer_check (bug#14156).
+                     (memq timer timer-list))
 	      (setf (timer--triggered timer) nil)))
       (error "Bogus timer event"))))