From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Gustav =?UTF-8?Q?H=C3=A5llberg?= Newsgroups: gmane.emacs.bugs Subject: bug#20276: 24.4; diff-mode doesn't handle unified diff file headers without tabs Date: Wed, 8 Apr 2015 00:34:23 +0200 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c33f286a5f5e05132a05bc X-Trace: ger.gmane.org 1428446128 2787 80.91.229.3 (7 Apr 2015 22:35:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 Apr 2015 22:35:28 +0000 (UTC) To: 20276@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 08 00:35:08 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Yfc5M-0002oC-AY for geb-bug-gnu-emacs@m.gmane.org; Wed, 08 Apr 2015 00:35:08 +0200 Original-Received: from localhost ([::1]:49123 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yfc5L-0006fy-9Y for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Apr 2015 18:35:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38064) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yfc5H-0006ee-Ng for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 18:35:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yfc5G-0002vS-Ll for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 18:35:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58583) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yfc5G-0002vM-Jl for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 18:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Yfc5G-0007fU-76 for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 18:35:02 -0400 X-Loop: help-debbugs@gnu.org 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: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.142844609729460 (code B ref -1); Tue, 07 Apr 2015 22:35:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Apr 2015 22:34:57 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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) Original-Received: by 10.25.24.167 with HTTP; Tue, 7 Apr 2015 15:34:23 -0700 (PDT) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:101270 Archived-At: --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--