From: Stefan Monnier Date: Wed, 12 Sep 2007 05:11:07 +0000 (+0000) Subject: (diff-sanity-check-hunk): Fix up the case when unified X-Git-Tag: emacs-pretest-22.1.90~840 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=80a01d975acd7aaaa420458c057f29e46a8dbc8e;p=emacs.git (diff-sanity-check-hunk): Fix up the case when unified diffs are concatenated with no intervening line. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c3d8fd8b92d..058a355a929 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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 --git a/lisp/diff-mode.el b/lisp/diff-mode.el index 7cd7375ab98..ab12c6133f2 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el @@ -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