[slime-devel] Not using Slime's debugger 2

Teemu Likonen tlikonen at iki.fi
Mon Feb 6 18:24:13 UTC 2012

* Mark H. David [2012-02-06 12:52:04 -0500] wrote:

> What am I missing?

You probably didn't read my nor Helmut's recent messages too closely.
Anyway, here's the code I'm using.

;; ~/.swank.lisp

(defpackage #:personal
  (:use #:cl)
  (:export #:debugger #:*use-swank-debugger*))

(in-package #:personal)

;; This variable is used to switch betwee swank and custom debugger
;; function.
(defparameter *use-swank-debugger* nil)

(defvar *swank-debugger-orig* #'swank:swank-debugger-hook)

;; Custom "debugger" (just prints condition, restarts and error message.)
(defun debugger (condition previous)
  (declare (ignore previous))
    (let ((*print-readably* nil)
          (*print-length* 50)
          (*print-level* 5))
      (format *error-output*
              "~%; Condition: ~A~%; Restarts:  ~{~A~^ ~}~%; ~A~%"
              (type-of condition) (mapcar #'restart-name (compute-restarts))
      (invoke-restart 'abort))))

;; Redefine swank's debugger function.
(defun swank:swank-debugger-hook (condition previous)
  (if *use-swank-debugger*
      (funcall *swank-debugger-orig* condition previous)
      (funcall 'debugger condition previous)))

More information about the slime-devel mailing list