From unknown Fri Jun 20 18:24:56 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#20892 <20892@debbugs.gnu.org> To: bug#20892 <20892@debbugs.gnu.org> Subject: Status: 25.0.50; Applying vc-diff hunks on CRLF tracked files Reply-To: bug#20892 <20892@debbugs.gnu.org> Date: Sat, 21 Jun 2025 01:24:56 +0000 retitle 20892 25.0.50; Applying vc-diff hunks on CRLF tracked files reassign 20892 emacs submitter 20892 joaotavora@gmail.com (Jo=C3=A3o T=C3=A1vora) severity 20892 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 24 07:29:25 2015 Received: (at submit) by debbugs.gnu.org; 24 Jun 2015 11:29:26 +0000 Received: from localhost ([127.0.0.1]:55879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7irs-0003yC-Ve for submit@debbugs.gnu.org; Wed, 24 Jun 2015 07:29:25 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39522) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7irq-0003y0-Ts for submit@debbugs.gnu.org; Wed, 24 Jun 2015 07:29:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7irk-0003Kw-Kn for submit@debbugs.gnu.org; Wed, 24 Jun 2015 07:29:17 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:37784) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7irk-0003Kq-HY for submit@debbugs.gnu.org; Wed, 24 Jun 2015 07:29:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7irj-0002Ib-5X for bug-gnu-emacs@gnu.org; Wed, 24 Jun 2015 07:29:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7irf-0003I3-30 for bug-gnu-emacs@gnu.org; Wed, 24 Jun 2015 07:29:15 -0400 Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:33169) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7ire-0003Ey-SM for bug-gnu-emacs@gnu.org; Wed, 24 Jun 2015 07:29:11 -0400 Received: by wiwl6 with SMTP id l6so92399705wiw.0 for ; Wed, 24 Jun 2015 04:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=Pxn0Uhxa+nBz/+taDeI40tkMzmNvwc/qR1YbapeGGvE=; b=Oj/Nra6ygMrgLg2QdNDmQd7uh+MQUbOr8KXcYNNEMLrDS8OxfUl+hf0YnKpp+iqCKn /5+XYMuInR9B5OE4Yc50jpIxmLubLOzKOdCsA07GD+bHBHE+zJCP0gwK8Jcz4GYHJ9Jy X6l8rFu4lfcMVeLEBbVex92xHJ/wAka8GHRKmGlFBqbG22kDFypAGJ7hT2/hWWqOVKOj xOhDeoPR67nZ79lRCGl+OziNUdhqYaZZBOGhYj9OUuFoHVQHkkkgOJ58jUWQ5YthFRPY YHZrmYrmKQLImXjBHhhdAosHYhfwQ/LcE+LCQzfewcNUVuQNX601bbmaxA9EP41urYbY 4g7w== X-Received: by 10.195.17.199 with SMTP id gg7mr71473257wjd.121.1435145349690; Wed, 24 Jun 2015 04:29:09 -0700 (PDT) Received: from GONDOMAR.yourcompany.com (53.236.108.93.rev.vodafone.pt. [93.108.236.53]) by mx.google.com with ESMTPSA id d3sm2075524wic.1.2015.06.24.04.29.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jun 2015 04:29:08 -0700 (PDT) From: joaotavora@gmail.com (=?iso-8859-1?Q?Jo=E3o_T=E1vora?=) To: bug-gnu-emacs@gnu.org Subject: 25.0.50; Applying vc-diff hunks on CRLF tracked files Date: Wed, 24 Jun 2015 12:29:05 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (windows-nt) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hello maintainers, 1. Navigate to a repository where files are tracked with CRLF line endings. =20=20=20 2. Modify one of those files. 3. Use M-x vc-root-diff. Observe how, in the latest trunk, the carriage return (represented as ^M) are visible as a part of the diff hunk's content. This is correct, in my opinion, if a little visually distracting. 4. Undo of of those diffs with C-c C-a 5. Redo the same hunk with C-c C-a again 6. Notive how diff-apply-hunk incorrectly applies the carriage return characters themselves. Here's a trivial patch to lisp/vc/diff-mode.el, or simply cherry-pick the commit=20 7ed2b6299425c4b2ea6bd8d8e8eb5eaa5e5ddf7e which is available in this url https://github.com/capitaomorte/emacs.git @@ -1799,7 +1799,8 @@=20 (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))) ;; Display BUF in a window (set-window-point (display-buffer buf) (+ (car pos) (cdr new))) (diff-hunk-status-msg line-offset (diff-xor switched reverse) nil) The commit message is Consider coding system when applying diff-mode hunks. =20=20=20=20=20 Without this, applying hunks may garble line endings in the destination buffer. =20=20=20=20=20 * lisp/vc/diff-mode.el (diff-apply-hunk): Use decode-coding-string and buffer-file-coding-system. =20=20=20=20=20=20 Sorry I couldn't properly inline a patch, Thanks, Jo=E3o From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 24 10:53:01 2015 Received: (at 20892) by debbugs.gnu.org; 24 Jun 2015 14:53:01 +0000 Received: from localhost ([127.0.0.1]:56562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7m2u-0001qc-Sw for submit@debbugs.gnu.org; Wed, 24 Jun 2015 10:53:01 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:4750) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7m2s-0001qP-PV for 20892@debbugs.gnu.org; Wed, 24 Jun 2015 10:52:59 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A1FgA731xV/3+MCkxcgxCEAoVVu0CEfoJNBAICgTw7EgEBAQEBAQGBCkEFg10BAQRWIxALNBIUGA2IY88jAQEBAQEFAgEfizqFBQeELQWLRJNTkhSCFIFFI2GBBSEfgW4igngBAQE X-IPAS-Result: A0A1FgA731xV/3+MCkxcgxCEAoVVu0CEfoJNBAICgTw7EgEBAQEBAQGBCkEFg10BAQRWIxALNBIUGA2IY88jAQEBAQEFAgEfizqFBQeELQWLRJNTkhSCFIFFI2GBBSEfgW4igngBAQE X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="128173366" Received: from 76-10-140-127.dsl.teksavvy.com (HELO ceviche.home) ([76.10.140.127]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 24 Jun 2015 10:52:53 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 8DBA3660F3; Wed, 24 Jun 2015 10:52:52 -0400 (EDT) From: Stefan Monnier To: joaotavora@gmail.com (=?windows-1252?B?Sm/jbyBU4XZvcmE=?=) Subject: Re: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files Message-ID: References: Date: Wed, 24 Jun 2015 10:52:52 -0400 In-Reply-To: (=?windows-1252?Q?=22Jo=E3o_T=E1v?= =?windows-1252?Q?ora=22's?= message of "Wed, 24 Jun 2015 12:29:05 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 20892 Cc: 20892@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > - (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=E3o" rather than as "Joo"). 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 From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 24 10:58:17 2015 Received: (at 20892) by debbugs.gnu.org; 24 Jun 2015 14:58:17 +0000 Received: from localhost ([127.0.0.1]:56566 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7m80-0001y2-Sk for submit@debbugs.gnu.org; Wed, 24 Jun 2015 10:58:17 -0400 Received: from mtaout24.012.net.il ([80.179.55.180]:55719) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7m7x-0001xn-I2 for 20892@debbugs.gnu.org; Wed, 24 Jun 2015 10:58:14 -0400 Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0NQG00100E90ZA00@mtaout24.012.net.il> for 20892@debbugs.gnu.org; Wed, 24 Jun 2015 17:49:33 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NQG00LL3EILRL60@mtaout24.012.net.il>; Wed, 24 Jun 2015 17:49:33 +0300 (IDT) Date: Wed, 24 Jun 2015 17:57:57 +0300 From: Eli Zaretskii Subject: Re: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files In-reply-to: X-012-Sender: halo1@inter.net.il To: joaotavora@gmail.com (=?iso-8859-1?Q?Jo=E3o_T=E1vora?=) Message-id: <83y4j9duh6.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 8BIT References: X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 20892 Cc: 20892@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > 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.) Thanks. From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 25 09:54:54 2015 Received: (at 20892) by debbugs.gnu.org; 25 Jun 2015 13:54:54 +0000 Received: from localhost ([127.0.0.1]:57016 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z87cD-0002z7-Ef for submit@debbugs.gnu.org; Thu, 25 Jun 2015 09:54:53 -0400 Received: from mail-ig0-f182.google.com ([209.85.213.182]:35898) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z87cB-0002yu-J9 for 20892@debbugs.gnu.org; Thu, 25 Jun 2015 09:54:52 -0400 Received: by igbiq7 with SMTP id iq7so119244102igb.1 for <20892@debbugs.gnu.org>; Thu, 25 Jun 2015 06:54:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=cIF819pruhvDrTjX6njpa/gS5wFbx/sQUrUI0gZ2mg4=; b=aEld2Sy9ZGaz+zZQZcMtTT437WJNpQXBC/dHfKlUQf9WGO2lprASFyOpIK57uGR966 DI7uXExAtro+IAta9nxAF4OpCSJi9y+Tjr/YAj93oMMK4VgfBGcQcmFBo6PK+qwSCepo CcmwBbTfghDln9CdFkfre+bLzsSnEv4wQRBtFU/2nDgsW++3hd44UTFSF83I8mSIeLtc DG8Z/eg/k903nYqCrl6QonRPgNRP/nWsr05d9+xQD7O0MnMixQ5IfZbjJA1J1oRN1y/X 28kKGI3Oii3Qg9tptnRzgMe2M/5vBRQr0hetdqvPZp2DS914zE/Hyfv4zvj5v0ThYLZg uFxA== X-Received: by 10.50.141.164 with SMTP id rp4mr4300199igb.2.1435240485808; Thu, 25 Jun 2015 06:54:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.15.32 with HTTP; Thu, 25 Jun 2015 06:54:26 -0700 (PDT) In-Reply-To: <83y4j9duh6.fsf@gnu.org> References: <83y4j9duh6.fsf@gnu.org> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Thu, 25 Jun 2015 14:54:26 +0100 Message-ID: Subject: Re: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files To: Eli Zaretskii , Stefan Monnier Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 20892 Cc: 20892@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Wed, Jun 24, 2015 at 3:57 PM, Eli Zaretskii wrote: > > > From: joaotavora@gmail.com (Jo=C3=A3o T=C3=A1vora) > > 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=C3=A3o From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 25 10:41:30 2015 Received: (at 20892) by debbugs.gnu.org; 25 Jun 2015 14:41:30 +0000 Received: from localhost ([127.0.0.1]:57348 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z88LK-000498-3i for submit@debbugs.gnu.org; Thu, 25 Jun 2015 10:41:30 -0400 Received: from mtaout23.012.net.il ([80.179.55.175]:32978) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z88LG-00048u-Pm for 20892@debbugs.gnu.org; Thu, 25 Jun 2015 10:41:27 -0400 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0NQI008008NV8P00@a-mtaout23.012.net.il> for 20892@debbugs.gnu.org; Thu, 25 Jun 2015 17:41:20 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NQI008DS8SW5T50@a-mtaout23.012.net.il>; Thu, 25 Jun 2015 17:41:20 +0300 (IDT) Date: Thu, 25 Jun 2015 17:41:13 +0300 From: Eli Zaretskii Subject: Re: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files In-reply-to: X-012-Sender: halo1@inter.net.il To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Message-id: <83bng3etpy.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 8BIT References: <83y4j9duh6.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 20892 Cc: 20892@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > From: João Távora > Date: Thu, 25 Jun 2015 14:54:26 +0100 > Cc: 20892@debbugs.gnu.org > > I don't think simply removing the CR characters is the right thing, we > should interpret them according to coding-system-eol-type, right? You should remove them if coding-system-eol-type for buffer-file-coding-system of the buffer which the hunk comes from returns 1. > 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? It depends on what the user wants/needs. The Patch utility has options which will cause it to strip the CR characters when applying the diffs; I guess we should have a similar flexibility here. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 01 06:23:02 2016 Received: (at 20892) by debbugs.gnu.org; 1 Apr 2016 10:23:02 +0000 Received: from localhost ([127.0.0.1]:46791 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1alwEH-0000jW-Nc for submit@debbugs.gnu.org; Fri, 01 Apr 2016 06:23:01 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:34401) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1alwEF-0000jB-V0 for 20892@debbugs.gnu.org; Fri, 01 Apr 2016 06:23:00 -0400 Received: by mail-wm0-f51.google.com with SMTP id p65so19741516wmp.1 for <20892@debbugs.gnu.org>; Fri, 01 Apr 2016 03:22:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=ldzF4j8KVDJdc6K357rFAEGaJDm/qkANzGmmsl3lsoE=; b=pux/bhd8vnuhNtwuTXJ6WOc5a5VSu2iBJ5sbJV7Jx5ZnhbHB9qdtquQopAcvpkvki2 c7b57EpLf+9QCDhX2pmpm4r7+8kITMKpdQm1aMLRddC5q/+ioxR1+k3jk/zHFj0uoDKj lCC15dcAVS1b4NRyVO14nzSsVSO7hSzpKpApo9Rmc4A2h+qlGfGqT49l5MyrpNQIFg5J xGGYMTjIjw8Luceb5sBAB2a35qbSunjqcKbRc9+xhjKE/UtnPUga1oHu6uEBMZXrzQhD Xfjisq/RBCMiZbs2LLdClwxRF7xM7zw5XWl2wwGxOpT8X/2ALGYuRKXmQ+elmgFTSBcE VkdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=ldzF4j8KVDJdc6K357rFAEGaJDm/qkANzGmmsl3lsoE=; b=bS8zOpEAgPhabfB5FQmr/zpN+4RMchkrMQLFuiB2XlLzj0djvRWxiHWfYL5xKvPVJ4 va+VXVthUlEXOp7HofTr1YUlO8yHiAjkPR3MOazxNDnTgxx9cifSfiMzOyrZOjKsRLSP vel4opaW7X7bl7zdwp0g5mdTy0Mg7X++oNrnI4WoIJ58Ay/qSzOrRdpN78ZFmqoktohQ rey70J5Cjq2ijq00Ow6zfbn91EGjFsoelE0EelF5tvPCSUGldtk3veF0bjK4OBkHKWza NpePyOWeYcxq9hf6MFC5+9i+EMFU9HkeXBe/R9cfWTwEohdY7jQ2os1LF7EzgotEB4Dw v0PQ== X-Gm-Message-State: AD7BkJIfTiLFbk7QLiKpwKxe162biCud8f2UuYFzzcbnDLtA99WDJ5jmhyDuRFjqQwM0jg== X-Received: by 10.194.119.201 with SMTP id kw9mr22337448wjb.173.1459506174022; Fri, 01 Apr 2016 03:22:54 -0700 (PDT) Received: from GONDOMAR.yourcompany.com (mail3.siscog.pt. [195.23.29.18]) by smtp.gmail.com with ESMTPSA id q62sm29233744wmg.12.2016.04.01.03.22.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Apr 2016 03:22:52 -0700 (PDT) From: joaotavora@gmail.com (=?iso-8859-1?Q?Jo=E3o_T=E1vora?=) To: Eli Zaretskii Subject: Re: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files References: <83y4j9duh6.fsf@gnu.org> <83bng3etpy.fsf@gnu.org> Date: Fri, 01 Apr 2016 11:22:50 +0100 In-Reply-To: <83bng3etpy.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 25 Jun 2015 17:41:13 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.91 (windows-nt) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 20892 Cc: 20892@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Hi, So I'm reviving this ancient thread, since I've possibly come up with a more interesting patch. 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.=20 I don't fully understand the interaction between buffer-local and lexically/dinamically bound variables but this seems wrong, right? Anyway, I believe the `vc-setup-buffer' can be pulled up to outside the let. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 25b41e3..c245c3f 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1678,6 +1678,7 @@ BUFFER, if non-nil, should be a buffer or a buffe= r name. Return t if the buffer had changes, nil otherwise." (unless buffer (setq buffer "*vc-diff*")) + (vc-setup-buffer buffer) (let* ((files (cadr vc-fileset)) (messages (cons (format "Finding changes in %s..." (vc-delistify files)) @@ -1696,7 +1697,6 @@ Return t if the buffer had changes, nil otherwise= ." (setq coding-system-for-read (coding-system-change-eol-conversion coding-system-for-re= ad 'dos))) - (vc-setup-buffer buffer) (message "%s" (car messages)) ;; Many backends don't handle well the case of a file that has been ;; added but not yet committed to the repo (notably CVS and Subver= sion). If, to this, we add a fix in lisp/vc/vc-git.el and don't let it override an existing `coding-system-for-read'... diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 8498cc8..c60125c 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1387,8 +1387,10 @@ This command shares argument histories with \\[r= grep] and \\[grep]." "A wrapper around `vc-do-command' for use in vc-git.el. The difference to vc-do-command is that this function always invokes `vc-git-program'." - (let ((coding-system-for-read vc-git-commits-coding-system) - (coding-system-for-write vc-git-commits-coding-system)) + (let ((coding-system-for-read (or coding-system-for-read + vc-git-commits-coding-system)) + (coding-system-for-write (or coding-system-for-write + vc-git-commits-coding-system))) (apply 'vc-do-command (or buffer "*vc*") okstatus vc-git-program ;; http://debbugs.gnu.org/16897 (unless (and (not (cdr-safe file-or-list)) the system seems to do the right thing and honour the intention of commit 0e2c793ffefa72c40c7731847d8210c2d7d0e515 Author: Eli Zaretskii Date: Tue Nov 26 21:17:55 2013 +0200 =20=20=20=20 Fix ugly ^M characters in Diff output shown by "C-x v u". What do you think?=20 Jo=E3o Eli Zaretskii writes: >> From: Jo=E3o T=E1vora >> Date: Thu, 25 Jun 2015 14:54:26 +0100 >> Cc: 20892@debbugs.gnu.org >>=20 >> I don't think simply removing the CR characters is the right thing, we >> should interpret them according to coding-system-eol-type, right? > > You should remove them if coding-system-eol-type for > buffer-file-coding-system of the buffer which the hunk comes from > returns 1. > >> 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? > > It depends on what the user wants/needs. The Patch utility has > options which will cause it to strip the CR characters when applying > the diffs; I guess we should have a similar flexibility here. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 01 16:36:08 2016 Received: (at 20892) by debbugs.gnu.org; 1 Apr 2016 20:36:08 +0000 Received: from localhost ([127.0.0.1]:47597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1am5nc-0003Mb-9o for submit@debbugs.gnu.org; Fri, 01 Apr 2016 16:36:08 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48237) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1am5nb-0003MD-3L for 20892@debbugs.gnu.org; Fri, 01 Apr 2016 16:36:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1am5nR-0008Cv-87 for 20892@debbugs.gnu.org; Fri, 01 Apr 2016 16:36:01 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50646) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1am5nR-0008Cr-57; Fri, 01 Apr 2016 16:35:57 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3371 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1am5nM-0007hJ-Re; Fri, 01 Apr 2016 16:35:56 -0400 Date: Fri, 01 Apr 2016 23:35:21 +0300 Message-Id: <83wpohrrsm.fsf@gnu.org> From: Eli Zaretskii To: joaotavora@gmail.com (=?iso-8859-1?Q?Jo=E3o_T=E1vora?=) In-reply-to: (joaotavora@gmail.com) Subject: Re: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files References: <83y4j9duh6.fsf@gnu.org> <83bng3etpy.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: 20892 Cc: 20892@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > 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. Can you explain, or show the evidence that vc-setup-buffer is the culprit here? > If, to this, we add a fix in lisp/vc/vc-git.el and don't let it override > an existing `coding-system-for-read'... > > diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el > index 8498cc8..c60125c 100644 > --- a/lisp/vc/vc-git.el > +++ b/lisp/vc/vc-git.el > @@ -1387,8 +1387,10 @@ This command shares argument histories with \\[rgrep] and \\[grep]." > "A wrapper around `vc-do-command' for use in vc-git.el. > The difference to vc-do-command is that this function always invokes > `vc-git-program'." > - (let ((coding-system-for-read vc-git-commits-coding-system) > - (coding-system-for-write vc-git-commits-coding-system)) > + (let ((coding-system-for-read (or coding-system-for-read > + vc-git-commits-coding-system)) > + (coding-system-for-write (or coding-system-for-write > + vc-git-commits-coding-system))) > (apply 'vc-do-command (or buffer "*vc*") okstatus vc-git-program > ;; http://debbugs.gnu.org/16897 > (unless (and (not (cdr-safe file-or-list)) > > the system seems to do the right thing and honour the intention of > > commit 0e2c793ffefa72c40c7731847d8210c2d7d0e515 > Author: Eli Zaretskii > Date: Tue Nov 26 21:17:55 2013 +0200 > > Fix ugly ^M characters in Diff output shown by "C-x v u". > > What do you think? I think that fixing EOL decoding shouldn't touch the value of coding-system-for-read, only its EOL decoding part, if at all. And I also don't see how does binding in vc-git interfere with the EOL format of the diffs. Can you tell the details, i.e. how did you arrive at the conclusion that the above binding is the culprit? Thanks. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 01 18:52:13 2016 Received: (at 20892) by debbugs.gnu.org; 1 Apr 2016 22:52:13 +0000 Received: from localhost ([127.0.0.1]:47660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1am7vJ-0006d8-1i for submit@debbugs.gnu.org; Fri, 01 Apr 2016 18:52:13 -0400 Received: from mail-ig0-f180.google.com ([209.85.213.180]:35632) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1am7vI-0006cs-Ag for 20892@debbugs.gnu.org; Fri, 01 Apr 2016 18:52:12 -0400 Received: by mail-ig0-f180.google.com with SMTP id cl4so5328326igb.0 for <20892@debbugs.gnu.org>; Fri, 01 Apr 2016 15:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=xHF8TcGViNl+Cs9nUnNvDiZOpSpm7t165HP0WlnP+80=; b=t+IAL6gfuRLyNqipjF/cIVqvUBOLMrlYyo+4lC7q4JvkHuJ7IIT+a0Czlz34y+m3KH mD7So0MrCUY+o562Yu3BFnalZSleNNYwb4ofmNuHQAcuwhoqt3ofR09T8/IA6C89uZzH wB2P+9iOTKZie7ogdm1l2FRixDgb/UqJ+hIv13k7X4LTZc/fYcbM+jdjDxoQLeefrCh2 8aRE39x5N+ASt2I6fKTNe7+gseU15xnx/ZJdjfAfCgDAgQjchZ1zD8LwzzapeVK0l+yv nFzjuHbqyWYGjWl6OyD6qTuS/R7QW++ttyE5zDmVw6Zh194BTgffHaN65rt/PhFF/k5j Tkeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=xHF8TcGViNl+Cs9nUnNvDiZOpSpm7t165HP0WlnP+80=; b=R3+EsZ7pYgyaYXQAtM6rkCsnoLuUEvVsw8nIvt9L33HbK0Ea6leDQyjTNG7FKobL8N JGmNZcdv7e9jx1RzE8hBIAbABiXTDKegrUmdFeJ7phZWthDYvFLlHD914XurzqywKnZ7 x8NZDs4Ag0kvGKKg45hm7yR1PYct8eAzHLg+MNypxOn1rfGXQFPneGOPVDCgJyf+qw49 c6Ws/MTGxeiExk3qFWVifQPKeSnsvDfhoEynwOwTiHM6SNYnHUu2SIRtxgwMe6kPdxQZ YhvKr0zQYlTCt/o7RgTpx/O7VbbCMCz1S4FvUx3G+0B4OxCIQ0YdzQ8UZwSFdfzYRbcg A1EQ== X-Gm-Message-State: AD7BkJJdavnHNdFXQ8LeI+RymQ4BVf6O1XD/oeU2R9OkBskvCLXZkPvdtCkesoVHYkFIBK7AVw2lj1mTMI7j4g== X-Received: by 10.50.61.209 with SMTP id s17mr1233338igr.7.1459551126454; Fri, 01 Apr 2016 15:52:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.22.69 with HTTP; Fri, 1 Apr 2016 15:51:47 -0700 (PDT) In-Reply-To: <83wpohrrsm.fsf@gnu.org> References: <83y4j9duh6.fsf@gnu.org> <83bng3etpy.fsf@gnu.org> <83wpohrrsm.fsf@gnu.org> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Fri, 1 Apr 2016 23:51:47 +0100 Message-ID: Subject: Re: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files To: Eli Zaretskii Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 20892 Cc: 20892@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Apr 1, 2016 21:36, "Eli Zaretskii" wrote: > > > From: joaotavora@gmail.com (Jo=C3=A3o T=C3=A1vora) > > 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 lati= n-1. $ mkdir something && cd something $ git init $ echo Jo=C3=A3o T=C3=A1vora > 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=C3=A3o From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 02 05:32:23 2016 Received: (at 20892) by debbugs.gnu.org; 2 Apr 2016 09:32:23 +0000 Received: from localhost ([127.0.0.1]:47784 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1amHup-0006Oh-Hn for submit@debbugs.gnu.org; Sat, 02 Apr 2016 05:32:23 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49185) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1amHun-0006OV-Q4 for 20892@debbugs.gnu.org; Sat, 02 Apr 2016 05:32:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1amHue-0005qu-PH for 20892@debbugs.gnu.org; Sat, 02 Apr 2016 05:32:16 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36638) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1amHue-0005qh-Lj; Sat, 02 Apr 2016 05:32:12 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4536 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1amHud-0001pZ-UG; Sat, 02 Apr 2016 05:32:12 -0400 Date: Sat, 02 Apr 2016 12:31:40 +0300 Message-Id: <83oa9ss6f7.fsf@gnu.org> From: Eli Zaretskii To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= In-reply-to: (message from =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= on Fri, 1 Apr 2016 23:51:47 +0100) Subject: Re: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files References: <83y4j9duh6.fsf@gnu.org> <83bng3etpy.fsf@gnu.org> <83wpohrrsm.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: 20892 Cc: 20892@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: João Távora > Date: Fri, 1 Apr 2016 23:51:47 +0100 > Cc: Stefan Monnier , 20892@debbugs.gnu.org > > On Apr 1, 2016 21:36, "Eli Zaretskii" 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 cannot reproduce your result: when I edebug the relevant code, coding-system-for-read gets bound to undecided-dos before the call to vc-setup-buffer, and stays at that value after the call returns. > 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. Refraining from overriding coding-system-for-read/write if they are already bound is a Good Thing, so I installed that change in the emacs-25 branch. However, re-reading the original bug report, I'm now confused. Originally, you said that the ^M characters in the vc-diff output were correct, and your problem was with applying the hunks. If you now say that the problem is with those ^M characters, and applying the hunks after that is no longer a problem, then we can now close this bug. Please clarify. From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 02 09:43:15 2016 Received: (at 20892) by debbugs.gnu.org; 2 Apr 2016 13:43:15 +0000 Received: from localhost ([127.0.0.1]:47888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1amLpb-0005fL-Bq for submit@debbugs.gnu.org; Sat, 02 Apr 2016 09:43:15 -0400 Received: from mail-ig0-f169.google.com ([209.85.213.169]:36897) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1amLpZ-0005f8-Pc for 20892@debbugs.gnu.org; Sat, 02 Apr 2016 09:43:14 -0400 Received: by mail-ig0-f169.google.com with SMTP id l20so21846900igf.0 for <20892@debbugs.gnu.org>; Sat, 02 Apr 2016 06:43:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=gXPXDPT/Vx5XP2+UjnQSXgJOC877/5HHqhfoapbfckM=; b=ytROdvXg5VJyIHj8TxY2jirm8Bz2wYCGG44zTDdBvtbIVKyxkMYgSrWGVD+K+Ve/yB xB+BdFDIYXtAWG6ytv/6jrx6vOcUpWLJU0+yfqYZNg8SZUN84M9AEiPYQTniQkYN5PfF VkE7bn+tY0mlyDvjKlFONnXFRIF6ZGZ7epX8rcg/0BPx21u8Ez3h/su3t3YFS/TfRJk7 qjWREN64lWrKGRdW3sb4mfiiSqcF6EpedtuDSZTFgBN4doo5FNd9oWCY9K3IkCCkPHBd bfHmFI8WUKA1D5/GICn+ishTEwgny0FicCcBKshv2CqCdlR2cthS9EEXae9TIubEg9yc E/rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=gXPXDPT/Vx5XP2+UjnQSXgJOC877/5HHqhfoapbfckM=; b=IOWyQ6Jp+e5jJBdvs4nNst67Nsqth64jS9ZqLpnD2dgx/7z0G4/YydMXGA55ILpyFA VP4jnwo+Rw7bXQgY00S4jqIVi7oR4/4EzF6EzgNNuSBF04+URIAMvVZg4vIHe9sjxRK/ 4f6LGk8HatmSwxWGFBTZJdTNF2gHX3zGez2gvX97/sYIPQB0bPBu5+hXwTNg8Ovz6Dtd AiAOAgf52q9xkcw3UjaPoSdJYBPt0oxbYe7tsV0CMq8ztXdVjPzjOsYM4lbtt5c9LedV QlEOOnFh473tdQaStBZRpIYhoYd4EpgvP8c6o+tos0GFyD97vEcQFv5f49x/5oc2sDlO iB2Q== X-Gm-Message-State: AD7BkJKeuWBQGNJzVKdXI3RONjM5hpkDlN2tDkNzY1RFeB+jEoHbaS8KASRj7RxrtKC3mJ9fzv/1aCRsBOaiNQ== X-Received: by 10.107.3.149 with SMTP id e21mr7109146ioi.46.1459604588162; Sat, 02 Apr 2016 06:43:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.22.69 with HTTP; Sat, 2 Apr 2016 06:42:48 -0700 (PDT) In-Reply-To: <83oa9ss6f7.fsf@gnu.org> References: <83y4j9duh6.fsf@gnu.org> <83bng3etpy.fsf@gnu.org> <83wpohrrsm.fsf@gnu.org> <83oa9ss6f7.fsf@gnu.org> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Sat, 2 Apr 2016 14:42:48 +0100 Message-ID: Subject: Re: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files To: Eli Zaretskii Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 20892 Cc: 20892@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Sat, Apr 2, 2016 at 10:31 AM, Eli Zaretskii wrote: > Refraining from overriding coding-system-for-read/write if they are > already bound is a Good Thing, so I installed that change in the > emacs-25 branch. Thanks. > However, re-reading the original bug report, I'm now confused. > Originally, you said that the ^M characters in the vc-diff output were > correct, and your problem was with applying the hunks. If you now say > that the problem is with those ^M characters, and applying the hunks > after that is no longer a problem, then we can now close this bug. > Please clarify. Indeed, it is a bit confusing, so here's the story: 1. Sometime in June 2015, upgrade my emacs. vc-diff some CRLF file 2. "Cool, a new feature now makes it show precisely which chars were added and deleted even the CRs" 3. "Oh, but vc-apply-hunk stopped working, let's open bug 20892" 4. Discuss bug, argue that showing ^M is cool for when you really want to apply patches that add and remove just one or two of those. 5. Apply some reasonable fix to my config. Be side-tracked by dayjob. Lose interest in discussing the bug, 6. Eventually, realize 4 is silly and if you're mixing CRLF and non-CRLF line endings you've already lost. 7. Recently, March 2016, also realize that diacritics are also wrong in latin-1 files. 8. Decide to reevaluate situation, read some code and commit messages, and propose a new fix that makes the vc-diff buffer have the same encoding as the originating file, as apparently was intended. vc-apply-hunk is fixed, if I ever need to do something like 4 I'll do it outside of emacs. I think you can close the bug. --=20 Jo=C3=A3o T=C3=A1vora From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 02 10:28:03 2016 Received: (at 20892-done) by debbugs.gnu.org; 2 Apr 2016 14:28:03 +0000 Received: from localhost ([127.0.0.1]:48989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1amMWw-0000Df-UB for submit@debbugs.gnu.org; Sat, 02 Apr 2016 10:28:03 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41608) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1amMWv-0000DB-8t for 20892-done@debbugs.gnu.org; Sat, 02 Apr 2016 10:28:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1amMWm-0002l6-2R for 20892-done@debbugs.gnu.org; Sat, 02 Apr 2016 10:27:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:39616) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1amMWl-0002kq-V1; Sat, 02 Apr 2016 10:27:51 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1070 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1amMWk-0002dy-R0; Sat, 02 Apr 2016 10:27:51 -0400 Date: Sat, 02 Apr 2016 17:27:20 +0300 Message-Id: <837fggrsqf.fsf@gnu.org> From: Eli Zaretskii To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= In-reply-to: (message from =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= on Sat, 2 Apr 2016 14:42:48 +0100) Subject: Re: bug#20892: 25.0.50; Applying vc-diff hunks on CRLF tracked files References: <83y4j9duh6.fsf@gnu.org> <83bng3etpy.fsf@gnu.org> <83wpohrrsm.fsf@gnu.org> <83oa9ss6f7.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: 20892-done Cc: 20892-done@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: João Távora > Date: Sat, 2 Apr 2016 14:42:48 +0100 > Cc: Stefan Monnier , 20892@debbugs.gnu.org > > 1. Sometime in June 2015, upgrade my emacs. vc-diff some CRLF file > > 2. "Cool, a new feature now makes it show precisely which chars were > added and deleted even the CRs" > > 3. "Oh, but vc-apply-hunk stopped working, let's open bug 20892" > > 4. Discuss bug, argue that showing ^M is cool for when you really want > to apply patches that add and remove just one or two of those. > > 5. Apply some reasonable fix to my config. Be side-tracked by > dayjob. Lose interest in discussing the bug, > > 6. Eventually, realize 4 is silly and if you're mixing CRLF and > non-CRLF line endings you've already lost. > > 7. Recently, March 2016, also realize that diacritics are also wrong > in latin-1 files. > > 8. Decide to reevaluate situation, read some code and commit messages, > and propose a new fix that makes the vc-diff buffer have the same > encoding as the originating file, as apparently was intended. > vc-apply-hunk is fixed, if I ever need to do something like 4 > I'll do it outside of emacs. > > I think you can close the bug. Thanks, closing. From unknown Fri Jun 20 18:24:56 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 01 May 2016 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator