[slime-cvs] CVS slime

CVS User mevenson mevenson at common-lisp.net
Thu Jan 28 09:52:19 UTC 2010


Update of /project/slime/cvsroot/slime
In directory cl-net:/tmp/cvs-serv22368

Modified Files:
	ChangeLog swank-abcl.lisp 
Log Message:
* swank-abcl.lisp (emacs-inspect): Make inspection of Java objects
toString() results dependent on explicit user request to avoid 
potentially computationally expensive opreations.

Tidy up previous ChangeLog entry to allow the Emacs cross-reference
function to work.



--- /project/slime/cvsroot/slime/ChangeLog	2010/01/27 06:38:27	1.1972
+++ /project/slime/cvsroot/slime/ChangeLog	2010/01/28 09:52:18	1.1973
@@ -1,3 +1,9 @@
+2010-01-28  Mark Evenson  <evenson at dada.local>
+
+	* swank-abcl.lisp (emacs-inspect): Make inspection of Java objects
+	toString() results dependent on explicit user request to avoid
+	potentially computationally expensive opreations.
+
 2010-01-27  Stas Boukarev  <stassats at gmail.com>
 
 	* swank-rpc.lisp: NIL -> nil (for unusual readtable settings).
@@ -5,7 +11,7 @@
 
 2010-01-26  Mark Evenson  <evenson at dada.local>
 
-	* swank-abcl.lisp (import-to-swank-mop):  Import
+	* swank-abcl.lisp: Import
 	MOP::COMPUTE-APPLICABLE-METHODS-USING-CLASSES if it exists in the
 	ABCL implementation.
 
--- /project/slime/cvsroot/slime/swank-abcl.lisp	2010/01/26 13:29:58	1.80
+++ /project/slime/cvsroot/slime/swank-abcl.lisp	2010/01/28 09:52:19	1.81
@@ -557,11 +557,26 @@
                     slots)))
 |#
 
+
+;;; Although by convention toString() is supposed to be a
+;;; non-computationally expensive operation this isn't always the
+;;; case, so make its computation a user interaction.
+(defparameter *to-string-hashtable* (make-hash-table))
 (defmethod emacs-inspect ((o java:java-object))
-  (append 
-   (label-value-line "toString()" (java:jcall "toString" o)) 
-   (loop :for (label . value) :in (sys:inspected-parts o)
-      :appending (label-value-line label value))))
+    (let ((to-string (lambda ()
+                      (handler-case
+                          (setf (gethash o *to-string-hashtable*)
+                                         (java:jcall "toString" o))
+                        (t (e)
+                          (setf (gethash o *to-string-hashtable*)
+                                         (format nil "Could not invoke toString(): ~A"
+                                                 e)))))))
+      (append
+       (if (gethash o *to-string-hashtable*)
+           (label-value-line "toString()" (gethash o *to-string-hashtable*))
+           `((:action "[compute toString()]" ,to-string) (:newline)))
+       (loop :for (label . value) :in (sys:inspected-parts o)
+          :appending (label-value-line label value)))))
   
 ;;;; Multithreading
 





More information about the slime-cvs mailing list