emacs/vc: refactor
And declare vc, vc-annotate & smerge-mode as built-ins (for doom/help-packages).
This commit is contained in:
parent
ada5990f88
commit
47530bd19f
2 changed files with 25 additions and 25 deletions
|
@ -1,6 +1,8 @@
|
||||||
;;; emacs/vc/config.el -*- lexical-binding: t; -*-
|
;;; emacs/vc/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; `git-timemachine'
|
(setq vc-make-backup-files nil)
|
||||||
|
|
||||||
|
|
||||||
(after! git-timemachine
|
(after! git-timemachine
|
||||||
;; Sometimes I forget `git-timemachine' is enabled in a buffer, so instead of
|
;; Sometimes I forget `git-timemachine' is enabled in a buffer, so instead of
|
||||||
;; showing revision details in the minibuffer, show them in
|
;; showing revision details in the minibuffer, show them in
|
||||||
|
@ -16,33 +18,28 @@
|
||||||
(add-transient-hook! #'git-timemachine-blame (require 'magit-blame))))
|
(add-transient-hook! #'git-timemachine-blame (require 'magit-blame))))
|
||||||
|
|
||||||
|
|
||||||
;; `git-commit-mode'
|
;;;###package git-commit
|
||||||
(after! git-commit-mode
|
(def-package! git-commit
|
||||||
(set-yas-minor-mode! 'git-commit-mode))
|
:after-call after-find-file
|
||||||
|
:config
|
||||||
|
(global-git-commit-mode +1)
|
||||||
|
(set-yas-minor-mode! 'git-commit-mode)
|
||||||
|
|
||||||
(defun +vc|enforce-git-commit-conventions ()
|
(defun +vc|enforce-git-commit-conventions ()
|
||||||
"See https://chris.beams.io/posts/git-commit/"
|
"See https://chris.beams.io/posts/git-commit/"
|
||||||
(setq fill-column 72
|
(setq fill-column 72
|
||||||
git-commit-summary-max-length 50
|
git-commit-summary-max-length 50
|
||||||
git-commit-style-convention-checks '(overlong-summary-line non-empty-second-line)))
|
git-commit-style-convention-checks '(overlong-summary-line non-empty-second-line)))
|
||||||
(add-hook 'git-commit-mode-hook #'+vc|enforce-git-commit-conventions)
|
(add-hook 'git-commit-mode-hook #'+vc|enforce-git-commit-conventions)
|
||||||
|
|
||||||
(defun +vc|start-in-insert-state-maybe ()
|
(defun +vc|start-in-insert-state-maybe ()
|
||||||
"Start git-commit-mode in insert state if in a blank commit message,
|
"Start git-commit-mode in insert state if in a blank commit message,
|
||||||
otherwise in default state."
|
otherwise in default state."
|
||||||
(when (and (bound-and-true-p evil-mode)
|
(when (and (bound-and-true-p evil-mode)
|
||||||
(bobp) (eolp))
|
(bobp) (eolp))
|
||||||
(evil-insert-state)))
|
(evil-insert-state)))
|
||||||
(add-hook 'git-commit-setup-hook #'+vc|start-in-insert-state-maybe)
|
(add-hook 'git-commit-setup-hook #'+vc|start-in-insert-state-maybe))
|
||||||
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; `vc' (built-in)
|
|
||||||
|
|
||||||
;; `vc-hooks'
|
|
||||||
(setq vc-make-backup-files nil)
|
|
||||||
|
|
||||||
;; `vc-annotate'
|
|
||||||
(after! vc-annotate
|
(after! vc-annotate
|
||||||
(set-popup-rules!
|
(set-popup-rules!
|
||||||
'(("^\\vc-d" :select nil) ; *vc-diff*
|
'(("^\\vc-d" :select nil) ; *vc-diff*
|
||||||
|
@ -51,7 +48,6 @@ otherwise in default state."
|
||||||
'(vc-annotate-mode vc-git-log-view-mode)
|
'(vc-annotate-mode vc-git-log-view-mode)
|
||||||
'normal))
|
'normal))
|
||||||
|
|
||||||
;; `smerge-mode'
|
|
||||||
(after! smerge-mode
|
(after! smerge-mode
|
||||||
(unless EMACS26+
|
(unless EMACS26+
|
||||||
(with-no-warnings
|
(with-no-warnings
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
;; -*- no-byte-compile: t; -*-
|
;; -*- no-byte-compile: t; -*-
|
||||||
;;; emacs/vc/packages.el
|
;;; emacs/vc/packages.el
|
||||||
|
|
||||||
|
(package! vc :built-in t)
|
||||||
|
(package! vc-annotate :built-in t)
|
||||||
|
(package! smerge-mode :built-in t)
|
||||||
|
|
||||||
(package! git-link)
|
(package! git-link)
|
||||||
(package! git-timemachine)
|
(package! git-timemachine)
|
||||||
(package! gitconfig-mode)
|
(package! gitconfig-mode)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue