aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/diff-mode.el
diff options
context:
space:
mode:
authorStefan Monnier2008-03-18 20:49:52 +0000
committerStefan Monnier2008-03-18 20:49:52 +0000
commitaec1ef0729fecde2dc7c322d6bbd52858104d2b7 (patch)
treef11cf6f933b332b8f4af7bcb41a774029f51844c /lisp/diff-mode.el
parent117402b86d9199a8ff226075f804d2f8908dac9e (diff)
downloademacs-aec1ef0729fecde2dc7c322d6bbd52858104d2b7.tar.gz
emacs-aec1ef0729fecde2dc7c322d6bbd52858104d2b7.zip
(diff-end-of-hunk): Be careful not to overlook trailing
"+" lines not accounted for by counting "-" and context lines.
Diffstat (limited to 'lisp/diff-mode.el')
-rw-r--r--lisp/diff-mode.el17
1 files changed, 14 insertions, 3 deletions
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el
index c57613dff51..798f5f2e4ec 100644
--- a/lisp/diff-mode.el
+++ b/lisp/diff-mode.el
@@ -402,12 +402,23 @@ See http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01990.html")
402 (setq style (cdr (assq (char-after) '((?@ . unified) (?* . context)))))) 402 (setq style (cdr (assq (char-after) '((?@ . unified) (?* . context))))))
403 (goto-char (match-end 0)) 403 (goto-char (match-end 0))
404 (when (and (not donttrustheader) (match-end 2)) 404 (when (and (not donttrustheader) (match-end 2))
405 (let* ((nold (string-to-number (match-string 2)))
406 (nnew (string-to-number (match-string 4)))
407 (endold
405 (save-excursion 408 (save-excursion
406 (re-search-forward (if diff-valid-unified-empty-line 409 (re-search-forward (if diff-valid-unified-empty-line
407 "^[- \n]" "^[- ]") 410 "^[- \n]" "^[- ]")
408 nil t 411 nil t nold)
409 (string-to-number (match-string 2))) 412 (line-beginning-position 2)))
410 (setq end (line-beginning-position 2))))) 413 (endnew
414 ;; The hunk may end with a bunch of "+" lines, so the `end' is
415 ;; then further than computed above.
416 (save-excursion
417 (re-search-forward (if diff-valid-unified-empty-line
418 "^[+ \n]" "^[+ ]")
419 nil t nnew)
420 (line-beginning-position 2))))
421 (setq end (max endold endnew)))))
411 ;; We may have a first evaluation of `end' thanks to the hunk header. 422 ;; We may have a first evaluation of `end' thanks to the hunk header.
412 (unless end 423 (unless end
413 (setq end (and (re-search-forward 424 (setq end (and (re-search-forward