Subject: Re: New way of handling CRLF

From: Eli Zaretskii <[email-masked]>
Date: Sun, 6 Jul 1997 17:22:44 +0300 (IDT)

On Fri, 4 Jul 1997, Geoff Voelker wrote:

> correctly (e.g., on a text file with CRLF, both a find-file and a
> find-file-binary create a buffer with the text file stripped of
> CRLF,

What about binary files with embedded CRLFs?  How can Emacs tell which
files are and which aren't ``text''?  If it can't, then the above
behavior is wrong: I might want to use `find-file-binary' to read a
binary file (e.g., an executable program) that just happens to have
embedded CRLF pairs, either as part of text messages or even just an
opcode that happens to look like CRLF.  Will I then be presented with
the file with all CRs in CRLF pairs removed?

> a text file without CRLF, Emacs reads it in correctly, but the
> buffer-file-type is "text", and so the file gets written out with LF
> converted to CRLF.  This is not a bug in the coding-system code, but
> rather due to the fact that, internally, Emacs under DOS_NT looks at
> the buffer-file-type, sees "text", and opens the file in text mode,
> and the operating system changes LF to CRLF.

I'm not sure this is a bug, either.  I can imagine cases where the
user would like Unix-style text files be written as DOS-style text.  I
haven't decided yet what the default should be here, but at least a
user-definable option should be available to get the non-default
behavior.

> Given the new coding-system framework, I think that all file I/O under
> DOS_NT should now be done in binary mode since the data that Emacs
> gives to the operating system does not need any conversion.

If that is the case, how would a user tell Emacs that a file which
originally had no CRs should have them added on output (assuming that
you agree that such cases are possible)?

---

From: Richard Stallman <[email-masked]>
Date: Sun, 6 Jul 1997 20:08:26 -0400

What about binary files with embedded CRLFs?

Specifying that a file is binary means specifying no conversion.
Therefore, CRLF in these files will not be converted.

You can certainly do this by specifying a different coding system
when you save the file.