From c81e2d586af7f4e05f068c49d182e21a82094109 Mon Sep 17 00:00:00 2001 From: Xinglu Chen Date: Fri, 22 Jan 2021 18:20:37 +0100 Subject: 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. --- git-email-magit.el | 12 ++++++++---- 1 file 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)) -- cgit v1.2.3