summaryrefslogtreecommitdiff
path: root/lisp/diff-mode.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2007-09-12 05:11:07 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2007-09-12 05:11:07 +0000
commit80a01d975acd7aaaa420458c057f29e46a8dbc8e (patch)
tree901b83171f5af96f90d56cc46140eaaca1c92b14 /lisp/diff-mode.el
parent308114ef9f06dd70ad50983a0c2504e064dadd52 (diff)
downloademacs-80a01d975acd7aaaa420458c057f29e46a8dbc8e.tar.gz
(diff-sanity-check-hunk): Fix up the case when unified
diffs are concatenated with no intervening line.
Diffstat (limited to 'lisp/diff-mode.el')
-rw-r--r--lisp/diff-mode.el11
1 files changed, 10 insertions, 1 deletions
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