[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: decode_eol and inconsistent EOL
From: |
Stefan Monnier |
Subject: |
Re: decode_eol and inconsistent EOL |
Date: |
Mon, 29 Apr 2002 08:59:44 -0400 |
> > I think all that we really care about is that the load+save trip is safe
> > and that the content of the Emacs buffer looks "as right as possible".
>
> The second part is the issue here: it's open to interpretation.
I believe we've lost track of the problem.
Do you agree with the patch below ?
All it does is that if the auto-detection of eol has decided to
use dos-style eol, then we use dos-style eols even if the file has some
stray CRs characters. Of course, if there is an LF in the file which
is not preceded by a CR, we revert to unix-style eol, as before.
It is safe and does not change any heuristic. I don't think it's
"open to interpretation" because it only changes the behavior when
there are CRLFs in the file (otherwise the auto-detection would not
have chosen dos-style eol) and when every LF is preceded by a CR
which is a pretty clear indication that we're dealing with a dos-style
file.
Stefan
--- coding.c.~1.241.~ Tue Apr 16 10:15:28 2002
+++ coding.c Fri Apr 26 09:09:16 2002
@@ -3173,11 +3173,6 @@
ONE_MORE_BYTE (c);
if (c != '\n')
{
- if (coding->mode & CODING_MODE_INHIBIT_INCONSISTENT_EOL)
- {
- coding->result = CODING_FINISH_INCONSISTENT_EOL;
- goto label_end_of_loop;
- }
src--;
c = '\r';
}