nit(vc-gutter): add summary tags to comments
A new convention I'm slowly rolling out to modules to help readers quickly identify the purpose of a change. E.g. UX - a change done to improve user experience STYLE - for aesthetics FIX - addresses a perceived or potential issue PERF - intended to improve performance Combined tags will be delimited with commas. E.g. "UX,PERF:" There may be more later, and these will be further documented in the new docs about to come up.
This commit is contained in:
parent
8191607093
commit
de62c5449d
1 changed files with 10 additions and 10 deletions
|
@ -77,13 +77,13 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
||||||
(cond
|
(cond
|
||||||
((and (file-remote-p (or file-name default-directory))
|
((and (file-remote-p (or file-name default-directory))
|
||||||
(not +vc-gutter-in-remote-files)))
|
(not +vc-gutter-in-remote-files)))
|
||||||
;; If not a valid file, wait until it is written/saved to activate
|
;; UX: If not a valid file, wait until it is written/saved to activate
|
||||||
;; git-gutter.
|
;; git-gutter.
|
||||||
((not (and file-name (vc-backend file-name)))
|
((not (and file-name (vc-backend file-name)))
|
||||||
(add-hook 'after-save-hook #'+vc-gutter-init-maybe-h nil 'local))
|
(add-hook 'after-save-hook #'+vc-gutter-init-maybe-h nil 'local))
|
||||||
;; Allow git-gutter or git-gutter-fringe to activate based on the type
|
;; UX: Allow git-gutter or git-gutter-fringe to activate based on the
|
||||||
;; of frame we're in. This allows git-gutter to work for silly geese
|
;; type of frame we're in. This allows git-gutter to work for silly
|
||||||
;; who open both tty and gui frames from the daemon.
|
;; geese who open both tty and gui frames from the daemon.
|
||||||
((if (and (display-graphic-p)
|
((if (and (display-graphic-p)
|
||||||
(require 'git-gutter-fringe nil t))
|
(require 'git-gutter-fringe nil t))
|
||||||
(setq-local git-gutter:init-function #'git-gutter-fr:init
|
(setq-local git-gutter:init-function #'git-gutter-fr:init
|
||||||
|
@ -98,7 +98,7 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
||||||
(git-gutter-mode +1)
|
(git-gutter-mode +1)
|
||||||
(remove-hook 'after-save-hook #'+vc-gutter-init-maybe-h 'local)))))))
|
(remove-hook 'after-save-hook #'+vc-gutter-init-maybe-h 'local)))))))
|
||||||
|
|
||||||
;; Disable in Org mode, as per syl20bnr/spacemacs#10555 and
|
;; UX: Disable in Org mode, as per syl20bnr/spacemacs#10555 and
|
||||||
;; syohex/emacs-git-gutter#24. Apparently, the mode-enabling function for
|
;; syohex/emacs-git-gutter#24. Apparently, the mode-enabling function for
|
||||||
;; global minor modes gets called for new buffers while they are still in
|
;; global minor modes gets called for new buffers while they are still in
|
||||||
;; `fundamental-mode', before a major mode has been assigned. I don't know why
|
;; `fundamental-mode', before a major mode has been assigned. I don't know why
|
||||||
|
@ -107,13 +107,13 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
||||||
:config
|
:config
|
||||||
(set-popup-rule! "^\\*git-gutter" :select nil :size '+popup-shrink-to-fit)
|
(set-popup-rule! "^\\*git-gutter" :select nil :size '+popup-shrink-to-fit)
|
||||||
|
|
||||||
;; Only enable the backends that are available, so it doesn't have to check
|
;; PERF: Only enable the backends that are available, so it doesn't have to
|
||||||
;; when opening each buffer.
|
;; check when opening each buffer.
|
||||||
(setq git-gutter:handled-backends
|
(setq git-gutter:handled-backends
|
||||||
(cons 'git (cl-remove-if-not #'executable-find (list 'hg 'svn 'bzr)
|
(cons 'git (cl-remove-if-not #'executable-find (list 'hg 'svn 'bzr)
|
||||||
:key #'symbol-name)))
|
:key #'symbol-name)))
|
||||||
|
|
||||||
;; Update git-gutter on focus (in case I was using git externally)
|
;; UX: update git-gutter on focus (in case I was using git externally)
|
||||||
(add-hook 'focus-in-hook #'git-gutter:update-all-windows)
|
(add-hook 'focus-in-hook #'git-gutter:update-all-windows)
|
||||||
|
|
||||||
(add-hook! '(doom-escape-hook doom-switch-window-hook) :append
|
(add-hook! '(doom-escape-hook doom-switch-window-hook) :append
|
||||||
|
@ -126,12 +126,12 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
||||||
(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
|
;; UX: 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)
|
||||||
|
|
||||||
(defadvice! +vc-gutter--fix-linearity-of-hunks-a (diffinfos is-reverse)
|
(defadvice! +vc-gutter--fix-linearity-of-hunks-a (diffinfos is-reverse)
|
||||||
"Fixes `git-gutter:next-hunk' and `git-gutter:previous-hunk' sometimes
|
"FIX: `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))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue