Glynn Clements writes:
Philip Aston wrote:
> So.. urmm.. same question but
> s/buffer-file-coding-system-for-read/buffer-file-coding-system/g?
>
> Namely, what do I set (or rather set-default) it to such that eol
> type is preserved?
Almost anything that doesn't have a suffix of -unix, -dos or -mac
(except "binary"). The exact choice depends upon how you want
non-ASCII characters to be handled by a MULE-enabled version of
XEmacs.
With both buffer-file-coding-system and
buffer-file-coding-system-for-read set to "raw-text" I can read in a
CRLF encoded text file (which displays OK), but writing it changes the
file to CR format. M-x toggle-buffer-file-coding-system and then
writing saves in CRLF format (which is why I suspected
buffer-file-coding-system-for-read in the first place).
Basically, every coding system has four variants. E.g. for
ISO-8859-1, you have: iso-8859-1, iso-8859-1-unix, iso-8859-1-dos
and iso-8859-1-mac. The "basic" version autodetects the EOL
convention, while the others assume a specific convention (LF,
CRLF, and CR respectively).
If you wish to autodect the base coding system, as well as the EOL
convention, use "undecided".
Same behaviour as "raw-text", but with the addition of exiting xemacs
process when I start ispell :-(
Persisting I tried the following:
(setq buffer-file-coding-system-for-read 'undecided)
(setq-default buffer-file-coding-system 'raw-text)
Then with a CRLF text file (test.txt) I see the following:
C-x f test.txt
C-h v buffer-file-coding-system =
Value: #<coding-system raw-text-dos no-conversion eol-type=crlf>
Default-value: raw-text
(Good)
Change the file, then C-x s test.txt
C-x k
C-x f test.txt
C-h v buffer-file-coding-system =
Value: #<coding-system raw-text-dos no-conversion eol-type=crlf>
Default-value: raw-text
(Good)
C-x k
C-x d
C-x f test.txt
C-h v buffer-file-coding-system =
Value: #<coding-system raw-text-unix no-conversion eol-type=lf>
Default-value: raw-text
HUH?
How/why does dired screw up the buffer-file-coding-system used for
reading test.txt?
AFAICT it doesn't modify buffer-file-coding-system-for-read, the
default value of buffer-file-coding-system, file-coding-system-alist,
find-file-hooks, insert-file-contents-pre-hook,
insert-file-contents-post-hook, ... What am I missing?
- Phil