aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/vc
diff options
context:
space:
mode:
authorStefan Monnier2012-10-26 11:51:42 -0400
committerStefan Monnier2012-10-26 11:51:42 -0400
commita2be03575f558aa741e40cd96fbe208092c3a1e7 (patch)
treef55caebff8382e8dafc8c71f43d8ee1e892ee00f /lisp/vc
parent00323fb326b63bed91aadbef861a234f9299cdbc (diff)
downloademacs-a2be03575f558aa741e40cd96fbe208092c3a1e7.tar.gz
emacs-a2be03575f558aa741e40cd96fbe208092c3a1e7.zip
* lisp/vc/diff-mode.el (diff-end-of-hunk): Also skip potential "no LF at eol".
(diff-refine-hunk): Similarly, handle the "no LF at eol". Fixes: debbugs:12584
Diffstat (limited to 'lisp/vc')
-rw-r--r--lisp/vc/diff-mode.el23
1 files changed, 16 insertions, 7 deletions
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index cdcc7ca4745..bbe31205c0e 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -478,11 +478,13 @@ See http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01990.html")
478 (let* ((nold (string-to-number (or (match-string 2) "1"))) 478 (let* ((nold (string-to-number (or (match-string 2) "1")))
479 (nnew (string-to-number (or (match-string 4) "1"))) 479 (nnew (string-to-number (or (match-string 4) "1")))
480 (endold 480 (endold
481 (save-excursion 481 (save-excursion
482 (re-search-forward (if diff-valid-unified-empty-line 482 (re-search-forward (if diff-valid-unified-empty-line
483 "^[- \n]" "^[- ]") 483 "^[- \n]" "^[- ]")
484 nil t nold) 484 nil t nold)
485 (line-beginning-position 2))) 485 (line-beginning-position
486 ;; Skip potential "\ No newline at end of file".
487 (if (looking-at ".*\n\\\\") 3 2))))
486 (endnew 488 (endnew
487 ;; The hunk may end with a bunch of "+" lines, so the `end' is 489 ;; The hunk may end with a bunch of "+" lines, so the `end' is
488 ;; then further than computed above. 490 ;; then further than computed above.
@@ -490,7 +492,9 @@ See http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01990.html")
490 (re-search-forward (if diff-valid-unified-empty-line 492 (re-search-forward (if diff-valid-unified-empty-line
491 "^[+ \n]" "^[+ ]") 493 "^[+ \n]" "^[+ ]")
492 nil t nnew) 494 nil t nnew)
493 (line-beginning-position 2)))) 495 (line-beginning-position
496 ;; Skip potential "\ No newline at end of file".
497 (if (looking-at ".*\n\\\\") 3 2)))))
494 (setq end (max endold endnew))))) 498 (setq end (max endold endnew)))))
495 ;; We may have a first evaluation of `end' thanks to the hunk header. 499 ;; We may have a first evaluation of `end' thanks to the hunk header.
496 (unless end 500 (unless end
@@ -1972,8 +1976,13 @@ For use in `add-log-current-defun-function'."
1972 (goto-char beg) 1976 (goto-char beg)
1973 (pcase style 1977 (pcase style
1974 (`unified 1978 (`unified
1975 (while (re-search-forward "^\\(?:-.*\n\\)+\\(\\)\\(?:\\+.*\n\\)+" 1979 (while (re-search-forward
1976 end t) 1980 (eval-when-compile
1981 (let ((no-LF-at-eol-re "\\(?:\\\\.*\n\\)?"))
1982 (concat "^\\(?:-.*\n\\)+" no-LF-at-eol-re
1983 "\\(\\)"
1984 "\\(?:\\+.*\n\\)+" no-LF-at-eol-re)))
1985 end t)
1977 (smerge-refine-subst (match-beginning 0) (match-end 1) 1986 (smerge-refine-subst (match-beginning 0) (match-end 1)
1978 (match-end 1) (match-end 0) 1987 (match-end 1) (match-end 0)
1979 nil 'diff-refine-preproc props-r props-a))) 1988 nil 'diff-refine-preproc props-r props-a)))