[slime-cvs] CVS slime

alendvai alendvai at common-lisp.net
Wed Dec 20 14:26:47 UTC 2006


Update of /project/slime/cvsroot/slime
In directory clnet:/tmp/cvs-serv15843

Modified Files:
	swank.lisp 
Log Message:
Added present-in-emacs that prints a presentation of the given object in the repl


--- /project/slime/cvsroot/slime/swank.lisp	2006/12/20 14:24:02	1.438
+++ /project/slime/cvsroot/slime/swank.lisp	2006/12/20 14:26:46	1.439
@@ -1218,6 +1218,27 @@
              ((:ok value) value)
              ((:abort) (abort)))))))
 
+(defun present-in-emacs (value-or-values &key (separated-by " "))
+  "Present VALUE in the Emacs repl buffer of the current thread."
+  (unless (consp value-or-values)
+    (setf value-or-values (list value-or-values)))
+  (flet ((present (value)
+           (if (stringp value)
+               (send-to-emacs `(:write-string ,value))
+               (let ((id (save-presented-object value)))
+                 (send-to-emacs `(:presentation-start ,id))
+                 (send-to-emacs `(:write-string ,(prin1-to-string value)))
+                 (send-to-emacs `(:presentation-end ,id))))))
+    (map nil (let ((first-time-p t))
+               (lambda (value)
+                 (when (and (not first-time-p)
+                            separated-by)
+                   (present separated-by))
+                 (present value)
+                 (setf first-time-p nil)))
+         value-or-values))
+  (values))
+
 (defvar *swank-wire-protocol-version* nil
   "The version of the swank/slime communication protocol.")
 




More information about the slime-cvs mailing list