From 4da5eff696b23e52642aa5ee154531f693a35695 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Tue, 29 Sep 2015 21:46:56 +0300 Subject: [PATCH] diff-hl-revert-hunk: Refine the right hunk Closes #35 --- diff-hl.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/diff-hl.el b/diff-hl.el index 8790352f1..61272d501 100644 --- a/diff-hl.el +++ b/diff-hl.el @@ -391,7 +391,8 @@ in the source file, or the last line of the hunk above it." (when (eobp) (with-current-buffer ,buffer (diff-hl-remove-overlays)) (error "Buffer is up-to-date")) - (diff-hl-diff-skip-to ,line) + (let (diff-auto-refine-mode) + (diff-hl-diff-skip-to ,line)) (save-excursion (while (looking-at "[-+]") (forward-line 1)) (setq end-line (line-number-at-pos (point))) @@ -406,6 +407,8 @@ in the source file, or the last line of the hunk above it." (if (>= wbh (- end-line beg-line)) (recenter (/ (+ wbh (- beg-line end-line) 2) 2)) (recenter 1))) + (when diff-auto-refine-mode + (diff-refine-hunk)) (unless (yes-or-no-p (format "Revert current hunk in %s?" ,(cl-caadr fileset))) (error "Revert canceled")) -- 2.39.2