Skip to content

Commit f202e46

Browse files
committed
Simplify diff-refine integration
1 parent f8ffd77 commit f202e46

1 file changed

Lines changed: 5 additions & 18 deletions

File tree

diff-hl.el

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -605,15 +605,7 @@ contents as they are (or would be) after applying the changes in NEW."
605605
(let (res)
606606
(goto-char (point-min))
607607
(unless (eobp)
608-
;; TODO: When 27.1 is the minimum requirement, we can drop
609-
;; these bindings: that version, in addition to switching over
610-
;; called-interactively-p check, so refinement can't be
611-
;; triggered by code calling the navigation functions, only by
612-
;; direct interactive invocations.
613-
(ignore-errors
614-
(with-no-warnings
615-
(let (diff-auto-refine-mode)
616-
(diff-beginning-of-hunk t))))
608+
(diff-beginning-of-hunk t)
617609
(while (looking-at diff-hunk-header-re-unified)
618610
(let ((line (string-to-number (match-string 3)))
619611
(beg (point)))
@@ -1051,9 +1043,7 @@ that file, if it's present."
10511043
(when (eobp)
10521044
(with-current-buffer buffer (diff-hl-remove-overlays))
10531045
(user-error "Buffer is up-to-date"))
1054-
(with-no-warnings
1055-
(let (diff-auto-refine-mode)
1056-
(diff-hl-diff-skip-to line)))
1046+
(diff-hl-diff-skip-to line)
10571047
(setq m-end (diff-hl-split-away-changes 3))
10581048
(setq m-beg (point-marker))
10591049
(funcall diff-hl-highlight-revert-hunk-function m-end)
@@ -1063,9 +1053,8 @@ that file, if it's present."
10631053
(if (>= wbh (- end-line beg-line))
10641054
(recenter (/ (+ wbh (- beg-line end-line) 2) 2))
10651055
(recenter 1)))
1066-
(with-no-warnings
1067-
(when diff-auto-refine-mode
1068-
(diff-refine-hunk)))
1056+
(when (eq diff-refine 'navigation)
1057+
(diff-refine-hunk))
10691058
(if diff-hl-ask-before-revert-hunk
10701059
(unless (yes-or-no-p (format "Revert current hunk in %s? "
10711060
file))
@@ -1208,9 +1197,7 @@ Only supported with Git."
12081197
diff-hl-update-async)
12091198
(diff-hl-diff-buffer-with-reference file dest-buffer nil 3))
12101199
(with-current-buffer dest-buffer
1211-
(with-no-warnings
1212-
(let (diff-auto-refine-mode)
1213-
(diff-hl-diff-skip-to line)))
1200+
(diff-hl-diff-skip-to line)
12141201
(let ((inhibit-read-only t))
12151202
(diff-hl-split-away-changes 3)
12161203
(save-excursion

0 commit comments

Comments
 (0)