[slime-devel] Unicode aware SLIME on LispWorks

Chris Dean ctdean at sokitomi.com
Thu Dec 27 19:59:25 UTC 2007


I'm using a recent version (2007-12-22) of Slime with the current
version of LispWorks on Linux using GNU Emacs 22.0.50.1

How do I setup slime to allow me to interact with Unicode characters
in the repl?

I've tried setting various combinations of slime-net-coding-system,
set-language-environment, and set-default-coding-systems but everytime
I interact with a unicode character I either hang or get an error from
swank in the *inferior-lisp* buffer.

I've tried various hacks to slime and swank, and I can get everything
to work if I use flexi-streams but so far I've been unsuccessful with
an out-of-the-box solution.  

My litmus test is to evaluate (code-char 8258) in the repl.  It is
unimportant to me how that result is displayed as long as something is
displayed.

FWIW, the patch with flexi-streams I'm using is below.

Cheers,
Chris Dean


diff -u -w -r1.93 swank-lispworks.lisp
--- swank-lispworks.lisp        24 Nov 2007 08:18:59 -0000      1.93
+++ swank-lispworks.lisp        27 Dec 2007 19:53:36 -0000
@@ -67,11 +67,19 @@
 
 (defimplementation accept-connection (socket 
                                       &key external-format buffering timeout)
-  (declare (ignore buffering timeout external-format))
-  (let* ((fd (comm::get-fd-from-socket socket)))
+  (declare (ignore buffering timeout))
+  (let ((fd (comm::get-fd-from-socket socket)))
     (assert (/= fd -1))
-    (make-instance 'comm:socket-stream :socket fd :direction :io 
-                   :element-type 'base-char)))
+    (let* ((char-type (external-format:external-format-type 
+                       (or external-format :latin-1)))
+           (stream (make-instance 'comm:socket-stream :socket fd :direction :io 
+                                  :element-type (if (eq char-type 'base-char)
+                                                    'base-char
+                                                    '(unsigned-byte 8)))))
+      (if (eq char-type 'base-char)
+          stream
+          (flexi-streams:make-flexi-stream
+           stream :external-format (or external-format :latin-1)))))



More information about the slime-devel mailing list