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

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

bug#20276: 24.4; diff-mode doesn't handle unified diff file headers with


From: Gustav Hållberg
Subject: bug#20276: 24.4; diff-mode doesn't handle unified diff file headers without tabs
Date: Thu, 9 Apr 2015 00:38:55 +0200

On Wed, Apr 8, 2015 at 10:50 PM, Stefan Monnier <monnier@iro.umontreal.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:

  $ 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


reply via email to

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