From ee5b1e241475f98227aa785f69c8362f69a11656 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 24 Oct 2021 11:21:46 +0000 Subject: modules/emacs: add git-commit-message-pretty-ref --- modules/workstation/emacs/init.el | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'modules/workstation/emacs/init.el') diff --git a/modules/workstation/emacs/init.el b/modules/workstation/emacs/init.el index 09a1a5f4d6b4..1f1d79dd4fe5 100644 --- a/modules/workstation/emacs/init.el +++ b/modules/workstation/emacs/init.el @@ -152,6 +152,16 @@ ;; in the right when this happens). (setq magit-commit-show-diff nil) +(defun git-commit-message-pretty-ref (commit) + "Generate a reference to git COMMIT in the format used in the +Linux kernel (`SHORT-HASH (\"SHORT-MESSAGE\")') and insert it at +point." + (interactive + (list (or (nreverse (magit-region-values 'commit)) + (magit-read-other-branch-or-commit "Reference commit")))) + (call-process (magit-git-executable) nil t nil + "show" "--no-patch" "--pretty=format:%h (\"%s\")" commit)) + (with-eval-after-load "magit" (define-key magit-process-mode-map (kbd "k") #'magit-process-kill) -- cgit 1.4.1