Here's a little patch that adds a generic function print-slot-for-emacs that can be used to customize how a slot is printed. For example if you want a particular slot which holds a number to be displayed in hex:
(defclass barclass () ((foo :initarg :foo) (bar :initarg :bar)))
(defmethod print-slot-for-emacs (class (object barclass) slot) (if (eq (swank-mop:slot-definition-name slot) 'bar) (format nil "~2,'0X" (swank-mop:slot-value-using-class class object slot))))
;;;inspect this (make-instance 'barclass :foo "foooooo" :bar 255)
Index: swank.lisp =================================================================== RCS file: /project/slime/cvsroot/slime/swank.lisp,v retrieving revision 1.490 diff -u -r1.490 swank.lisp --- swank.lisp 4 Jun 2007 16:17:17 -0000 1.490 +++ swank.lisp 29 Jun 2007 18:12:54 -0000 @@ -4779,12 +4779,18 @@ maxlen (length doc))))
+(defgeneric print-slot-for-emacs (class object slot) + (:method (class object slot) + (declare (ignore class object slot)) + nil)) + (defgeneric inspect-slot-for-emacs (class object slot) (:method (class object slot) (let ((slot-name (swank-mop:slot-definition-name slot)) (boundp (swank-mop:slot-boundp-using-class class object slot))) `(,@(if boundp - `((:value ,(swank-mop:slot-value-using-class class object slot))) + `((:value ,(swank-mop:slot-value-using-class class object slot) + ,(print-slot-for-emacs class object slot))) `("#<unbound>")) " " (:action "[set value]"