problems with timers?

Fabrice Popineau Fabrice.Popineau at supelec.fr
Fri Feb 4 03:15:15 EST 2005


>>>>>> "Fabrice" == Fabrice Popineau <Fabrice.Popineau at supelec.fr>
>>>>>> writes:
Fabrice>  The timer is complaining that nothing is catching his timeout.

Fabrice>  Did I miss something?

> Possibly; there was some discussion of that function a few weeks back
> on xemacs-beta, and there has also been some discussion of dealing
> with zero-interval timeouts more recently.  Dunno if anything was
> done.

I saw the fix about the zero interval timeouts, but  it doesn't seem to be
the  problem. Apprently, the logic  behind with-timeout is flawed or I'm
misusing it. The way it is written in timer-funcs.el, the timer won't be
deleted  if the job  inside completes. My guess  is that both last forms
should be outside the (when (catch ... ) ... ), ie:

--- timer-funcs.el      2005-02-04 09:08:22.000000000 +0100
+++ timer-funcs.el  2005-01-25 11:25:10.000000000 +0100
@@ -188,9 +188,9 @@
                                    ,seconds nil nil t with-timeout-tag))
                (setq with-timeout-value (progn , at body))
                nil))
-       , at timeout-forms)
-      (delete-itimer with-timeout-timer)
-      with-timeout-value))))
+           , at timeout-forms
+           (delete-itimer with-timeout-timer)
+           with-timeout-value))))

 ;;;###autoload
 (defun y-or-n-p-with-timeout (prompt seconds default-value)

My test function works much better:

(global-set-key [(control c) (control a)]
  '(lambda ()
     (interactive)
     (if
	 (with-timeout (4 nil) (y-or-n-p "Do you really want to exit Emacs ? "))
	 (message "Exited")
     (message ""))))

Fabrice




More information about the XEmacs-Beta mailing list