summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2019-03-25 13:20:17 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2019-03-25 13:20:17 -0400
commit491885030c29f46d688c9b0325f95feccd8d653e (patch)
treed2cd1d3f6676b9f288625607e132c7dabf0596ed
parentb7a98993789d18bc675798d49038982d5cf41683 (diff)
downloademacs-491885030c29f46d688c9b0325f95feccd8d653e.tar.gz
* 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.
-rw-r--r--lisp/vc/diff-mode.el5
1 files 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)