[slime-devel] alternative SLIME-DEBUGGER-HOOK

Madhu enometh at meer.net
Mon Aug 25 08:34:12 UTC 2008


The new SLIME debugger always reports a "Use Default Debugger" restart
as restart 0.  This is confusing to my muscle memory which has been
trained to 0 for the first restart expected from the lisp program
being evaluated.  Also, almost always, I never wish to invoke the
native debugger from [or vice versa for which I set set
swank:*global-debugger* to nil when my lisp is running outside Emacs
or has its own IDE.]

If nobody is using this option, or it was introduced for debugging
slime, it may be better to turn it off.

An `invoke native debugger' restart may be useful in the case where
invoke-slime-debugger signals an error.  That code is more complex.
The following patch introducing a global, is ugly. 
--
Madhu


diff --git a/swank.lisp b/swank.lisp
index 058663c..450ad6b 100644
--- a/swank.lisp
+++ b/swank.lisp
@@ -2065,14 +2065,21 @@ after Emacs causes a restart to be invoked."
            (with-connection ((default-connection))
              (debug-in-emacs condition))))))
 
+(defvar *swank-default-debugger-restart* nil)
+
 (defun swank-debugger-hook (condition hook)
   "Debugger function for binding *DEBUGGER-HOOK*."
   (declare (ignore hook))
   (restart-case 
       (call-with-debugger-hook 
-       #'swank-debugger-hook (lambda () (invoke-slime-debugger condition)))
+         #'swank-debugger-hook
+         (lambda () (invoke-slime-debugger condition)))
     (default-debugger (&optional v)
-      :report "Use default debugger." (declare (ignore v))
+      :report "Use default debugger."
+      :test (lambda (c)
+              (declare (ignore c))
+              *swank-default-debugger-restart*)
+      (declare (ignore v))
       (invoke-default-debugger condition))))
 
 (defun invoke-default-debugger (condition)



More information about the slime-devel mailing list