From eda0edf3efa9b87b72f9aeb3ac9a905fee0d205a Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 6 Jun 2020 12:27:02 -0400 Subject: Convert piem-am into a standalone command b4 is great, and I have no desire to create an Elisp implementation of its complex patch series extraction. However, in cases where projects permit patches as attachments, using b4 isn't an option. And even for inline patches, it's useful to be able to git-am the patch associated with the current buffer. To support the above cases, teach piem-am to get an mbox from piem-am-ready-mbox when called interactively. --- piem.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'piem.el') diff --git a/piem.el b/piem.el index b095bf1..eb725d0 100644 --- a/piem.el +++ b/piem.el @@ -375,6 +375,13 @@ in `piem-default-branch-function'." (and version (concat "__" version)))))) (defun piem-am (mbox &optional info coderepo) + (interactive + (let ((mbox (or (piem-am-ready-mbox) + (user-error + "Could not find am-ready mbox for current buffer")))) + (list mbox + (piem-extract-mbox-info mbox) + (piem-inbox-coderepo-maybe-read)))) (let* ((default-directory (or coderepo default-directory))) ;; TODO: Optionally do more through Magit. (let ((new-branch (read-string @@ -393,7 +400,10 @@ in `piem-default-branch-function'." (list "-b" new-branch)) (and (not (string-blank-p base)) (list base))))) - (piem-process-call nil piem-git-executable "am" "--scissors" mbox) + (if (bufferp mbox) + (piem-process-call-with-buffer-input + nil mbox piem-git-executable "am" "--scissors") + (piem-process-call nil piem-git-executable "am" "--scissors" mbox)) (if (and piem-use-magit (fboundp 'magit-status-setup-buffer)) (magit-status-setup-buffer) -- cgit v1.2.3