branch: elpa/git-commit
commit f53ddf3c313834cb222e87341e47236dccc93317
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-dired-am-apply-patches: New command
Closes #4094.
---
Documentation/RelNotes/3.3.0.org | 3 +++
lisp/magit-extras.el | 12 ++++++++++++
2 files changed, 15 insertions(+)
diff --git a/Documentation/RelNotes/3.3.0.org b/Documentation/RelNotes/3.3.0.org
index 2b30741..6fe14dd 100644
--- a/Documentation/RelNotes/3.3.0.org
+++ b/Documentation/RelNotes/3.3.0.org
@@ -26,6 +26,9 @@
- A few existing commands got a new or better binding in
~magit-dispatch~ and/or ~magit-mode-map~.
+- Added new command ~magit-dired-am-apply-patches~ for use in Dired.
+ #4094.
+
** Fixes since v3.2.0
- Make ~magit-branch-remote-head~ and ~magit-branch-current~ fall back
diff --git a/lisp/magit-extras.el b/lisp/magit-extras.el
index d621298..07639ad 100644
--- a/lisp/magit-extras.el
+++ b/lisp/magit-extras.el
@@ -197,6 +197,18 @@ is no file at point, then instead visit
`default-directory'."
(magit--not-inside-repository-error)))
;;;###autoload
+(defun magit-dired-am-apply-patches (repo &optional arg)
+ "In Dired, apply the marked (or next ARG) files as patches.
+If inside a repository, then apply in that. Otherwise prompt
+for a repository."
+ (interactive (list (or (magit-toplevel)
+ (magit-read-repository t))
+ current-prefix-arg))
+ (let ((files (dired-get-marked-files nil arg nil nil t)))
+ (magit-status-setup-buffer repo)
+ (magit-am-apply-patches files)))
+
+;;;###autoload
(defun magit-do-async-shell-command (file)
"Open FILE with `dired-do-async-shell-command'.
Interactively, open the file at point."