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:
Henrik Lissner 2022-08-10 14:06:52 +02:00
parent 8191607093
commit de62c5449d
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -77,13 +77,13 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
(cond
((and (file-remote-p (or file-name default-directory))
(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.
((not (and file-name (vc-backend file-name)))
(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
;; of frame we're in. This allows git-gutter to work for silly geese
;; who open both tty and gui frames from the daemon.
;; UX: Allow git-gutter or git-gutter-fringe to activate based on the
;; type of frame we're in. This allows git-gutter to work for silly
;; geese who open both tty and gui frames from the daemon.
((if (and (display-graphic-p)
(require 'git-gutter-fringe nil t))
(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)
(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
;; 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
@ -107,13 +107,13 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
:config
(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
;; when opening each buffer.
;; PERF: Only enable the backends that are available, so it doesn't have to
;; check when opening each buffer.
(setq git-gutter:handled-backends
(cons 'git (cl-remove-if-not #'executable-find (list 'hg 'svn 'bzr)
: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! '(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
(git-gutter)
(+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-unstage-file :after #'+vc-gutter-update-h)
(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."
:override #'git-gutter:search-near-diff-index
(cl-position-if (let ((lineno (line-number-at-pos))