2018-06-21 21:14:00 +02:00
|
|
|
;;; emacs/vc/config.el -*- lexical-binding: t; -*-
|
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
(when IS-WINDOWS
|
|
|
|
(setenv "GIT_ASKPASS" "git-gui--askpass"))
|
|
|
|
|
|
|
|
|
|
|
|
(setq vc-make-backup-files nil
|
|
|
|
vc-follow-symlinks t)
|
2019-06-07 23:07:37 +02:00
|
|
|
|
|
|
|
|
2018-06-21 21:14:00 +02:00
|
|
|
(after! git-timemachine
|
2019-07-18 13:11:51 +02:00
|
|
|
;; HACK Waiting for https://gitlab.com/pidu/git-timemachine/issues/77
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +vc--git-timemachine-show-commit-a ()
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
"Fix `git-timemachine-show-commit'."
|
|
|
|
:override #'git-timemachine-show-commit
|
2019-07-18 13:11:51 +02:00
|
|
|
(interactive)
|
|
|
|
(let ((rev (car git-timemachine-revision)))
|
|
|
|
(if (fboundp 'magit-revision-mode)
|
|
|
|
(with-temp-buffer
|
|
|
|
(save-excursion
|
|
|
|
(magit-setup-buffer #'magit-revision-mode nil
|
|
|
|
(magit-buffer-revision rev)
|
|
|
|
(magit-buffer-range (format "%s^..%s" rev rev))
|
|
|
|
(magit-buffer-diff-args nil)
|
|
|
|
(magit-buffer-diff-files nil))))
|
|
|
|
(message "You need to install magit to show commit"))))
|
|
|
|
|
2018-06-21 21:14:00 +02:00
|
|
|
;; Sometimes I forget `git-timemachine' is enabled in a buffer, so instead of
|
|
|
|
;; showing revision details in the minibuffer, show them in
|
|
|
|
;; `header-line-format', which has better visibility.
|
|
|
|
(setq git-timemachine-show-minibuffer-details t)
|
2019-07-23 12:30:47 +02:00
|
|
|
(advice-add #'git-timemachine--show-minibuffer-details
|
|
|
|
:override #'+vc-update-header-line-a)
|
2018-06-21 21:14:00 +02:00
|
|
|
|
|
|
|
(after! evil
|
2018-07-29 18:26:20 +02:00
|
|
|
;; rehash evil keybindings so they are recognized
|
2018-07-28 12:56:52 +02:00
|
|
|
(add-hook 'git-timemachine-mode-hook #'evil-normalize-keymaps))
|
|
|
|
|
|
|
|
(when (featurep! :tools magit)
|
2019-07-21 23:35:17 +02:00
|
|
|
(add-transient-hook! #'git-timemachine-blame (require 'magit-blame)))
|
|
|
|
|
|
|
|
(map! :map git-timemachine-mode-map
|
|
|
|
:n "gtc" #'git-timemachine-show-commit))
|
2018-06-21 21:14:00 +02:00
|
|
|
|
|
|
|
|
2019-06-07 23:07:37 +02:00
|
|
|
;;;###package git-commit
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! git-commit
|
2019-06-07 23:07:37 +02:00
|
|
|
:after-call after-find-file
|
|
|
|
:config
|
|
|
|
(global-git-commit-mode +1)
|
|
|
|
(set-yas-minor-mode! 'git-commit-mode)
|
2018-08-01 19:26:20 +02:00
|
|
|
|
2019-07-18 15:27:20 +02:00
|
|
|
(add-hook 'git-commit-mode-hook
|
2019-07-23 12:30:47 +02:00
|
|
|
(defun +vc-enforce-git-commit-conventions-h ()
|
2019-07-18 15:27:20 +02:00
|
|
|
"See https://chris.beams.io/posts/git-commit/"
|
|
|
|
(setq fill-column 72
|
|
|
|
git-commit-summary-max-length 50
|
|
|
|
git-commit-style-convention-checks '(overlong-summary-line non-empty-second-line))))
|
2018-07-28 13:05:47 +02:00
|
|
|
|
2019-07-18 15:27:20 +02:00
|
|
|
(add-hook 'git-commit-setup-hook
|
2019-07-23 12:30:47 +02:00
|
|
|
(defun +vc-start-in-insert-state-maybe ()
|
2019-07-18 15:27:20 +02:00
|
|
|
"Start git-commit-mode in insert state if in a blank commit message,
|
2018-07-28 13:05:47 +02:00
|
|
|
otherwise in default state."
|
2019-07-18 15:27:20 +02:00
|
|
|
(when (and (bound-and-true-p evil-mode)
|
|
|
|
(bobp) (eolp))
|
|
|
|
(evil-insert-state)))))
|
2018-06-21 21:14:00 +02:00
|
|
|
|
2017-02-23 00:06:12 -05:00
|
|
|
(after! vc-annotate
|
2018-06-15 02:58:12 +02:00
|
|
|
(set-popup-rules!
|
2018-07-19 03:40:31 +02:00
|
|
|
'(("^\\vc-d" :select nil) ; *vc-diff*
|
2018-06-18 02:26:05 +02:00
|
|
|
("^\\vc-c" :select t))) ; *vc-change-log*
|
2018-06-15 02:58:12 +02:00
|
|
|
(set-evil-initial-state!
|
|
|
|
'(vc-annotate-mode vc-git-log-view-mode)
|
|
|
|
'normal))
|
2017-07-02 16:29:46 +02:00
|
|
|
|
2018-06-26 01:32:05 +02:00
|
|
|
(after! smerge-mode
|
2018-03-24 04:40:24 -04:00
|
|
|
(unless EMACS26+
|
2017-12-10 15:12:17 -05:00
|
|
|
(with-no-warnings
|
|
|
|
(defalias #'smerge-keep-upper #'smerge-keep-mine)
|
|
|
|
(defalias #'smerge-keep-lower #'smerge-keep-other)
|
|
|
|
(defalias #'smerge-diff-base-upper #'smerge-diff-base-mine)
|
|
|
|
(defalias #'smerge-diff-upper-lower #'smerge-diff-mine-other)
|
2018-07-09 21:50:19 +02:00
|
|
|
(defalias #'smerge-diff-base-lower #'smerge-diff-base-other))))
|
2018-06-21 21:14:00 +02:00
|
|
|
|