mu4e-actions: improve mbox handling for multiple marks

This avoids prompting the user over and over if the directory hasn't
changed. I've also ensured the paths are escaped with
shell-quote-argument.
This commit is contained in:
Alex Bennée 2015-08-31 15:07:10 +01:00
parent 6a42000997
commit fdb476e225
1 changed files with 14 additions and 8 deletions

View File

@ -210,16 +210,22 @@ store your org-contacts."
(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)))
"Apply and commit the git [patch] MSG.
If the `default-directory' matches the most recent history entry don't
bother asking for the git tree again (useful for bulk actions)."
(let ((cwd (car ido-work-directory-list)))
(unless (and (stringp cwd) (string= default-directory cwd))
(setq cwd (ido-read-directory-name "Target directory: "
cwd
"~/" t))
(setf ido-work-directory-list
(cons cwd (delete cwd ido-work-directory-list))))
(shell-command
(format "cd %s; git am %s"
path
(mu4e-message-field msg :path)))))
(shell-quote-argument cwd)
(shell-quote-argument (mu4e-message-field msg :path))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;