From unknown Mon Aug 11 21:36:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20276: 24.4; diff-mode doesn't handle unified diff file headers without tabs Resent-From: Gustav =?UTF-8?Q?H=C3=A5llberg?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Apr 2015 22:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20276 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 20276@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.142844609729460 (code B ref -1); Tue, 07 Apr 2015 22:35:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Apr 2015 22:34:57 +0000 Received: from localhost ([127.0.0.1]:48359 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yfc5A-0007f4-JQ for submit@debbugs.gnu.org; Tue, 07 Apr 2015 18:34:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52752) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yfc58-0007eq-2V for submit@debbugs.gnu.org; Tue, 07 Apr 2015 18:34:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yfc51-0002my-J8 for submit@debbugs.gnu.org; Tue, 07 Apr 2015 18:34:48 -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.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:47898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yfc51-0002mu-Gw for submit@debbugs.gnu.org; Tue, 07 Apr 2015 18:34:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yfc50-0006Yt-Ck for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 18:34:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yfc4z-0002mk-7E for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 18:34:46 -0400 Received: from mail-la0-x236.google.com ([2a00:1450:4010:c03::236]:36233) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yfc4y-0002mg-UT for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 18:34:45 -0400 Received: by lagv1 with SMTP id v1so53158868lag.3 for ; Tue, 07 Apr 2015 15:34:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=LDapcvO2H8uuRYYWmoERAI9/BWXnzFMcn/zZCKF/EBM=; b=cNKqxNWQ3/eZlN4DPj0v9Aga0R5oeztD9708EG9IjDSUkQOjvEr9/yXUgVdDT322Zn r2x6TGPsR7qarT83OHC6yUtyb7yN/QqxZxq4mS2Q75GgoMdyhm4AXTgBM+sM9J1b5Fp5 2076HLVZZbWG9hVWBBzCK6K91umRi7zj7IhQuOxRFeGlHVk84hydB/oCQrqg4yAMLwaD Yt05tBAByI7Xk9ZZ+DdVObrAW5uQsdR7v05fOm5x0x58rbfcqwuzOYHEht5lDo/K3emV Fvs9sKJDDBfQ5M6F1lsRFziyUrKJ+cDt92oKDrCz/1xqs4XxcjZDSLR+l3dtkwOTSHs5 Cv9w== X-Received: by 10.152.87.162 with SMTP id az2mr20832280lab.58.1428446083962; Tue, 07 Apr 2015 15:34:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.24.167 with HTTP; Tue, 7 Apr 2015 15:34:23 -0700 (PDT) From: Gustav =?UTF-8?Q?H=C3=A5llberg?= Date: Wed, 8 Apr 2015 00:34:23 +0200 Message-ID: Content-Type: multipart/alternative; boundary=001a11c33f286a5f5e05132a05bc X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) 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 (----) --001a11c33f286a5f5e05132a05bc Content-Type: text/plain; charset=UTF-8 In diff-mode, "o" doesn't recognize unified diff file headers if they do not contain tabs. Some diff programs will not emit tab + timestamp (as GNU diff does), but just the file name. Example working file header (where ".txt" is followed by tabs): --- a.txt 2015-04-08 00:09:46.000000000 +0200 +++ b.txt 2015-04-08 00:09:51.000000000 +0200 Example failing file header: --- a.txt +++ b.txt The fallback is for "o" to open the file on the leading "diff" line which may or may not be present. This used to work in Emacs 24.3.1 but does not as of the patch mentioned here: http://stackoverflow.com/questions/14720205/how-do-i-use-emacs-diff-with-spaces My proposal is to fix this in (diff-hunk-file-names) by removing the requirement for the trailing tab on the leading diff file header and replace it with a no-newline check (sorry for not providing proper patch): - (if (looking-at "[-*][-*][-*] \\([^\t]+\\)\t.*\n[-+][-+][-+] \\([^\t]+\\)") + (if (looking-at "[-*][-*][-*] \\([^\t\n]+\\).*\n[-+][-+][-+] \\([^\t\n]+\\)") The return values should probably use (match-string-no-properties) rather than (match-string) as well. Thanks, Gustav --001a11c33f286a5f5e05132a05bc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
In diff-mode, "o" doesn't recognize uni= fied diff file headers if they do
not contain tabs. Some diff pro= grams will not emit tab + timestamp (as
GNU diff does), but just = the file name.

Example working file header (where = ".txt" is followed by tabs):

--- a.txt 2015-04-08 00:09:46.000000= 000 +0200
+++ b.txt 2015-04-08 00:09:51.000000000 +0200

Example f= ailing file header:

--- a.txt
+++ b.txt<= /div>

The fallback is for "o" to open the file= on the leading "diff" line
which may or may not be pre= sent.

This used to work in Emacs 24.3.1 but does n= ot as of the patch mentioned
here:

My proposal is to fix this in (diff-hunk-fil= e-names) by removing the
requirement for the trailing tab on the = leading diff file header and
replace it with a no-newline check (= sorry for not providing proper
patch):

-= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (looking-at "[-*][-*][-*] \\([^= \t]+\\)\t.*\n[-+][-+][-+] \\([^\t]+\\)")
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(if (looking-at "[-*][-*][-*] \\([^\t\n]+\\).*\n[-+][= -+][-+] \\([^\t\n]+\\)")

The return values sh= ould probably use (match-string-no-properties)
rather than (match= -string) as well.

Thanks,
=C2=A0Gustav

--001a11c33f286a5f5e05132a05bc-- From unknown Mon Aug 11 21:36:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20276: 24.4; diff-mode doesn't handle unified diff file headers without tabs Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Apr 2015 20:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20276 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Gustav =?UTF-8?Q?H=C3=A5llberg?= Cc: 20276@debbugs.gnu.org Received: via spool by 20276-submit@debbugs.gnu.org id=B20276.142852623816699 (code B ref 20276); Wed, 08 Apr 2015 20:51:01 +0000 Received: (at 20276) by debbugs.gnu.org; 8 Apr 2015 20:50:38 +0000 Received: from localhost ([127.0.0.1]:49565 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yfwvm-0004LH-2D for submit@debbugs.gnu.org; Wed, 08 Apr 2015 16:50:38 -0400 Received: from mercure.iro.umontreal.ca ([132.204.24.67]:33158) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yfwvi-0004L8-VA for 20276@debbugs.gnu.org; Wed, 08 Apr 2015 16:50:35 -0400 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 88D169C128; Wed, 8 Apr 2015 16:50:34 -0400 (EDT) Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 8FE531E5B8C; Wed, 8 Apr 2015 16:50:06 -0400 (EDT) Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 73644B4122; Wed, 8 Apr 2015 16:50:06 -0400 (EDT) From: Stefan Monnier Message-ID: References: Date: Wed, 08 Apr 2015 16:50:06 -0400 In-Reply-To: ("Gustav =?UTF-8?Q?H=C3=A5llberg?="'s message of "Wed, 8 Apr 2015 00:34:23 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-Spam-Status: No X-Spam-Score: -2.3 (--) 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: -2.3 (--) > Some diff programs will not emit tab + timestamp (as GNU diff does), > but just the file name. Which diff programs do that? > - (if (looking-at "[-*][-*][-*] \\([^\t]+\\)\t.*\n[-+][-+][-+] > \\([^\t]+\\)") > + (if (looking-at "[-*][-*][-*] \\([^\t\n]+\\).*\n[-+][-+][-+] > \\([^\t\n]+\\)") Adding \n in the char-ranges is fine (it's a good change in itself), but removing the \t increases the risk of false positives, so I'm a bit worried about that. Stefan From unknown Mon Aug 11 21:36:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20276: 24.4; diff-mode doesn't handle unified diff file headers without tabs Resent-From: Gustav =?UTF-8?Q?H=C3=A5llberg?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Apr 2015 22:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20276 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 20276@debbugs.gnu.org Received: via spool by 20276-submit@debbugs.gnu.org id=B20276.142853276426543 (code B ref 20276); Wed, 08 Apr 2015 22:40:02 +0000 Received: (at 20276) by debbugs.gnu.org; 8 Apr 2015 22:39:24 +0000 Received: from localhost ([127.0.0.1]:49645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yfyd2-0006u3-5j for submit@debbugs.gnu.org; Wed, 08 Apr 2015 18:39:24 -0400 Received: from mail-lb0-f177.google.com ([209.85.217.177]:32788) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yfycz-0006tp-Kd for 20276@debbugs.gnu.org; Wed, 08 Apr 2015 18:39:22 -0400 Received: by lbbzk7 with SMTP id zk7so78163479lbb.0 for <20276@debbugs.gnu.org>; Wed, 08 Apr 2015 15:39:15 -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; bh=AKMca7+Xk3ZWrtaarlLVCZmQZNpR4JbI2cv1MIJWqq8=; b=EV1k66/GzCc5R5iI1pLKi3RWXPhLxtXja/W102aumdRF7I1JhZJyrf6abXkZAiaH2I fb6atAu5iEkJXfVBb4jYrL6Iie/nzxHniSFHWorJxK68coDpGK/mXYGM8CQ5FvyhfFDq 5N2FxaFIwy99zc+LuQLTwKK5tyA8DAOHSZoDrnZo8BTCnw6SZKkQm34Hgg1Nouyqsb9E PLopottX88wgj0VPqjomK0k4+v8i8xqoIf8kHEM+dHbZpQR7P5mYpjiMfQOMnqAuXfuA b0OP2cZIMyArVk/5giq7U/SrG9pcuFhr29b0HGHR8BE3j12v24SlyJO4e6qYYQAEjTce +s8w== X-Received: by 10.112.235.38 with SMTP id uj6mr25814300lbc.9.1428532755721; Wed, 08 Apr 2015 15:39:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.24.167 with HTTP; Wed, 8 Apr 2015 15:38:55 -0700 (PDT) In-Reply-To: References: From: Gustav =?UTF-8?Q?H=C3=A5llberg?= Date: Thu, 9 Apr 2015 00:38:55 +0200 Message-ID: Content-Type: multipart/alternative; boundary=001a11c3cf2874727105133e336d X-Spam-Score: -0.7 (/) 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 (/) --001a11c3cf2874727105133e336d Content-Type: text/plain; charset=UTF-8 On Wed, Apr 8, 2015 at 10:50 PM, Stefan Monnier wrote: > > Some diff programs will not emit tab + timestamp (as GNU diff does), > > but just the file name. > > Which diff programs do that? > diff -u with -L does for example: $ diff -u -Lfoo a.txt -Lbar b.txt --- foo +++ bar : git diff also does for what it's worth. > > > - (if (looking-at "[-*][-*][-*] \\([^\t]+\\)\t.*\n[-+][-+][-+] > > \\([^\t]+\\)") > > + (if (looking-at "[-*][-*][-*] \\([^\t\n]+\\).*\n[-+][-+][-+] > > \\([^\t\n]+\\)") > > Adding \n in the char-ranges is fine (it's a good change in itself), but > removing the \t increases the risk of false positives, so I'm a bit > worried about that. > True, but note that diff-font-lock-keywords is more permissive; it does not require the tab to be present. - Gustav > > > Stefan > --001a11c3cf2874727105133e336d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On W= ed, Apr 8, 2015 at 10:50 PM, Stefan Monnier <monnier@iro.umontrea= l.ca> wrote:
> Some diff programs will= not emit tab + timestamp (as GNU diff does),
> but just the file name.

Which diff programs do that?

diff -u with -L= does for example:

=C2=A0 $ diff -u -Lfoo a.txt -Lbar b.txt
=C2=A0 --- foo
=C2=A0 +++ bar
<= div>=C2=A0 =C2=A0 :

git diff also does for what it= 's worth.
=C2=A0

> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (looking-at "[-*][-*][-*]= \\([^\t]+\\)\t.*\n[-+][-+][-+]
> \\([^\t]+\\)")
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (looking-at "[-*][-*][-*]= \\([^\t\n]+\\).*\n[-+][-+][-+]
> \\([^\t\n]+\\)")

Adding \n in the char-ranges is fine (it's a good change in itself), bu= t
removing the \t increases the risk of false positives, so I'm a bit
worried about that.

True, but note that= diff-font-lock-keywords is more permissive; it does not require the tab to= be present.

- Gustav

=C2= =A0


=C2=A0 =C2=A0 =C2=A0 =C2=A0 Stefan

--001a11c3cf2874727105133e336d-- From unknown Mon Aug 11 21:36:29 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Gustav =?UTF-8?Q?H=C3=A5llberg?= Subject: bug#20276: closed (Re: bug#20276: 24.4; diff-mode doesn't handle unified diff file headers without tabs) Message-ID: References: X-Gnu-PR-Message: they-closed 20276 X-Gnu-PR-Package: emacs Reply-To: 20276@debbugs.gnu.org Date: Thu, 09 Apr 2015 01:49:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1428544142-16661-1" This is a multi-part message in MIME format... ------------=_1428544142-16661-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #20276: 24.4; diff-mode doesn't handle unified diff file headers without ta= bs which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 20276@debbugs.gnu.org. --=20 20276: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D20276 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1428544142-16661-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 20276-done) by debbugs.gnu.org; 9 Apr 2015 01:48:57 +0000 Received: from localhost ([127.0.0.1]:49746 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yg1aT-0004KG-9m for submit@debbugs.gnu.org; Wed, 08 Apr 2015 21:48:57 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:56309) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yg1aR-0004K4-S5 for 20276-done@debbugs.gnu.org; Wed, 08 Apr 2015 21:48:56 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgUFAGvvdVRBbthL/2dsb2JhbAA3gVOhb4EIgXUBAQQBViMFCws0EhQYDSSIE6IRjA0aPQkDAQKDPgMOAQEECINUBKg7 X-IPAS-Result: AgUFAGvvdVRBbthL/2dsb2JhbAA3gVOhb4EIgXUBAQQBViMFCws0EhQYDSSIE6IRjA0aPQkDAQKDPgMOAQEECINUBKg7 X-IronPort-AV: E=Sophos;i="5.01,1,1400040000"; d="scan'208";a="115765653" Received: from 65-110-216-75.cpe.pppoe.ca (HELO pastel.home) ([65.110.216.75]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 08 Apr 2015 21:48:51 -0400 Received: by pastel.home (Postfix, from userid 20848) id 058B620AC; Wed, 8 Apr 2015 21:48:49 -0400 (EDT) From: Stefan Monnier To: Gustav =?windows-1252?Q?H=E5llberg?= Subject: Re: bug#20276: 24.4; diff-mode doesn't handle unified diff file headers without tabs Message-ID: References: Date: Wed, 08 Apr 2015 21:48:49 -0400 In-Reply-To: ("Gustav =?windows-1252?Q?H=E5llberg=22's?= message of "Thu, 9 Apr 2015 00:38:55 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 20276-done Cc: 20276-done@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 (/) > git diff also does for what it's worth. Ah, indeed. This doesn't bite us too hard because git also happens to provide the "diff ..." line. > True, but note that diff-font-lock-keywords is more permissive; it does not > require the tab to be present. Of course a false positive in diff-font-lock-keywords will only look funny but won't affect actual behavior, which is why I thought it was OK to be more permissive. Anyway, I guess we have to bite this bullet, so I installed your patch into "master". Thanks, Stefan ------------=_1428544142-16661-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Apr 2015 22:34:57 +0000 Received: from localhost ([127.0.0.1]:48359 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yfc5A-0007f4-JQ for submit@debbugs.gnu.org; Tue, 07 Apr 2015 18:34:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52752) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yfc58-0007eq-2V for submit@debbugs.gnu.org; Tue, 07 Apr 2015 18:34:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yfc51-0002my-J8 for submit@debbugs.gnu.org; Tue, 07 Apr 2015 18:34:48 -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.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:47898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yfc51-0002mu-Gw for submit@debbugs.gnu.org; Tue, 07 Apr 2015 18:34:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yfc50-0006Yt-Ck for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 18:34:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yfc4z-0002mk-7E for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 18:34:46 -0400 Received: from mail-la0-x236.google.com ([2a00:1450:4010:c03::236]:36233) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yfc4y-0002mg-UT for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 18:34:45 -0400 Received: by lagv1 with SMTP id v1so53158868lag.3 for ; Tue, 07 Apr 2015 15:34:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=LDapcvO2H8uuRYYWmoERAI9/BWXnzFMcn/zZCKF/EBM=; b=cNKqxNWQ3/eZlN4DPj0v9Aga0R5oeztD9708EG9IjDSUkQOjvEr9/yXUgVdDT322Zn r2x6TGPsR7qarT83OHC6yUtyb7yN/QqxZxq4mS2Q75GgoMdyhm4AXTgBM+sM9J1b5Fp5 2076HLVZZbWG9hVWBBzCK6K91umRi7zj7IhQuOxRFeGlHVk84hydB/oCQrqg4yAMLwaD Yt05tBAByI7Xk9ZZ+DdVObrAW5uQsdR7v05fOm5x0x58rbfcqwuzOYHEht5lDo/K3emV Fvs9sKJDDBfQ5M6F1lsRFziyUrKJ+cDt92oKDrCz/1xqs4XxcjZDSLR+l3dtkwOTSHs5 Cv9w== X-Received: by 10.152.87.162 with SMTP id az2mr20832280lab.58.1428446083962; Tue, 07 Apr 2015 15:34:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.24.167 with HTTP; Tue, 7 Apr 2015 15:34:23 -0700 (PDT) From: =?UTF-8?Q?Gustav_H=C3=A5llberg?= Date: Wed, 8 Apr 2015 00:34:23 +0200 Message-ID: Subject: 24.4; diff-mode doesn't handle unified diff file headers without tabs To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary=001a11c33f286a5f5e05132a05bc X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 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 (----) --001a11c33f286a5f5e05132a05bc Content-Type: text/plain; charset=UTF-8 In diff-mode, "o" doesn't recognize unified diff file headers if they do not contain tabs. Some diff programs will not emit tab + timestamp (as GNU diff does), but just the file name. Example working file header (where ".txt" is followed by tabs): --- a.txt 2015-04-08 00:09:46.000000000 +0200 +++ b.txt 2015-04-08 00:09:51.000000000 +0200 Example failing file header: --- a.txt +++ b.txt The fallback is for "o" to open the file on the leading "diff" line which may or may not be present. This used to work in Emacs 24.3.1 but does not as of the patch mentioned here: http://stackoverflow.com/questions/14720205/how-do-i-use-emacs-diff-with-spaces My proposal is to fix this in (diff-hunk-file-names) by removing the requirement for the trailing tab on the leading diff file header and replace it with a no-newline check (sorry for not providing proper patch): - (if (looking-at "[-*][-*][-*] \\([^\t]+\\)\t.*\n[-+][-+][-+] \\([^\t]+\\)") + (if (looking-at "[-*][-*][-*] \\([^\t\n]+\\).*\n[-+][-+][-+] \\([^\t\n]+\\)") The return values should probably use (match-string-no-properties) rather than (match-string) as well. Thanks, Gustav --001a11c33f286a5f5e05132a05bc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
In diff-mode, "o" doesn't recognize uni= fied diff file headers if they do
not contain tabs. Some diff pro= grams will not emit tab + timestamp (as
GNU diff does), but just = the file name.

Example working file header (where = ".txt" is followed by tabs):

--- a.txt 2015-04-08 00:09:46.000000= 000 +0200
+++ b.txt 2015-04-08 00:09:51.000000000 +0200

Example f= ailing file header:

--- a.txt
+++ b.txt<= /div>

The fallback is for "o" to open the file= on the leading "diff" line
which may or may not be pre= sent.

This used to work in Emacs 24.3.1 but does n= ot as of the patch mentioned
here:

My proposal is to fix this in (diff-hunk-fil= e-names) by removing the
requirement for the trailing tab on the = leading diff file header and
replace it with a no-newline check (= sorry for not providing proper
patch):

-= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (looking-at "[-*][-*][-*] \\([^= \t]+\\)\t.*\n[-+][-+][-+] \\([^\t]+\\)")
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(if (looking-at "[-*][-*][-*] \\([^\t\n]+\\).*\n[-+][= -+][-+] \\([^\t\n]+\\)")

The return values sh= ould probably use (match-string-no-properties)
rather than (match= -string) as well.

Thanks,
=C2=A0Gustav

--001a11c33f286a5f5e05132a05bc-- ------------=_1428544142-16661-1--