[Top][All Lists]

[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: João Távora
Subject: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files
Date: Fri, 1 Apr 2016 23:51:47 +0100

On Apr 1, 2016 21:36, "Eli Zaretskii" <address@hidden> wrote:
> > From: address@hidden (João Távora)
> > Cc: address@hidden,  address@hidden
> > Date: Fri, 01 Apr 2016 11:22:50 +0100
> >
> > In lisp/vc/vc.el, in vc-diff-internal, dynamically binding
> > `coding-system-for-read' seems to be defeated by a call to
> > `vc-setup-buffer', which in turn kills all local variables.
> >
> > I don't fully understand the interaction between buffer-local and
> > lexically/dinamically bound variables but this seems wrong, right?
> How come kill-all-local-variables can have any effect on the binding
> of coding-system-for-read.

I don't know. I said I don't fully understand that part.

> Can you explain, or show the evidence that
> vc-setup-buffer is the culprit here?

I edebugged and evalled coding-system-for-read before and after the
call to vc-setup-buffer. It lost its non-nil value before and after
the call to that vc-setup-buffer.

What may possibly have happened is that when testing I set it globally
and hence violated some important assumption. I am away from the w32
machine where this happened, but I will try again monday.

> I think that fixing EOL decoding shouldn't touch the value of
> coding-system-for-read, only its EOL decoding part, if at all.

Although this bug was issued for the eolness. I've additionally
noticed I get misdecoded diacritics in the vc-diff buffer. This is why
I think coding-system-for-read

The test case is easy I think. Version a file with git, using crlf and latin-1.

$ mkdir something && cd something
$ git init
$ echo João Távora > bla.txt
$ emacs --batch -q bla.txt --eval "(setq buffer-file-coding-system
'iso-latin-1-dos)" --eval "(write-file \"bla.txt\")"
$ git add bla.txt && git commit -m "test"
$ emacs --batch -q bla.txt --eval "(insert \"blibli\\n\")" --eval
"(write-file \"bla.txt\")"

emacs -Q bla.txt
M-x vc-diff

The pesky ^M *and* escape sequences appear in the output. I just tried
this on mac and the same happens. Two things fix this:

1) The second part of my patch, to `vc-git-command'. It seems to
respect the (apparent) fact that coding-system-for-{read,write} are
supposed to be dynamically bindable overrides.
2) file-locally or dir-locally seting vc-git-commits-coding-system in
my configuration.

>From reading the code and your messages I was under the impression
that you agreed this was a bug. It is in my opinion (and I also think
it is a regression).

Anyway I think 1) is a sound fix but 2) will also do the job perfectly
well apparently. On monday I will investigate the kill-local-variables
thing again.


reply via email to

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