emacs/vc: refactor git-timemachine header-line advice

The function was removed in bb702acfd
This commit is contained in:
Henrik Lissner 2019-12-15 02:17:40 -05:00
parent bb702acfd0
commit 721b635476
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -21,8 +21,22 @@
;; showing revision details in the minibuffer, show them in ;; showing revision details in the minibuffer, show them in
;; `header-line-format', which has better visibility. ;; `header-line-format', which has better visibility.
(setq git-timemachine-show-minibuffer-details t) (setq git-timemachine-show-minibuffer-details t)
(advice-add #'git-timemachine--show-minibuffer-details
:override #'+vc-update-header-line-a) (defadvice! +vc-update-header-line-a (revision)
"Show revision details in the header-line, instead of the minibuffer.
Sometimes I forget `git-timemachine' is enabled in a buffer. Putting revision
info in the `header-line-format' is a good indication."
:override #'git-timemachine--show-minibuffer-details
(let* ((date-relative (nth 3 revision))
(date-full (nth 4 revision))
(author (if git-timemachine-show-author (concat (nth 6 revision) ": ") ""))
(sha-or-subject (if (eq git-timemachine-minibuffer-detail 'commit) (car revision) (nth 5 revision))))
(setq header-line-format
(format "%s%s [%s (%s)]"
(propertize author 'face 'git-timemachine-minibuffer-author-face)
(propertize sha-or-subject 'face 'git-timemachine-minibuffer-detail-face)
date-full date-relative))))
(after! evil (after! evil
;; rehash evil keybindings so they are recognized ;; rehash evil keybindings so they are recognized