summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2020-09-13 17:25:08 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-09-13 17:25:08 +0200
commit54c2a8df3bfaec2141bdf9a11fca59f6d3a58558 (patch)
tree5c18b1d3adbac970e827f3dcc1c0511d19c5df9c
parentdc01b992e27e91631e67bb94f32c23275f1eacfd (diff)
downloademacs-54c2a8df3bfaec2141bdf9a11fca59f6d3a58558.tar.gz
Make diff--refine-hunk bug out less on broken patches
* lisp/vc/diff-mode.el (diff--refine-hunk): Don't bug out on broken patches where we can't find the middle.
-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 1a80d13abde..f223ae48f3b 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2173,9 +2173,10 @@ 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 "^---" end)))
+ (let* ((middle (save-excursion (re-search-forward "^---" end t)))
(other middle))
- (while (re-search-forward "^\\(?:!.*\n\\)+" middle t)
+ (while (and middle
+ (re-search-forward "^\\(?:!.*\n\\)+" middle t))
(smerge-refine-regions (match-beginning 0) (match-end 0)
(save-excursion
(goto-char other)