Permalink
Browse files

Make ELC inspection better; should be able to handle all builtin type…

…s and CLOS objects now.
  • Loading branch information...
Geo Carncross
Geo Carncross committed Jan 19, 2008
1 parent cd481e0 commit 6eb426dbcafcdbc1dac0c45cfed15aa263f289b0
Showing with 52 additions and 0 deletions.
  1. +5 −0 ChangeLog
  2. +47 −0 swank-ecl.lisp
View
@@ -1,3 +1,8 @@
+2008-01-19 Geo Carncross <geocar@gmail.com>
+
+ * swank-ecl.lisp (inspect-for-emacs): Make ECL inspection better;
+ should be able to handle all builtin types and CLOS objects now.
+
2008-01-17 Nikodemus Siivola <nikodemus@random-state.net>
* swank-sbcl.lisp (sbcl-source-file-p): When a buffer is not
View
@@ -254,6 +254,53 @@
(defimplementation make-default-inspector ()
(make-instance 'ecl-inspector))
+(defmethod inspect-for-emacs ((o t) (inspector backend-inspector))
+ ; ecl clos support leaves some to be desired
+ (cond
+ ((streamp o)
+ (values
+ (format nil "~S is an ordinary stream" o)
+ (append
+ (list
+ "Open for "
+ (cond
+ ((ignore-errors (interactive-stream-p o)) "Interactive")
+ ((and (input-stream-p o) (output-stream-p o)) "Input and output")
+ ((input-stream-p o) "Input")
+ ((output-stream-p o) "Output"))
+ `(:newline) `(:newline))
+ (label-value-line*
+ ("Element type" (stream-element-type o))
+ ("External format" (stream-external-format o)))
+ (ignore-errors (label-value-line*
+ ("Broadcast streams" (broadcast-stream-streams o))))
+ (ignore-errors (label-value-line*
+ ("Concatenated streams" (concatenated-stream-streams o))))
+ (ignore-errors (label-value-line*
+ ("Echo input stream" (echo-stream-input-stream o))))
+ (ignore-errors (label-value-line*
+ ("Echo output stream" (echo-stream-output-stream o))))
+ (ignore-errors (label-value-line*
+ ("Output String" (get-output-stream-string o))))
+ (ignore-errors (label-value-line*
+ ("Synonym symbol" (synonym-stream-symbol o))))
+ (ignore-errors (label-value-line*
+ ("Input stream" (two-way-stream-input-stream o))))
+ (ignore-errors (label-value-line*
+ ("Output stream" (two-way-stream-output-stream o)))))))
+ (t
+ (let* ((cl (si:instance-class o))
+ (slots (clos:class-slots cl)))
+ (values (format nil "~S is an instance of class ~A"
+ o (clos::class-name cl))
+ (loop for x in slots append
+ (let* ((name (clos:slot-definition-name x))
+ (value (clos::slot-value o name)))
+ (list
+ (format nil "~S: " name)
+ `(:value ,value)
+ `(:newline)))))))))
+
;;;; Definitions
(defimplementation find-definitions (name) nil)

0 comments on commit 6eb426d

Please sign in to comment.