all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: joaotavora@gmail.com (João Távora)
Cc: 20892@debbugs.gnu.org
Subject: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files
Date: Wed, 24 Jun 2015 10:52:52 -0400	[thread overview]
Message-ID: <jwvmvzpw4d9.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <jjbsi9h8hvi.fsf@gmail.com> ("João Távora"'s message of "Wed, 24 Jun 2015 12:29:05 +0100")

> -	(insert (car new)))
> +	(insert (decode-coding-string (car new)
> +	                              buffer-file-coding-system)))

The diff-mode buffer will usually already be decoded (i.e. it contains
chars rather than bytes, and for example your name should appear as
"João" rather than as "Jo<bytes>o").  So calling decode-coding-string on
it unconditionally can't be right.

In some cases, the diff-mode buffer will have undecoded bytes (because
the auto-detection failed, common when the diff is involves various
encodings), in which case decode-coding-string could make sense.
In other cases, only the EOL is faulty (typically because the diff tool
itself output LF while the files contain CRLF), in which case we should
use something else which just strips the CRs.

Of course, in yet other cases, the diff itself adds/removes CRs, in
which case stripping them would be an error.

So, Emacs could/should do something about your use-case, but it has to
be careful first to double-check that it's really your use-case and not
some other case.


        Stefan





  reply	other threads:[~2015-06-24 14:52 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 [this message]
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
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

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

  git send-email \
    --in-reply-to=jwvmvzpw4d9.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=20892@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.