File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -142,6 +142,11 @@ enclosed in a `progn' form. ELSE-FORMS may be empty."
142142 :group 'diff-hl
143143 :type 'boolean )
144144
145+ (defcustom diff-hl-next-previous-hunk-auto-recenter nil
146+ " Non-nil to `recenter' after `diff-hl-next-hunk' and `diff-hl-previous-hunk' ."
147+ :group 'diff-hl
148+ :type 'boolean )
149+
145150(defcustom diff-hl-fallback-to-margin t
146151 " Non-nil to use margin instead of fringe on non-graphic displays.
147152
@@ -1110,17 +1115,20 @@ its end position."
11101115 " Go to the beginning of the next hunk in the current buffer."
11111116 (interactive )
11121117 (let ((overlay (diff-hl-search-next-hunk backward)))
1113- (if overlay
1114- (goto-char (overlay-start overlay))
1115- (user-error " No further hunks found" ))))
1118+ (unless overlay
1119+ (user-error " No further hunks found" ))
1120+ (goto-char (overlay-start overlay))
1121+ (when diff-hl-next-previous-hunk-auto-recenter
1122+ (recenter ))))
11161123
11171124(defun diff-hl-previous-hunk ()
11181125 " Go to the beginning of the previous hunk in the current buffer."
11191126 (interactive )
11201127 (diff-hl-next-hunk t ))
11211128
11221129(defun diff-hl-find-current-hunk ()
1123- (let (o)
1130+ (let ((o)
1131+ (diff-hl-next-previous-hunk-auto-recenter nil ))
11241132 (cond
11251133 ((diff-hl-hunk-overlay-at (point )))
11261134 ((setq o (diff-hl-search-next-hunk t ))
You can’t perform that action at this time.
0 commit comments