mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-24 12:00:24 +10:00
Updating Doom Emacs.
This commit is contained in:
@@ -23,5 +23,12 @@
|
||||
("m" git-gutter:mark-hunk)
|
||||
("p" git-gutter:popup-hunk)
|
||||
("R" git-gutter:set-start-revision)
|
||||
("q" nil :color blue)
|
||||
("Q" (git-gutter-mode -1) :color blue))
|
||||
("q"
|
||||
(when (get-buffer git-gutter:popup-buffer)
|
||||
(kill-buffer (get-buffer git-gutter:popup-buffer)))
|
||||
:color blue)
|
||||
("Q"
|
||||
(progn (git-gutter-mode -1)
|
||||
(when (get-buffer git-gutter:popup-buffer)
|
||||
(kill-buffer (get-buffer git-gutter:popup-buffer))))
|
||||
:color blue))
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
diffing, even for unsaved buffers.")
|
||||
|
||||
(defvar +vc-gutter-default-style t
|
||||
"If non-nil, enable the default look of the vc gutter. This means subtle thin
|
||||
bitmaps on the left, an arrow bitmap for flycheck, and flycheck indicators moved
|
||||
to the right fringe.")
|
||||
"If non-nil, enable the default look of the vc gutter.
|
||||
This means subtle thin bitmaps on the left, an arrow bitmap for flycheck, and
|
||||
flycheck indicators moved to the right fringe.")
|
||||
|
||||
|
||||
;;
|
||||
;; Packages
|
||||
;;; Packages
|
||||
|
||||
(use-package! git-gutter
|
||||
:commands git-gutter:revert-hunk git-gutter:stage-hunk
|
||||
@@ -28,42 +28,43 @@ to the right fringe.")
|
||||
|
||||
If the buffer doesn't represent an existing file, `git-gutter-mode's activation
|
||||
is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
||||
(when (or +vc-gutter-in-remote-files
|
||||
(not (file-remote-p (or buffer-file-name default-directory))))
|
||||
(if (not buffer-file-name)
|
||||
(add-hook 'after-save-hook #'+vc-gutter-init-maybe-h nil 'local)
|
||||
(when (and (vc-backend buffer-file-name)
|
||||
(progn
|
||||
(require 'git-gutter)
|
||||
(not (memq major-mode git-gutter:disabled-modes))))
|
||||
(if (and (display-graphic-p)
|
||||
(require 'git-gutter-fringe nil t))
|
||||
(progn
|
||||
(setq-local git-gutter:init-function #'git-gutter-fr:init)
|
||||
(setq-local git-gutter:view-diff-function #'git-gutter-fr:view-diff-infos)
|
||||
(setq-local git-gutter:clear-function #'git-gutter-fr:clear)
|
||||
(setq-local git-gutter:window-width -1))
|
||||
(setq-local git-gutter:init-function 'nil)
|
||||
(setq-local git-gutter:view-diff-function #'git-gutter:view-diff-infos)
|
||||
(setq-local git-gutter:clear-function #'git-gutter:clear-diff-infos)
|
||||
(setq-local git-gutter:window-width 1))
|
||||
(git-gutter-mode +1)
|
||||
(remove-hook 'after-save-hook #'+vc-gutter-init-maybe-h 'local))))))
|
||||
(let ((file-name (buffer-file-name (buffer-base-buffer))))
|
||||
(when (or +vc-gutter-in-remote-files
|
||||
(not (file-remote-p (or file-name default-directory))))
|
||||
(if (null file-name)
|
||||
(add-hook 'after-save-hook #'+vc-gutter-init-maybe-h nil 'local)
|
||||
(when (and (vc-backend file-name)
|
||||
(progn
|
||||
(require 'git-gutter)
|
||||
(not (memq major-mode git-gutter:disabled-modes))))
|
||||
(if (and (display-graphic-p)
|
||||
(require 'git-gutter-fringe nil t))
|
||||
(setq-local git-gutter:init-function #'git-gutter-fr:init
|
||||
git-gutter:view-diff-function #'git-gutter-fr:view-diff-infos
|
||||
git-gutter:clear-function #'git-gutter-fr:clear
|
||||
git-gutter:window-width -1)
|
||||
(setq-local git-gutter:init-function 'nil
|
||||
git-gutter:view-diff-function #'git-gutter:view-diff-infos
|
||||
git-gutter:clear-function #'git-gutter:clear-diff-infos
|
||||
git-gutter:window-width 1))
|
||||
(git-gutter-mode +1)
|
||||
(remove-hook 'after-save-hook #'+vc-gutter-init-maybe-h 'local)))))))
|
||||
|
||||
;; Disable in Org mode, as per
|
||||
;; <https://github.com/syl20bnr/spacemacs/issues/10555> and
|
||||
;; <https://github.com/syohex/emacs-git-gutter/issues/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 this is the case, but adding `fundamental-mode'
|
||||
;; here fixes the issue.
|
||||
;; 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
|
||||
;; this is the case, but adding `fundamental-mode' here fixes the issue.
|
||||
(setq git-gutter:disabled-modes '(fundamental-mode image-mode pdf-view-mode))
|
||||
|
||||
;; standardize default fringe width
|
||||
(if (fboundp 'fringe-mode) (fringe-mode '4))
|
||||
: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.
|
||||
(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)
|
||||
(add-hook 'focus-in-hook #'git-gutter:update-all-windows)
|
||||
|
||||
@@ -73,7 +74,8 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
||||
`doom-escape-hook' hooks."
|
||||
(when (and git-gutter-mode
|
||||
(not (memq this-command '(git-gutter:stage-hunk
|
||||
git-gutter:revert-hunk))))
|
||||
git-gutter:revert-hunk)))
|
||||
(not inhibit-redisplay))
|
||||
(ignore (git-gutter)))))
|
||||
;; update git-gutter when using magit commands
|
||||
(advice-add #'magit-stage-file :after #'+vc-gutter-update-h)
|
||||
@@ -92,8 +94,11 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
||||
|
||||
|
||||
;; subtle diff indicators in the fringe
|
||||
(when +vc-gutter-default-style
|
||||
(after! git-gutter-fringe
|
||||
(after! git-gutter-fringe
|
||||
(when +vc-gutter-default-style
|
||||
;; standardize default fringe width
|
||||
(if (fboundp 'fringe-mode) (fringe-mode '4))
|
||||
|
||||
;; places the git gutter outside the margins.
|
||||
(setq-default fringes-outside-margins t)
|
||||
;; thin fringe bitmaps
|
||||
@@ -102,10 +107,12 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
||||
(define-fringe-bitmap 'git-gutter-fr:modified [224]
|
||||
nil nil '(center repeated))
|
||||
(define-fringe-bitmap 'git-gutter-fr:deleted [128 192 224 240]
|
||||
nil nil 'bottom)
|
||||
nil nil 'bottom)))
|
||||
|
||||
(after! flycheck
|
||||
(when +vc-gutter-default-style
|
||||
;; let diff have left fringe, flycheck can have right fringe
|
||||
(after! flycheck
|
||||
(setq flycheck-indication-mode 'right-fringe)
|
||||
;; A non-descript, left-pointing arrow
|
||||
(define-fringe-bitmap 'flycheck-fringe-bitmap-double-arrow
|
||||
[16 48 112 240 112 48 16] nil nil 'center))))
|
||||
(setq flycheck-indication-mode 'right-fringe)
|
||||
;; A non-descript, left-pointing arrow
|
||||
(define-fringe-bitmap 'flycheck-fringe-bitmap-double-arrow
|
||||
[16 48 112 240 112 48 16] nil nil 'center)))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; ui/vc-gutter/packages.el
|
||||
|
||||
(package! git-gutter-fringe)
|
||||
(package! git-gutter-fringe :pin "da19a474137876b29b5658ee7e9ae366f2b65c1d")
|
||||
|
||||
Reference in New Issue
Block a user