[slime-cvs] CVS update: slime/slime.el

Luke Gorrie lgorrie at common-lisp.net
Tue Jan 20 21:53:08 UTC 2004


Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv24704

Modified Files:
	slime.el 
Log Message:
(slime-prin1-to-string): Replacement for prin1-to-string that avoids
escaping non-ascii characters in a way that the CL reader doesn't
understand. Allows use of 8-bit characters in Lisp expressions with
Emacs in unibyte-mode.

Date: Tue Jan 20 16:53:07 2004
Author: lgorrie

Index: slime/slime.el
diff -u slime/slime.el:1.192 slime/slime.el:1.193
--- slime/slime.el:1.192	Tue Jan 20 16:06:31 2004
+++ slime/slime.el	Tue Jan 20 16:53:07 2004
@@ -873,6 +873,14 @@
   "Insert all ARGS and then add text-PROPS to the inserted text."
   (slime-propertize-region props (apply #'insert args)))
 
+(defun slime-prin1-to-string (sexp)
+  "Like `prin1-to-string' but don't octal-escape non-ascii characters.
+This is more compatible with the CL reader."
+  (with-temp-buffer
+    (let ((print-escape-nonascii nil))
+      (prin1 sexp (current-buffer))
+      (buffer-string))))
+
 
 ;;; Inferior CL Setup: compiling and connecting to Swank
 
@@ -1087,7 +1095,7 @@
   "Send a SEXP to Lisp over the socket PROC.
 This is the lowest level of communication. The sexp will be READ and
 EVAL'd by Lisp."
-  (let* ((msg (format "%S\n" sexp))
+  (let* ((msg (concat (slime-prin1-to-string sexp) "\n"))
          (string (concat (slime-net-enc3 (length msg)) msg)))
     (process-send-string proc (string-make-unibyte string))))
 
@@ -1734,7 +1742,7 @@
                                    (cons var)))
        (when (slime-busy-p)
          (error "Lisp is already busy evaluating a request."))
-       (slime-dispatch-event (list :emacs-rex (prin1-to-string ,sexp) ,package 
+       (slime-dispatch-event (list :emacs-rex (slime-prin1-to-string ,sexp) ,package 
                                    (lambda (,result)
                                      (destructure-case ,result
                                        , at continuations)))))))
@@ -1781,7 +1789,7 @@
   (when (slime-busy-p)
     (error "Busy evaluating"))
   (slime-dispatch-event
-   `(:emacs-evaluate-oneway ,(prin1-to-string sexp) ,package)))
+   `(:emacs-evaluate-oneway ,(slime-prin1-to-string sexp) ,package)))
 
 (defun slime-send (sexp)
   (slime-net-send sexp (slime-connection)))





More information about the slime-cvs mailing list