diff options
author | Xinglu Chen <public@yoctocell.xyz> | 2021-01-22 18:20:37 +0100 |
---|---|---|
committer | Xinglu Chen <public@yoctocell.xyz> | 2021-01-22 18:20:37 +0100 |
commit | c81e2d586af7f4e05f068c49d182e21a82094109 (patch) | |
tree | 9122c682f08c7af8cdc87dd8b0115ac96d71f65d /git-email-magit.el | |
parent | 02b1db31b05ddc812c16117cdb157a1982316cf3 (diff) |
magit: Use `magit-log-select' to select commit
This brings up a log buffer where the user the select a commit,
similar to when doing an interactive rebase.
Diffstat (limited to 'git-email-magit.el')
-rw-r--r-- | git-email-magit.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/git-email-magit.el b/git-email-magit.el index 1f211e1..70f64b4 100644 --- a/git-email-magit.el +++ b/git-email-magit.el @@ -41,15 +41,19 @@ (require 'transient) ;;;###autoload -(defun git-email-magit-patch-send (args) +(defun git-email-magit-patch-send (args &optional commit) (interactive (let ((args (transient-args 'magit-patch-create))) (list (mapconcat #'identity (seq-filter #'stringp args) " ")))) - - (git-email-format-patch args nil t)) - + ;; For some reason, `git-email-format-patch' gets called before + ;; `magit-log-select' has retunred anything, leading to an error. + (if commit + (git-email-format-patch args commit nil) + (magit-log-select (lambda (commit) + (git-email-magit-patch-send args commit))))) + (transient-append-suffix 'magit-patch-create "c" '(1 "s" "Send patch" git-email-magit-patch-send)) |