Subject: Re: bug#33567: Syntactic fontification of diff hunks

From: Juri Linkov <[email-masked]>
Date: Tue, 04 Dec 2018 01:36:52 +0200

>> BTW, while deciding what to do with this, could you please confirm
>> if I correctly fixed another problem in vc-find-revision-no-save.
>> Recently in bug#33319 I added this function but now discovered
>> a problem with encoding.  A vc process outputs lines to the buffer
>> with no-conversion, so in the patch below I added recode-region
>> to convert output to the buffer's encoding.  coding-system-for-write
>> that I removed was copied from vc-find-revision-save where is was
>> needed for write-region called from the macro with-temp-file,
>> but vc-find-revision-no-save doesn't write output to the file.
>
> vc-find-revision disables encoding/decoding because it wants to
> create an identical copy of the checked-out file, and doesn't want to
> be tripped by encoding/decoding issues.  But in your case you don't
> write the buffer to a file, so why do you need to bind
> coding-system-for-read at all?  I say leave it unbound, and let Emacs
> do its job decoding the text as usual.  Does that not work?

I tried to remove coding-system-for-read binding from
vc-find-revision-no-save, but it still fails to get the buffer
in the right encoding.  Then I discovered that vc-git-find-revision
and also some other VC backend API implementations of find-revision
bind coding-system-for-read too.  It seems that removing
coding-system-for-read from vc-git-find-revision will cause
a lot of breakage.