Hi all,
I'm running a threaded SBCL version 1.0.30 with SLIME version 2009-08-19 in GNU Emacs verison 22.2.1.
Non-ASCII characters break the connection to the REPL:
CL-USER> "ğ" "ğ"
The REPL is hung at this point. When I hit RET, the *inferior-lisp* buffer is flooded with text and the minibuffer reports:
Lisp connection closed unexpectedly: connection broken by remote peer
Relevant content of *inferior-lisp* buffer attached.
Any suggestions as to how to solve/debug this problem much appreciated.
Regards,
Sebastian
Sebastian Tennant <sebyte <at> smolny.plus.com> writes:
Hi all,
I'm running a threaded SBCL version 1.0.30 with SLIME version 2009-08-19 in GNU Emacs verison 22.2.1.
Non-ASCII characters break the connection to the REPL:
CL-USER> "ğ" "ğ"
The REPL is hung at this point.
Check to see whether you have set the slime connection to utf8. You should have something like this is your .emacs file:
(defun start-slime () (interactive) (setq slime-net-coding-system 'utf-8-unix) (slime-connect "127.0.0.1" 4005)) Of course the parameters shown above may change based on your setup.
http://common-lisp.net/project/slime/doc/html/Emacs_002dside-customization.h...
Quoth vanekl vanek@acd.net:
Non-ASCII characters break the connection to the REPL:
Check to see whether you have set the slime connection to utf8. You should have something like this is your .emacs file:
(defun start-slime () (interactive) (setq slime-net-coding-system 'utf-8-unix) (slime-connect "127.0.0.1" 4005))
Thanks for such a quick response.
I use an eval-after-load form:
(eval-after-load "slime" '(progn (global-set-key "\C-cs" 'slime-selector) (setq slime-net-coding-system 'utf-8-unix) ))
Unfortunately, setting slime-net-coding-system makes no difference:
CL-USER> "ğ" "ğ" ;; hung
-|*inferior-lisp*|-
wait-for-event: (COMMON-LISP:OR (:EMACS-REX . SWANK::_) (:EMACS-CHANNEL-SEND . SWANK::_)) NIL READ: "(:emacs-rex (swank:listener-eval "\"\x00C4\x009F\" ") "COMMON-LISP-USER" :repl-thread 5)" dispatch-event: (:EMACS-REX (SWANK:LISTENER-EVAL ""\x00C4\x009F" ") "COMMON-LISP-USER" :REPL-THREAD 5) send-event: #<SB-THREAD:THREAD "repl-thread" RUNNING {B1B2DB9}> (:EMACS-REX (SWANK:LISTENER-EVAL ""\x00C4\x009F" ") "COMMON-LISP-USER" 5) wait-for-event: (COMMON-LISP:OR (:EMACS-REX . SWANK::_) (:EMACS-CHANNEL-SEND . SWANK::_)) NIL dispatch-event: (:WRITE-STRING ""\x00C4\x009F" " :REPL-RESULT) WRITE: (:write-string ""\x00C4\x009F" " :repl-result) dispatch-event: (:RETURN #<SB-THREAD:THREAD "repl-thread" RUNNING {B1B2DB9}> (:OK NIL) 5) WRITE: (:return (:ok nil) 5) READ: "9(:e" dispatch-event: 9 close-connection: The value 9 is not of type COMMON-LISP:LIST. ... ;; Event history end. ;; Backtrace: (0 ((LAMBDA (SWANK-BACKEND::DEBUGGER-LOOP-FN)) #<FUNCTION (LAMBDA #) {99DAC1D}>)) (1 (SWANK::SAFE-BACKTRACE)) (2 ((FLET #:LAMBDA1493) #<TYPE-ERROR {B7F09C1}>)) (3 (SIGNAL #<TYPE-ERROR {B7F09C1}>)[:EXTERNAL]) (4 (ERROR TYPE-ERROR)[:EXTERNAL]) (5 (SB-KERNEL::OBJECT-NOT-LIST-ERROR-HANDLER #<unavailable argument> #.(SB-SYS:INT-SAP #XB712FF48) #<SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #XB712FC1C :TYPE (* (STRUCT SB-VM::OS-CONTEXT-T-STRUCT))> (144))) (6 (SB-KERNEL:INTERNAL-ERROR #.(SB-SYS:INT-SAP #XB712FC1C) #<unavailable argument>)) (7 ("foreign function: #x8066F7B")) (8 ("foreign function: #x8052EC8")) (9 ("foreign function: #x805882E")) (10 ("foreign function: #x805672B")) (11 (SWANK::DISPATCH-EVENT 9)) (12 (SWANK::DISPATCH-LOOP #<SWANK::CONNECTION {AE7CBC1}>)) (13 (SWANK::CONTROL-THREAD #<SWANK::CONNECTION {AE7CBC1}>)) (14 ((FLET #:WITHOUT-INTERRUPTS-BODY-[BLOCK375]380))) (15 ((FLET SB-THREAD::WITH-MUTEX-THUNK))) (16 ((FLET #:WITHOUT-INTERRUPTS-BODY-[CALL-WITH-MUTEX]267))) (17 (SB-THREAD::CALL-WITH-MUTEX ..)) (18 ((LAMBDA ()))) (19 ("foreign function: #x8066F7B")) (20 ("foreign function: #x8052E4D")) (21 ("foreign function: #x805E060")) (22 ("foreign function: #xB7FC7F3B")) ;; Connection to Emacs lost. [ ;; condition: The value 9 is not of type LIST. ;; type: TYPE-ERROR ;; encoding: NIL style: :SPAWN dedicated: NIL]
Regards,
Sebastian
Sebastian Tennant <sebyte <at> smolny.plus.com> writes:
Quoth vanekl <vanek <at> acd.net>:
Non-ASCII characters break the connection to the REPL:
Check to see whether you have set the slime connection to utf8. You should have something like this is your .emacs file:
(defun start-slime () (interactive) (setq slime-net-coding-system 'utf-8-unix) (slime-connect "127.0.0.1" 4005))
Thanks for such a quick response.
I use an eval-after-load form:
(eval-after-load "slime" '(progn (global-set-key "\C-cs" 'slime-selector) (setq slime-net-coding-system 'utf-8-unix) ))
Unfortunately, setting slime-net-coding-system makes no difference:
CL-USER> "ğ" "ğ" ;; hung
Did you check your emacs available coding systems: C-x <RTN> f <TAB>
Scroll down to the bottom to make sure utf-8-unix is supported on your system.
What is LANG set to? (env var)
Do you have these problems locally when using sbcl?
When you list coding systems (M-x list-coding-systems) do you see:
The supported Emacs character sets are: ascii eight-bit-control eight-bit-graphic latin-iso8859-1 mule-unicode-0100-24ff mule-unicode-2500-33ff mule-unicode-e000-ffff
What coding system do you use when you start swank? (swank:create-server :port 4005 :dont-close t :coding-system "utf-8-unix")?
Quoth vanekl vanek@acd.net:
Sebastian Tennant <sebyte <at> smolny.plus.com> writes:
Quoth vanekl <vanek <at> acd.net>:
Non-ASCII characters break the connection to the REPL:
Check to see whether you have set the slime connection to utf8. You should have something like this is your .emacs file:
(defun start-slime () (interactive) (setq slime-net-coding-system 'utf-8-unix) (slime-connect "127.0.0.1" 4005))
Thanks for such a quick response.
I use an eval-after-load form:
(eval-after-load "slime" '(progn (global-set-key "\C-cs" 'slime-selector) (setq slime-net-coding-system 'utf-8-unix) ))
Unfortunately, setting slime-net-coding-system makes no difference:
CL-USER> "ğ" "ğ" ;; hung
Did you check your emacs available coding systems:
utf-8-unix is in the list:
[...] utf-7-mac utf-7-unix utf-8 utf-8-dos utf-8-mac utf-8-unix [...]
What is LANG set to? (env var)
(getenv "LANG") => en_GB.UTF-8
Do you have these problems locally when using sbcl?
No. If I run 'sbcl' in a shell buffer there's no problem at all.
When you list coding systems (M-x list-coding-systems) do you see:
The supported Emacs character sets are: ascii eight-bit-control eight-bit-graphic latin-iso8859-1 mule-unicode-0100-24ff mule-unicode-2500-33ff mule-unicode-e000-ffff
No not quite. I get this:
#################################################### # List of coding systems in the following format: # MNEMONIC-LETTER -- CODING-SYSTEM-NAME # DOC-STRING u -- mule-utf-8 (alias: utf-8) [...]
#################################################### # The following coding systems are not yet loaded. # #################################################### utf-7-mac utf-7-dos utf-7-unix utf-7 [...]
My mode line reads 'uuu' but, perhaps significantly, utf-8-unix isn't in either section of the above list.
What coding system do you use when you start swank? (swank:create-server :port 4005 :dont-close t :coding-system "utf-8-unix")?
I don't have a form like that in my configuration. My .emacs requires 'slime-autoloads which triggers this form:
(eval-after-load "slime-autoloads" '(progn (setq slime-lisp-implementations '((sbcl ("sbcl" "--core" "/usr/local/lib/sbcl/sbcl.core-with-swank") :init (lambda (port-file _) (format "(swank:start-server %S)\n" port-file)) :coding-system utf-8-unix))) (slime-setup '(slime-repl slime-scratch slime-asdf slime-editing-commands slime-references slime-highlight-edits))))
I'll try it without a custom core and get back to you.
Regards,
Sebastian
* Sebastian Tennant [2009-08-29 14:23+0200] writes:
;; Connection to Emacs lost. [ ;; condition: The value 9 is not of type LIST. ;; type: TYPE-ERROR ;; encoding: NIL style: :SPAWN dedicated: NIL]
This looks suspicious: the encoding is NIL, i.e. the default encoding. Most likely something went wrong during initialization. The first line in the *inferior-lisp* buffer contains the initial form that Emacs sends to start up a Swank server. That line should mention the proper encoding.
Helmut
Quoth Helmut Eller heller@common-lisp.net:
- Sebastian Tennant [2009-08-29 14:23+0200] writes:
;; Connection to Emacs lost. [ ;; condition: The value 9 is not of type LIST. ;; type: TYPE-ERROR ;; encoding: NIL style: :SPAWN dedicated: NIL]
This looks suspicious: the encoding is NIL, i.e. the default encoding. Most likely something went wrong during initialization. The first line in the *inferior-lisp* buffer contains the initial form that Emacs sends to start up a Swank server. That line should mention the proper encoding.
It reads:
(swank:start-server "/tmp/slime.10748")
so no mention of coding system there. I'm using a custom core though.
I followed the 'maximum speed-up' instructions in:
(info "(slime) Loading Swank faster")
to the letter in order to build it.
I'm about to try it without the custom core and I'll get back to the list.
Regards,
Sebastian
Quoth Sebastian Tennant sebyte@smolny.plus.com:
Non-ASCII characters break the connection to the REPL:
I can confirm that if I don't use sbcl.core-with-swank the problem doesn't occur.
So, could something be amiss in swank-loader.lisp, or lacking in the instructions perhaps:
The steps to execute are:
shell$ sbcl * (load ".../slime/swank-loader.lisp") * (swank-loader:dump-image "sbcl.core-with-swank")
Then add this to your `.emacs':
(setq slime-lisp-implementations '((sbcl ("sbcl" "--core" "sbcl.core-with-swank") :init (lambda (port-file _) (format "(swank:start-server %S)\n" port-file)))))
I added an extra keyword argument to my 'sbcl' lisp implementation:
:coding-system utf-8-unix
but removing it does not resolve the problem.
Regards,
Sebastian
Sebastian Tennant <sebyte <at> smolny.plus.com> writes:
I added an extra keyword argument to my 'sbcl' lisp implementation:
:coding-system utf-8-unix
but removing it does not resolve the problem.
I'd be willing to bet that changing the coding system to a string would work, a la: :coding-system "utf-8-unix"
Quoth vanekl vanek@acd.net:
I added an extra keyword argument to my 'sbcl' lisp implementation:
:coding-system utf-8-unix
but removing it does not resolve the problem.
I'd be willing to bet that changing the coding system to a string would work, a la: :coding-system "utf-8-unix"
Nope, using a string (or a symbol) causes the following error upon calling 'M-x slime':
if: Invalid slime-net-coding-system: [...]
Sebastian
thus spoke Sebastian Tennant sebyte@smolny.plus.com:
The steps to execute are:
shell$ sbcl * (load ".../slime/swank-loader.lisp") * (swank-loader:dump-image "sbcl.core-with-swank")
Try using the :TOPLEVEL parameter for SB-EXT:SAVE-LISP-AND-DIE to set SB-IMPL::*DEFAULT-EXTERNAL-FORMAT* to :UTF-8.
Apparently LC_CTYPE isn't properly slurped from the environment when loading an image.
Quoth Stanislaw Halik sthalik@test123.ltd.pl:
Try using the :TOPLEVEL parameter for SB-EXT:SAVE-LISP-AND-DIE to set SB-IMPL::*DEFAULT-EXTERNAL-FORMAT* to :UTF-8.
Thanks, but I'm afraid I have to ask you how the :toplevel parameter works?
I've tried this without success:
$ sbcl * (load ".../slime/swank-loader.lisp") * (sb-ext:save-lisp-and-die :toplevel '(setf sb-impl::*default-external-format* :utf-8) "sbcl.core-with-swank") $
Regards,
Seb
* Sebastian Tennant [2009-08-29 17:19+0200] writes:
Then add this to your `.emacs':
(setq slime-lisp-implementations '((sbcl ("sbcl" "--core" "sbcl.core-with-swank") :init (lambda (port-file _) (format "(swank:start-server %S)\n" port-file)))))
The ignored argument (_) is the coding system. Add the :coding-system argument there or look at slime-init-command for the default definition.
Helmut
Quoth Helmut Eller heller@common-lisp.net:
The ignored argument (_) is the coding system.
Ah. Well that's clear :)
Add the :coding-system argument there
Eh? Surely it's going to depend how the lambda function is called, and regardless of the value of _ I fail to see how this will make it into the call to swank:start-server as it stands.
or look at slime-init-command for the default definition.
I did but it wasn't much help (to me).
Anyway, I've finally got it working the brute force way:
(setq slime-lisp-implementations '(sbcl ("sbcl" "--core" "/usr/local/lib/sbcl/sbcl.core-with-swank") :init (lambda (port-file _) (format "(swank:start-server %S :coding-system "utf-8-unix")\n" port-file))))
Clearly this is not what you meant so it'd be good to know how it should be done.
And perhaps it should be added to the manual too.
Sebastian