# HG changeset patch # User Stefan Monnier # Date 1189573867 0 # Node ID c41c1aee3d31691db8c51eb7d9db04e13a9dc960 # Parent 38a441bc45326a091b961c3f419345e3084a289b (diff-sanity-check-hunk): Fix up the case when unified diffs are concatenated with no intervening line. diff -r 38a441bc4532 -r c41c1aee3d31 lisp/ChangeLog --- a/lisp/ChangeLog Mon Sep 10 20:02:31 2007 +0000 +++ b/lisp/ChangeLog Wed Sep 12 05:11:07 2007 +0000 @@ -1,3 +1,8 @@ +2007-09-12 Stefan Monnier + + * diff-mode.el (diff-sanity-check-hunk): Fix up the case when unified + diffs are concatenated with no intervening line. + 2007-09-10 Dave Love * progmodes/python.el: Merge changes from Dave Love's v2007-Sep-10. diff -r 38a441bc4532 -r c41c1aee3d31 lisp/diff-mode.el --- a/lisp/diff-mode.el Mon Sep 10 20:02:31 2007 +0000 +++ b/lisp/diff-mode.el Wed Sep 12 05:11:07 2007 +0000 @@ -1181,7 +1181,16 @@ (while (case (char-after) (?\s (decf before) (decf after) t) - (?- (decf before) t) + (?- + (if (and (looking-at diff-file-header-re) + (zerop before) (zerop after)) + ;; No need to query: this is a case where two patches + ;; are concatenated and only counting the lines will + ;; give the right result. Let's just add an empty + ;; line so that our code which doesn't count lines + ;; will not get confused. + (progn (save-excursion (insert "\n")) nil) + (decf before) t)) (?+ (decf after) t) (t (cond