From: Petter Gustad on

What is the current suggested method for using UTF-8 strings with
Slime/Emacs/SBCL?

I'm using:

echo $LC_CTYPE
en_US.UTF-8

(stream-external-format *standard-output*)
returns:

:UTF-8

In emacs:

(require 'slime)
(set-language-environment "UTF-8")
(setq slime-net-coding-system 'utf-8-unix)
(setq inferior-lisp-program "sbcl")


But entering an UTF-8 string causes it to crash (copied from an UTF-8
buffer with a "u" in the bottom left corner"):

MYPACKAGE> "Skates"
"Skates"
MYPACKAGE> "Skøyter"
"Skøyter"

In *Messages* I see:

Connecting to Swank on port 5555.. [2 times]
Connected. Hack and be merry!
Toggling font-lock-mode off; better pass an explicit argument.
Please type y, n, or !:
Loading cl-indent...done
Mark set [2 times]
error in process filter: let*: Wrong type argument: listp, :presentation-end
error in process filter: Wrong type argument: listp, :presentation-end

In my REPL I observe:

dispatch-event: (:WRITE-STRING "\"Skates\"" :REPL-RESULT)
WRITE: (:write-string "\"Skates\"" :repl-result)
dispatch-event: (:PRESENTATION-END 64 :REPL-RESULT)
WRITE: (:presentation-end 64 :repl-result)
dispatch-event: (:WRITE-STRING "
" :REPL-RESULT)
WRITE: (:write-string "
" :repl-result)
wait-for-event: (COMMON-LISP:OR (:EMACS-REX . SWANK::_) (:EMACS-CHANNEL-SEND . S
WANK::_)) NIL
dispatch-event: (:RETURN #<SB-THREAD:THREAD "repl-thread" RUNNING {1002565141}>
(:OK NIL) 5)
WRITE: (:return (:ok nil) 5)
READ: "(:emacs-rex (swank:listener-eval \"\\\"Sk\x00C3\x00B8yter\\\"
\") \"ENMILLIONKRONER\" :repl-thread 6)"
dispatch-event: (:EMACS-REX (SWANK:LISTENER-EVAL "\"Sk\x00C3\x00B8yter\"
") "ENMILLIONKRONER" :REPL-THREAD 6)
send-event: #<SB-THREAD:THREAD "repl-thread" RUNNING {1002565141}> (:EMACS-REX (
SWANK:LISTENER-EVAL "\"Sk\x00C3\x00B8yter\"
") "ENMILLIONKRONER" 6)
wait-for-event: (COMMON-LISP:OR (:EMACS-REX . SWANK::_) (:EMACS-CHANNEL-SEND . S
WANK::_)) NIL
dispatch-event: (:PRESENTATION-START 65 :REPL-RESULT)
WRITE: (:presentation-start 65 :repl-result)
dispatch-event: (:WRITE-STRING "\"Sk\x00C3\x00B8yter\"" :REPL-RESULT)
WRITE: (:write-string "\"Sk\x00C3\x00B8yter\"" :repl-result)
dispatch-event: (:PRESENTATION-END 65 :REPL-RESULT)
WRITE: (:presentation-end 65 :repl-result)
dispatch-event: (:WRITE-STRING "
" :REPL-RESULT)
WRITE: (:write-string "
" :repl-result)
dispatch-event: (:RETURN #<SB-THREAD:THREAD "repl-thread" RUNNING {1002565141}> (:OK NIL) 6)
WRITE: (:return (:ok nil) 6)
close-connection: Short read: length=6 count=1 ...


This will crash in Slime, but works in the REPL:

(coerce (loop for c in (list #\S #\k #\LATIN_SMALL_LETTER_O_WITH_STROKE #\y #\t #\e #\r) collect c) 'string)


Emacs "22.3.1"
Slime ChangeLog 2009-12-03
SBCL 1.0.19-gentoo

Any ideas?

Petter

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
From: Harald Hanche-Olsen on
+ Petter Gustad <newsmailcomp6(a)gustad.com>:

> What is the current suggested method for using UTF-8 strings with
> Slime/Emacs/SBCL?

I am using both

(setf slime-lisp-implementations
'((sbcl ("sbcl") :coding-system utf-8-unix)
(cmucl ("cmucl") :coding-system iso-latin-1-unix)))

and

(setf slime-net-coding-system 'utf-8-unix)

and see no problems. Belts and suspenders, I suppose. I had the setup
for so long I forget the exact rationale for doing it that way.

--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
when there is no ground whatsoever for supposing it is true.
-- Bertrand Russell
From: Petter Gustad on
Harald Hanche-Olsen <hanche(a)math.ntnu.no> writes:

Thank you for your reply.

> I am using both
>
> (setf slime-lisp-implementations
> '((sbcl ("sbcl") :coding-system utf-8-unix)
> (cmucl ("cmucl") :coding-system iso-latin-1-unix)))

Unfortunately it did not help much. According to the documentation:

CODING-SYSTEM a symbol for the coding system. The default is
slime-net-coding-system

So it should be equivalent.

> and see no problems. Belts and suspenders, I suppose. I had the setup

Is that when you start swank:create-server from the repl and then use
M-x slime-connect from Emacs?

In my case it works when I initiate slime from Emacs, but not when I
connect to a sbcl where swank:create-server was run.

Petter
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
From: Piotr Chamera on
Petter Gustad pisze:
> Harald Hanche-Olsen <hanche(a)math.ntnu.no> writes:
>
> Thank you for your reply.
>
>> I am using both
>>
>> (setf slime-lisp-implementations
>> '((sbcl ("sbcl") :coding-system utf-8-unix)
>> (cmucl ("cmucl") :coding-system iso-latin-1-unix)))
>
> Unfortunately it did not help much. According to the documentation:
>
> CODING-SYSTEM a symbol for the coding system. The default is
> slime-net-coding-system
>
> So it should be equivalent.
>
>> and see no problems. Belts and suspenders, I suppose. I had the setup
>
> Is that when you start swank:create-server from the repl and then use
> M-x slime-connect from Emacs?
>
> In my case it works when I initiate slime from Emacs, but not when I
> connect to a sbcl where swank:create-server was run.
>
> Petter

And do You create swank server with
(swank:create-server :coding-system "utf-8-unix") ?
From: Petter Gustad on
Piotr Chamera <piotr_chamera(a)poczta.onet.pl> writes:

> And do You create swank server with
> (swank:create-server :coding-system "utf-8-unix") ?

No - and that was the source of my problems. THANKS!


Petter
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?