summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2017-01-19 22:51:18 -0500
committerKyle Meyer <kyle@kyleam.com>2017-01-19 22:51:18 -0500
commit76af73d23efa015ba2846510816df0183b7f4f54 (patch)
treed48907341c6d855d8d54852522257c419a36b2f8
parentbd96dbc0a377c8d97875985d820979077a4f46db (diff)
downloademacs.d-76af73d23efa015ba2846510816df0183b7f4f54.tar.gz
magit: Shorten hashes in locked revision buffers
-rw-r--r--init.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/init.el b/init.el
index e859662..7f05364 100644
--- a/init.el
+++ b/init.el
@@ -988,6 +988,20 @@
(km/magit-mode-kill-hidden 'magit-diff-mode))
'((name . "magit-diff-kill-previous")))
+ (advice-add
+ 'magit-generate-buffer-name-default-function
+ :around
+ (lambda (fn mode &optional value)
+ (let ((rev (and (listp value) (car value))))
+ (when (and rev (stringp rev)
+ (string-match-p (rx string-start
+ (= 40 (any "a-z" "0-9"))
+ string-end)
+ rev))
+ (setcar value (magit-rev-abbrev rev))))
+ (funcall fn mode value))
+ '((name . "magit-buffer-name-shorten-hash")))
+
(advice-add 'magit-git-fetch
:around
(lambda (fn &rest args)