Subject: Re: bug#14516: 24.3.50; vc-diff ignores the encoding of its input

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 24 Feb 2016 16:01:59 +1100

Dmitry Gutov <[email-masked]> writes:

> Dima Kogan <[email-masked]> writes:
>
>> VC already has code in it to detect the encoding of its input. I'm
>> attaching a small patch that sets this detected encoding to the
>> *vc-diff* buffer. This fixes the issue.
>
> I'd prefer a slightly different patch.  This way, you have smaller
> probability of conflict when `vc-setup-buffer' is called from any
> fuction other than `vc-diff-internal'.
>
> And `coding-system-for-read' detection is only peformed for the diff
> commands.
>
> === modified file 'lisp/vc/vc.el'
> --- lisp/vc/vc.el       2013-11-13 20:06:37 +0000
> +++ lisp/vc/vc.el       2013-11-25 01:13:04 +0000
> @@ -1642,6 +1642,8 @@
>          (coding-system-for-read
>           (if files (vc-coding-system-for-diff (car files)) 'undecided)))
>      (vc-setup-buffer buffer)
> +    (when coding-system-for-read
> +      (setq buffer-file-coding-system coding-system-for-read))
>      (message "%s" (car messages))
>      ;; Many backends don't handle well the case of a file that has been
>      ;; added but not yet committed to the repo (notably CVS and Subversion).

It looks like this was added instead:

    ;; On MS-Windows and MS-DOS, Diff is likely to produce DOS-style
    ;; EOLs, which will look ugly if (car files) happens to have Unix
    ;; EOLs.
    (if (memq system-type '(windows-nt ms-dos))
	(setq coding-system-for-read
	      (coding-system-change-eol-conversion coding-system-for-read
						   'dos)))

I guess that makes as much sense as anything.  (I mean, there may be
different coding systems in each file being diffed in the same
buffer...)

So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no