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

From: Eli Zaretskii <[email-masked]>
Date: Wed, 24 Jun 2015 17:57:57 +0300

> From: [email-masked] (João Távora)
> Date: Wed, 24 Jun 2015 12:29:05 +0100
> 
>  @@ -1799,7 +1799,8 @@ 
>        (with-current-buffer buf
>  	(goto-char (car pos))
>  	(delete-region (car pos) (cdr pos))
> -	(insert (car new)))
> +	(insert (decode-coding-string (car new)
> +	                              buffer-file-coding-system)))

That doesn't sound right: the string you are passing to
decode-coding-string is already a multibyte string in Emacs's internal
representation.  So decoding it one more time is not what you want.

I think we should simply remove the CR characters from the end of each
line, if buffer-file-coding-system states DOS EOL format.  (You can
check the latter with coding-system-eol-type.)

Thanks.