all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>, Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 20892@debbugs.gnu.org
Subject: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files
Date: Thu, 25 Jun 2015 14:54:26 +0100	[thread overview]
Message-ID: <CALDnm524nC9DEpXpLthw0nhX8y8AOL8=tOuE_AMTg24z0WH75Q@mail.gmail.com> (raw)
In-Reply-To: <83y4j9duh6.fsf@gnu.org>

On Wed, Jun 24, 2015 at 3:57 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: joaotavora@gmail.com (João Távora)
> > Date: Wed, 24 Jun 2015 12:29:05 +0100
> >
> >  @@ -1799,7 +1799,8 @@
> >        (with-current-buffer buf
> >       (goto-char (car pos))
> >       (delete-region (car pos) (cdr pos))
> > -     (insert (car new)))
> > +     (insert (decode-coding-string (car new)
> > +                                   buffer-file-coding-system)))
>
> That doesn't sound right: the string you are passing to
> decode-coding-string is already a multibyte string in Emacs's internal
> representation.  So decoding it one more time is not what you want.
>
> I think we should simply remove the CR characters from the end of each
> line, if buffer-file-coding-system states DOS EOL format.  (You can
> check the latter with coding-system-eol-type.)

I see my mistake now, thanks. (also thanks Stefan). It worked so I
assumed magically it's the right thing without thinking too hard. But
I don't think simply removing the CR characters is the right thing, we
should interpret them according to coding-system-eol-type, right?

It's more complicated, but I can give it a try (maybe meanwhile commit
a patch that does what you say to fix the current unusable state of
diff-apply-hunk in this situation)

So, say a diff hunk contains just a couple of lines with CRLF and a
couple of lines just LF. If applied to a buffer that is all CRLF, I
would say that applying this hunk should eventually provoke the normal
Emacs behaviour of highlighting all CR's except for the two lines with
LF. Is it worth it? What do you both think?

João





  reply	other threads:[~2015-06-25 13:54 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 [this message]
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='CALDnm524nC9DEpXpLthw0nhX8y8AOL8=tOuE_AMTg24z0WH75Q@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 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.