From 64d348c07eff361d1db017627576c2b2c49b9bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Fri, 25 Oct 2013 12:08:00 +0100 Subject: [PATCH 1/2] mu4e-actions.el: better last dir handling for mu4e-action-git-apply-patch add-to-list does pre-pend an element to a list by default, but only if it isn't in there already. This change ensures the path we have just added is always the first in the list. This makes sense when applying a series of patches by hand. --- mu4e/mu4e-actions.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mu4e/mu4e-actions.el b/mu4e/mu4e-actions.el index aeaf5d80..dc263b9f 100644 --- a/mu4e/mu4e-actions.el +++ b/mu4e/mu4e-actions.el @@ -174,7 +174,8 @@ store your org-contacts." (let ((path (ido-read-directory-name "Target directory: " (car ido-work-directory-list) "~/" t))) - (add-to-list 'ido-work-directory-list path) + (setf ido-work-directory-list + (cons path (delete path ido-work-directory-list))) (shell-command (format "cd %s; git apply %s" path From c03c14d52db8d83fab9d1b8b29d62d8b76ef4378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Fri, 25 Oct 2013 12:09:26 +0100 Subject: [PATCH 2/2] mu4e-actions.el: add mu4e-action-git-apply-mbox example Apply patch is useful when you might want to change the patch. However for reviews you may well just want stuff applied directly to the commit history. --- mu4e/mu4e-actions.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mu4e/mu4e-actions.el b/mu4e/mu4e-actions.el index dc263b9f..53083ca2 100644 --- a/mu4e/mu4e-actions.el +++ b/mu4e/mu4e-actions.el @@ -180,6 +180,19 @@ store your org-contacts." (format "cd %s; git apply %s" path (mu4e-message-field msg :path))))) + +(defun mu4e-action-git-apply-mbox (msg) + "Apply and commit the git [patch] message." + (let ((path (ido-read-directory-name "Target directory: " + (car ido-work-directory-list) + "~/" t))) + (setf ido-work-directory-list + (cons path (delete path ido-work-directory-list))) + (shell-command + (format "cd %s; git am %s" + path + (mu4e-message-field msg :path))))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;