bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files


From: Stefan Monnier
Subject: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files
Date: Wed, 24 Jun 2015 10:52:52 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> -     (insert (car new)))
> +     (insert (decode-coding-string (car new)
> +                                   buffer-file-coding-system)))

The diff-mode buffer will usually already be decoded (i.e. it contains
chars rather than bytes, and for example your name should appear as
"João" rather than as "Jo<bytes>o").  So calling decode-coding-string on
it unconditionally can't be right.

In some cases, the diff-mode buffer will have undecoded bytes (because
the auto-detection failed, common when the diff is involves various
encodings), in which case decode-coding-string could make sense.
In other cases, only the EOL is faulty (typically because the diff tool
itself output LF while the files contain CRLF), in which case we should
use something else which just strips the CRs.

Of course, in yet other cases, the diff itself adds/removes CRs, in
which case stripping them would be an error.

So, Emacs could/should do something about your use-case, but it has to
be careful first to double-check that it's really your use-case and not
some other case.


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]