Hello,
I have a file containing german "umlaute", which I can load with SBCL using
(load "name.lisp" :external-format :latin-1)
However C-c C-k yields
decoding error on stream #<SB-SYS:FD-STREAM for "file /home/neuss/Programming/lisp/stundenplan.lisp" {1002304EE1}> (:EXTERNAL-FORMAT :UTF-8): the octet sequence (246 114 115 97) cannot be decoded. [Condition of type SB-INT:STREAM-DECODING-ERROR]
How can I make C-c C-k (slime-compile-and-load-file) use an external format of :latin-1?
Thank you, Nicolas
* Nicolas Neuss [2006-10-31 13:53+0100] writes:
How can I make C-c C-k (slime-compile-and-load-file) use an external format of :latin-1?
You can add a file variable: -*- slime-coding: iso-latin-1-unix -*- and Slime should send it to the Lisp process.
It would be nicer if we could just use "coding" but that wasn't easy to do. Even nicer would be, if SBCL would detect the encoding like Emacs does.
Helmut.
Helmut Eller heller@common-lisp.net writes:
- Nicolas Neuss [2006-10-31 13:53+0100] writes:
How can I make C-c C-k (slime-compile-and-load-file) use an external format of :latin-1?
You can add a file variable: -*- slime-coding: iso-latin-1-unix -*- and Slime should send it to the Lisp process.
It would be nicer if we could just use "coding" but that wasn't easy to do. Even nicer would be, if SBCL would detect the encoding like Emacs does.
any reason not to use buffer-file-coding-system? or at least infer a default value from it?
* Marco Baringer [2006-10-31 15:58+0100] writes:
any reason not to use buffer-file-coding-system? or at least infer a default value from it?
Can't remember the details. Write a test case, try to make it work in Emacs and XEmacs, and see yourself.
Helmut.
+ Helmut Eller heller@common-lisp.net:
| Can't remember the details. Write a test case, try to make it work in | Emacs and XEmacs, and see yourself.
Um. Yeah, I tend to forget that xemacs exists. Sorry 'bout the noise.
- Harald
+ Helmut Eller heller@common-lisp.net:
| * Nicolas Neuss [2006-10-31 13:53+0100] writes: | | > How can I make C-c C-k (slime-compile-and-load-file) use an external format | > of :latin-1? | | You can add a file variable: -*- slime-coding: iso-latin-1-unix -*- | and Slime should send it to the Lisp process. | | It would be nicer if we could just use "coding" but that wasn't easy | to do.
Why not? What happens if you try using buffer-file-coding-system, if set, and default-buffer-file-coding-system otherwise?
(Not that I doubt your word, but I get curious.)
Helmut Eller heller@common-lisp.net writes:
- Nicolas Neuss [2006-10-31 13:53+0100] writes:
How can I make C-c C-k (slime-compile-and-load-file) use an external format of :latin-1?
You can add a file variable: -*- slime-coding: iso-latin-1-unix -*- and Slime should send it to the Lisp process.
Unfortunately, this does not work. Trying C-c C-k on a file "test.lisp" with the content
;;; -*- slime-coding: iso-latin-1-unix -*- (in-package :cl-user) (defun test () "Prüfung" nil)
I obtain the error
decoding error on stream #<SB-SYS:FD-STREAM for "file /home/neuss/CL-HOME/mathematikum/test.lisp" {1002CA2E81}> (:EXTERNAL-FORMAT :UTF-8): the octet sequence (252 102 117 110) cannot be decoded. [Condition of type SB-INT:STREAM-DECODING-ERROR]
Does C-c C-k on such a file work for you?
Thanks, Nicolas
* Nicolas Neuss [2006-11-03 11:58+0100] writes:
Unfortunately, this does not work. Trying C-c C-k on a file "test.lisp" with the content
;;; -*- slime-coding: iso-latin-1-unix -*- (in-package :cl-user) (defun test () "Prüfung" nil)
I obtain the error
decoding error on stream #<SB-SYS:FD-STREAM for "file /home/neuss/CL-HOME/mathematikum/test.lisp" {1002CA2E81}> (:EXTERNAL-FORMAT :UTF-8): the octet sequence (252 102 117 110) cannot be decoded. [Condition of type SB-INT:STREAM-DECODING-ERROR]
Does C-c C-k on such a file work for you?
Yes, it does. Note that file local variables are only set when you open the file, not when you insert the -*- ... -*-. Verify that it is set properly, by evaluating something like M-: slime-coding in the buffer.
Helmut.
Helmut Eller heller@common-lisp.net writes:
Does C-c C-k on such a file work for you?
Yes, it does. Note that file local variables are only set when you open the file, not when you insert the -*- ... -*-. Verify that it is set properly, by evaluating something like M-: slime-coding in the buffer.
Thanks for your answer, but this is not the error. It looks as if somehow the flag does not get propagated to SWANK-BACKEND::SOURCE-CACHE-GET. Can you maybe read something from this backtrace?
7: (SWANK-BACKEND::READ-FILE "/home/neuss/CL-HOME/mathematikum/test.lisp") 8: (SWANK-BACKEND::SOURCE-CACHE-GET "/home/neuss/CL-HOME/mathematikum/test.lisp" 3371540165) 9: ((LAMBDA (SWANK-BACKEND::FILENAME SWANK-BACKEND::LOAD-P #1="#<...>" . #1#)) "/home/neuss/CL-HOME/mathematikum/test.lisp" T :ISO-LATIN-1-UNIX) 10: (SWANK::MEASURE-TIME-INTERVAL #<CLOSURE (LAMBDA NIL) {100352EB79}>) 11: (SWANK::SWANK-COMPILER #<CLOSURE (LAMBDA NIL) {100352EB79}>) 12: ((LAMBDA NIL)) 13: ((LAMBDA (SWANK-BACKEND::FN)) #<CLOSURE (LAMBDA NIL) {100352EAD9}>) 14: (SWANK::CALL-WITH-BUFFER-SYNTAX #<CLOSURE (LAMBDA NIL) {100352EAD9}>) 15: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK:COMPILE-FILE-FOR-EMACS "/home/neuss/CL-HOME/mathematikum/test.lisp" T :ISO-LATIN-1-UNIX) #<NULL-LEXENV>)
I am using CVS sbcl and CVS slime.
Thank you, Nicolas