Emacs lisp:调试计时器?

Emacs lisp:调试计时器?,emacs,asynchronous,timer,elisp,Emacs,Asynchronous,Timer,Elisp,在emacs lisp中,可以通过runwithtimer和runwithasync timer命令实现一种形式的伪异步。例如,考虑以下简单的倒计时计时器: (defun -c (i) (cond ((= i 0) (error "TESTERROR")) (t (message "Countdown at %d" i) (run-with-timer 1 nil '-c (1- i))))) 运行(-c3)将显示消息 Countdown at 3 Countdown

在emacs lisp中,可以通过
runwithtimer
runwithasync timer
命令实现一种形式的伪异步。例如,考虑以下简单的倒计时计时器:

(defun -c (i)
 (cond 
  ((= i 0)  (error "TESTERROR"))
  (t
   (message "Countdown at %d" i)
   (run-with-timer 1 nil '-c (1- i)))))
运行
(-c3)
将显示消息

Countdown at 3
Countdown at 2
Countdown at 1
发出信号的错误将被忽略


在emacs lisp中是否有一些方法可以获得此类计时器的错误报告,最好是使用完整的stacktrace?

我没有观察到您在emacs 24.3.50.3中描述的行为:

(lexical-let ((countdown 3) timer)
  (defun countdown ()
    (message "countdown %d" countdown)
    (when (zerop (decf countdown))
      (cancel-timer timer)
      (error "BOOM")))
  (setq timer (run-with-timer 1 1 'countdown)))
我在回音区和
*消息中看到:

countdown 3
countdown 2
countdown 1
Entering debugger...
然后在
*回溯*
中:

Debugger entered--Lisp error: (error "BOOM")
  signal(error ("BOOM"))
  error("BOOM")
  (progn (cancel-timer (symbol-value G66502)) (error "BOOM"))
  (if (zerop (let* ((v G66503)) (set v (1- (symbol-value G66503))))) (progn (cancel-timer (symbol-value G66502)) (error "BOOM")))
  (lambda (G66502 G66503) (message "countdown %d" (symbol-value G66503)) (if (zerop (let* ((v G66503)) (set v (1- (symbol-value G66503))))) (progn (cancel-timer (symbol-value G66502)) (error "BOOM"))))(--timer-- --countdown--)
  apply((lambda (G66502 G66503) (message "countdown %d" (symbol-value G66503)) (if (zerop (let* ((v G66503)) (set v (1- (symbol-value G66503))))) (progn (cancel-timer (symbol-value G66502)) (error "BOOM")))) --timer-- --countdown-- nil)
  countdown()
  apply(countdown nil)
  byte-code("r\301\302H\303H\"\210)\301\207" [timer apply 5 6] 4)
  timer-event-handler([t 20941 51022 556644 1 countdown nil nil 176000])

正如sds指出的,这是一个bug(在我看来),几个月前我在Emacs的主干中修复了它。谢谢。。。我现在从源代码编译emacs,它现在可以工作了。为了获得stacktrace,我还必须执行
M-x toggle debug on error
。默认情况下是否启用了“错误时调试”