about summary refs log tree commit diff
path: root/users/grfn/emacs.d
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2022-06-14T14·15-0400
committerclbot <clbot@tvl.fyi>2022-07-11T14·44+0000
commit539d69f565f0f3ada8a08ebc5a199b97dbc89b73 (patch)
treea00de4b7a6073ae454bff948728cd956b7643dd8 /users/grfn/emacs.d
parenta37f0eed21617fd914c84cca35761bad802a989d (diff)
feat(grfn/home): Add binding for extracting patch from email r/4286
Change-Id: Id568f8b479cebe547e1ad8a309ccfa395bf99b83
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5935
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Autosubmit: grfn <grfn@gws.fyi>
Diffstat (limited to 'users/grfn/emacs.d')
-rw-r--r--users/grfn/emacs.d/email.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/users/grfn/emacs.d/email.el b/users/grfn/emacs.d/email.el
index 83076898b4..70360d0072 100644
--- a/users/grfn/emacs.d/email.el
+++ b/users/grfn/emacs.d/email.el
@@ -40,3 +40,14 @@
                    (eq (car action)
                        'display-buffer-same-window))
   :ignore t)
+
+(defun apply-thread-patchset (repo branch)
+  (interactive "Dgit repo: \nsnew branch name: ")
+  (let ((tid notmuch-show-thread-id)
+        (tmp "/tmp/notmuch-patchset"))
+    (shell-command (format "notmuch-extract-patch %s > %s && ( cd %s && git checkout -b %s && git am %s )"
+                           (shell-quote-argument tid)
+                           (shell-quote-argument tmp)
+                           (shell-quote-argument (expand-file-name repo))
+                           (shell-quote-argument branch)
+                           (shell-quote-argument tmp)))))