changeset 78756:c41c1aee3d31

(diff-sanity-check-hunk): Fix up the case when unified diffs are concatenated with no intervening line.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 12 Sep 2007 05:11:07 +0000
parents 38a441bc4532
children 9245883365c0
files lisp/ChangeLog lisp/diff-mode.el
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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  <monnier@iro.umontreal.ca>
+
+	* 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  <fx@gnu.org>
 
 	* progmodes/python.el: Merge changes from Dave Love's v2007-Sep-10.
--- 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