Mercurial > emacs
diff lisp/diff-mode.el @ 93759:4e76a03232e5
Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1107
| author | Miles Bader <miles@gnu.org> |
|---|---|
| date | Sat, 05 Apr 2008 23:01:26 +0000 |
| parents | 3636fd479ab3 448b3f1d280a |
| children | 28e6262d77ad |
line wrap: on
line diff
--- a/lisp/diff-mode.el Sat Apr 05 21:40:16 2008 +0000 +++ b/lisp/diff-mode.el Sat Apr 05 23:01:26 2008 +0000 @@ -438,12 +438,23 @@ (setq style (diff-hunk-style style)) (goto-char (match-end 0)) (when (and (not donttrustheader) (match-end 2)) + (let* ((nold (string-to-number (match-string 2))) + (nnew (string-to-number (match-string 4))) + (endold (save-excursion (re-search-forward (if diff-valid-unified-empty-line "^[- \n]" "^[- ]") - nil t - (string-to-number (match-string 2))) - (setq end (line-beginning-position 2))))) + nil t nold) + (line-beginning-position 2))) + (endnew + ;; The hunk may end with a bunch of "+" lines, so the `end' is + ;; then further than computed above. + (save-excursion + (re-search-forward (if diff-valid-unified-empty-line + "^[+ \n]" "^[+ ]") + nil t nnew) + (line-beginning-position 2)))) + (setq end (max endold endnew))))) ;; We may have a first evaluation of `end' thanks to the hunk header. (unless end (setq end (and (re-search-forward
