From 491885030c29f46d688c9b0325f95feccd8d653e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 25 Mar 2019 13:20:17 -0400 Subject: [PATCH] * lisp/vc/diff-mode.el: Better handle empty lines in context diffs (diff-end-of-hunk): Obey diff-valid-unified-empty-line for context style. (diff--refine-hunk): Don't look further than the end. --- lisp/vc/diff-mode.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 40204404e77..b67caab7f50 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -533,7 +533,8 @@ See https://lists.gnu.org/r/emacs-devel/2007-11/msg01990.html") "^[^-+# \\\n]\\|" "^[^-+# \\]\\|") ;; A `unified' header is ambiguous. diff-file-header-re)) - ('context "^[^-+#! \\]") + ('context (if diff-valid-unified-empty-line + "^[^-+#! \n\\]" "^[^-+#! \\]")) ('normal "^[^<>#\\]") (_ "^[^-+#!<> \\]")) nil t) @@ -2116,7 +2117,7 @@ Return new point, if it was moved." (smerge-refine-regions beg-del beg-add beg-add end-add nil #'diff-refine-preproc props-r props-a))))) ('context - (let* ((middle (save-excursion (re-search-forward "^---"))) + (let* ((middle (save-excursion (re-search-forward "^---" end))) (other middle)) (while (re-search-forward "^\\(?:!.*\n\\)+" middle t) (smerge-refine-regions (match-beginning 0) (match-end 0) -- 2.39.5