ui/vc-gutter: minor refactor
This commit is contained in:
parent
a912a6c313
commit
d9dac055a6
1 changed files with 8 additions and 8 deletions
|
@ -73,12 +73,12 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
||||||
(defun +vc-gutter-update-h (&rest _)
|
(defun +vc-gutter-update-h (&rest _)
|
||||||
"Refresh git-gutter on ESC. Return nil to prevent shadowing other
|
"Refresh git-gutter on ESC. Return nil to prevent shadowing other
|
||||||
`doom-escape-hook' hooks."
|
`doom-escape-hook' hooks."
|
||||||
(unless (or (memq this-command '(git-gutter:stage-hunk
|
(ignore (or (memq this-command '(git-gutter:stage-hunk
|
||||||
git-gutter:revert-hunk))
|
git-gutter:revert-hunk))
|
||||||
inhibit-redisplay)
|
inhibit-redisplay
|
||||||
(ignore (if git-gutter-mode
|
(if git-gutter-mode
|
||||||
(git-gutter)
|
(git-gutter)
|
||||||
(+vc-gutter-init-maybe-h))))))
|
(+vc-gutter-init-maybe-h))))))
|
||||||
;; update git-gutter when using magit commands
|
;; update git-gutter when using magit commands
|
||||||
(advice-add #'magit-stage-file :after #'+vc-gutter-update-h)
|
(advice-add #'magit-stage-file :after #'+vc-gutter-update-h)
|
||||||
(advice-add #'magit-unstage-file :after #'+vc-gutter-update-h)
|
(advice-add #'magit-unstage-file :after #'+vc-gutter-update-h)
|
||||||
|
@ -87,9 +87,9 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
||||||
"Fixes `git-gutter:next-hunk' and `git-gutter:previous-hunk' sometimes
|
"Fixes `git-gutter:next-hunk' and `git-gutter:previous-hunk' sometimes
|
||||||
jumping to random hunks."
|
jumping to random hunks."
|
||||||
:override #'git-gutter:search-near-diff-index
|
:override #'git-gutter:search-near-diff-index
|
||||||
(cl-position-if (let ((lineno (line-number-at-pos)))
|
(cl-position-if (let ((lineno (line-number-at-pos))
|
||||||
(lambda (line)
|
(fn (if is-reverse #'> #'<)))
|
||||||
(funcall (if is-reverse #'> #'<) lineno line)))
|
(lambda (line) (funcall fn lineno line)))
|
||||||
diffinfos
|
diffinfos
|
||||||
:key #'git-gutter-hunk-start-line
|
:key #'git-gutter-hunk-start-line
|
||||||
:from-end is-reverse)))
|
:from-end is-reverse)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue