summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-07-31 00:04:45 -0400
committerKyle Meyer <kyle@kyleam.com>2015-07-31 00:04:45 -0400
commit9e5e17027635bd66753d618829e9b8188583e021 (patch)
treef6f86c63e9aeec1f4b15b05589d7a163ece69b9f
parentcc9dfdc4a410c360ccac647bbfac84b4edf318b4 (diff)
downloademacs.d-9e5e17027635bd66753d618829e9b8188583e021.tar.gz
magit-copy-hook: Add function to copy region commits
-rw-r--r--lisp/init-git.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/init-git.el b/lisp/init-git.el
index 9d2967b..3c8ce18 100644
--- a/lisp/init-git.el
+++ b/lisp/init-git.el
@@ -330,6 +330,7 @@ argument."
(defvar km/magit-copy-hook
'(km/magit-copy-commit-citation
km/magit-copy-commit-message
+ km/magit-copy-region-commits
km/magit-copy-region-hunk
km/magit-copy-hunk)
"Functions tried by `km/magit-copy-as-kill'.
@@ -359,6 +360,13 @@ Format the reference as '<hash>, (\"<subject>\", <date>)'."
(+ 4 (point)) (point-at-eol)))))
(kill-new (message "%s (\"%s\", %s)" hash subject date)))))
+(defun km/magit-copy-region-commits (&optional arg)
+ (--when-let (magit-region-values 'commit)
+ (deactivate-mark)
+ (kill-new
+ (mapconcat #'identity it
+ (if arg (read-string "Separator: ") ", ")))))
+
(defun km/magit-copy-commit-message (&optional arg)
(magit-section-when message
(kill-new (replace-regexp-in-string