diff options
author | Kyle Meyer <kyle@kyleam.com> | 2020-06-06 12:27:02 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2020-06-06 15:15:02 -0400 |
commit | eda0edf3efa9b87b72f9aeb3ac9a905fee0d205a (patch) | |
tree | f5329b2ec08550d404698a957b61dd4edcec6bda | |
parent | b410f5acc57d42a323e9f828790c774b9d2138ce (diff) | |
download | piem-eda0edf3efa9b87b72f9aeb3ac9a905fee0d205a.tar.gz |
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.
-rw-r--r-- | piem.el | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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) |