unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 20892@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files
Date: Fri, 1 Apr 2016 23:51:47 +0100	[thread overview]
Message-ID: <CALDnm51QWuR_m0t_bO7SBOpO+1EbXn_MTkhyDCBJ-dLyrRkaug@mail.gmail.com> (raw)
In-Reply-To: <83wpohrrsm.fsf@gnu.org>

On Apr 1, 2016 21:36, "Eli Zaretskii" <eliz@gnu.org> wrote:
>
> > From: joaotavora@gmail.com (João Távora)
> > Cc: monnier@iro.umontreal.ca,  20892@debbugs.gnu.org
> > 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.

Thanks,
João





  reply	other threads:[~2016-04-01 22:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24 11:29 bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files João Távora
2015-06-24 14:52 ` Stefan Monnier
2015-06-24 14:57 ` Eli Zaretskii
2015-06-25 13:54   ` João Távora
2015-06-25 14:41     ` Eli Zaretskii
2016-04-01 10:22       ` João Távora
2016-04-01 20:35         ` Eli Zaretskii
2016-04-01 22:51           ` João Távora [this message]
2016-04-02  9:31             ` Eli Zaretskii
2016-04-02 13:42               ` João Távora
2016-04-02 14:27                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALDnm51QWuR_m0t_bO7SBOpO+1EbXn_MTkhyDCBJ-dLyrRkaug@mail.gmail.com \
    --to=joaotavora@gmail.com \
    --cc=20892@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).