emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#20276: closed (24.4; diff-mode doesn't handle unif


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#20276: closed (24.4; diff-mode doesn't handle unified diff file headers without tabs)
Date: Thu, 09 Apr 2015 01:49:02 +0000

Your message dated Wed, 08 Apr 2015 21:48:49 -0400
with message-id <address@hidden>
and subject line Re: bug#20276: 24.4; diff-mode doesn't handle unified diff 
file headers without tabs
has caused the debbugs.gnu.org bug report #20276,
regarding 24.4; diff-mode doesn't handle unified diff file headers without tabs
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
20276: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20276
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.4; diff-mode doesn't handle unified diff file headers without tabs Date: Wed, 8 Apr 2015 00:34:23 +0200
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


--- End Message ---
--- Begin Message --- Subject: Re: bug#20276: 24.4; diff-mode doesn't handle unified diff file headers without tabs Date: Wed, 08 Apr 2015 21:48:49 -0400 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)
> 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


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]