Skip to content

Commit

Permalink
my-git: allow application of message-id via b4, wire to mu4e
Browse files Browse the repository at this point in the history
  • Loading branch information
stsquad committed Sep 14, 2020
1 parent 22b9cb1 commit 6e5f7b3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions my-email.el
Expand Up @@ -516,6 +516,10 @@ Move next if the message at point is what we have just processed."
(interactive)
(mu4e-headers-search (format "i:%s" (my-mu4e-kill-message-id 't))))

(defun mu4e-action-git-apply-b4 (msg)
"Find the Message-Id in the buffer and pass to b4"
(interactive)
(my-git-fetch-and-apply-via-b4 (my-mu4e-kill-message-id 't)))

(defun my-mu4e-search-from (&optional edit)
"Find msgs from author of the message, optionally EDIT the search."
Expand Down Expand Up @@ -700,6 +704,7 @@ to `my-mu4e-patches' for later processing."
(append
'(("gapply git patches" . mu4e-action-git-apply-patch)
("mgit am patch" . mu4e-action-git-apply-mbox)
("bb4 am patch" . mu4e-action-git-apply-b4)
("crun checkpatch script" . my-mu4e-action-run-check-patch)
("MCheck if merged" . my-mu4e-action-check-if-merged)))))
;; Bookmarks
Expand Down
14 changes: 14 additions & 0 deletions my-git.el
Expand Up @@ -140,6 +140,20 @@ bother asking for the git tree again (useful for bulk actions)."
(if signoff "--signoff" "")
(shell-quote-argument file))))))

(defun my-git-fetch-and-apply-via-b4 (id)
"Fetch `id' via the b4 tool and apply it."
(interactive "sMessage-id:")
(with-temp-buffer
(call-process "b4" nil t t "am" id)
(goto-char 0)
(when (re-search-forward
(rx (: "git am "
(group (one-or-more (not space)) ".mbx"))))
(let ((mbox (match-string-no-properties 1)))
(my-git-apply-mbox mbox t)
(message "applied %s" mbox)
(delete-file mbox)))))

(defun my-git-apply-region (beg end)
"Apply region as a patch."
(interactive "r")
Expand Down

0 comments on commit 6e5f7b3

Please sign in to comment.