branch: elpa/magit
commit f8ab44b2942e06a43475024a7c44bf9c45f9ae60
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-project-dispatch: New command
---
docs/CHANGELOG.4 | 2 ++
lisp/magit-extras.el | 23 +++++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/docs/CHANGELOG.4 b/docs/CHANGELOG.4
index cd1b9a2c56..89b40cf4f6 100644
--- a/docs/CHANGELOG.4
+++ b/docs/CHANGELOG.4
@@ -61,6 +61,8 @@
- ~magit-project-status~ is no longer added to ~project-switch-commands~.
See the command's docstring to learn how to add it yourself.
+- Added new command ~magit-project-dispatch~. #5163
+
Bugfixes:
- ~magit-ignore-submodules-p~ didn't return ~nil~ for ~none~.
diff --git a/lisp/magit-extras.el b/lisp/magit-extras.el
index c355a86274..9126ad5c96 100644
--- a/lisp/magit-extras.el
+++ b/lisp/magit-extras.el
@@ -206,6 +206,29 @@ Also see `magit-project-dispatch'."
(magit-status-setup-buffer (project-root (project-current t)))
(user-error "`magit-project-status' requires `project' 0.3.0 or greater")))
+;;;###autoload
+(defun magit-project-dispatch ()
+ "Run `magit-dispatch' in the current project's root.
+
+Note that for `magit-dispatch' to operate in the selected project,
+the current buffer's `default-directory' must be located in the
+selected repository. To achive that, a Dired buffer is created.
+
+To teach `project-switch-project' about this command, you have to
+add something like this to your configuration:
+
+ (keymap-set project-prefix-map \"M\" #\\='magit-project-dispatch)
+ (add-to-list \\='project-switch-commands
+ \\='(magit-project-dispatch \"Magit Dispatch\") t)
+
+Also see `magit-project-status'."
+ (interactive)
+ (if (fboundp 'project-root)
+ (let ((dir (project-root (project-current t))))
+ (find-file dir)
+ (magit-dispatch))
+ (user-error "`magit-project-status' requires `project' 0.3.0 or greater")))
+
;;; Shift Selection
(defun magit--turn-on-shift-select-mode-p ()