GNU bug report logs - #20892
25.0.50; Applying vc-diff hunks on CRLF tracked files

Previous Next

Package: emacs;

Reported by: joaotavora <at> gmail.com (João Távora)

Date: Wed, 24 Jun 2015 11:30:05 UTC

Severity: normal

Found in version 25.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 20892 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: joaotavora <at> gmail.com (João Távora)
Cc: 20892 <at> debbugs.gnu.org
Subject: Re: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files
Date: Wed, 24 Jun 2015 10:52:52 -0400
> -	(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




This bug report was last modified 9 years and 52 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.