]> git.eshelyaron.com Git - emacs.git/commitdiff
(diff-sanity-check-hunk): Fix up the case when unified
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 12 Sep 2007 05:11:07 +0000 (05:11 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 12 Sep 2007 05:11:07 +0000 (05:11 +0000)
diffs are concatenated with no intervening line.

lisp/ChangeLog
lisp/diff-mode.el

index c3d8fd8b92d371246f5f05ab697840d14ea6a9bc..058a355a929ebe59ed7568f2fd3696cc6189bccd 100644 (file)
@@ -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.
index 7cd7375ab98fc8d0d8e290f25e2c92cdfe48bd36..ab12c6133f28103b9a528cd7f93e96d88ebccc5d 100644 (file)
@@ -1181,7 +1181,16 @@ Only works for unified diffs."
             (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