branch: elpa/magit
commit 614f3dff041a8c860e0ffb0d28d9c0dbe91f0441
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>

    No longer manipulate project-switch-project and project-prefix-map
    
    We provide a command users may want to add, but they will have to do
    that themselves now.
    
    Re #4357 and #4349.  And #5163, which caused me to look at this again.
---
 docs/CHANGELOG.4     |  3 +++
 lisp/magit-extras.el | 26 ++++++++++----------------
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/docs/CHANGELOG.4 b/docs/CHANGELOG.4
index 47a40e5383..cd1b9a2c56 100644
--- a/docs/CHANGELOG.4
+++ b/docs/CHANGELOG.4
@@ -58,6 +58,9 @@
 
 - Added new command ~magit-checkout-remote-ref~.  #5410
 
+- ~magit-project-status~ is no longer added to ~project-switch-commands~.
+  See the command's docstring to learn how to add it yourself.
+
 Bugfixes:
 
 - ~magit-ignore-submodules-p~ didn't return ~nil~ for ~none~.
diff --git a/lisp/magit-extras.el b/lisp/magit-extras.el
index e538b78858..c355a86274 100644
--- a/lisp/magit-extras.el
+++ b/lisp/magit-extras.el
@@ -191,27 +191,21 @@ blame to center around the line point is on."
 
 ;;;###autoload
 (defun magit-project-status ()
-  "Run `magit-status' in the current project's root."
+  "Run `magit-status' in the current project's root.
+
+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-status)
+    (add-to-list \\='project-switch-commands
+                 \\='(magit-project-status \"Magit\") t)
+
+Also see `magit-project-dispatch'."
   (interactive)
   (if (fboundp 'project-root)
       (magit-status-setup-buffer (project-root (project-current t)))
     (user-error "`magit-project-status' requires `project' 0.3.0 or greater")))
 
-(defvar magit-bind-magit-project-status t
-  "Whether to bind \"m\" to `magit-project-status' in `project-prefix-map'.
-If so, then an entry is added to `project-switch-commands' as
-well.  If you want to use another key, then you must set this
-to nil before loading Magit to prevent \"m\" from being bound.")
-
-(with-eval-after-load 'project
-  (when (and magit-bind-magit-project-status
-             ;; Only modify if it hasn't already been modified.
-             (equal project-switch-commands
-                    (eval (car (get 'project-switch-commands 'standard-value))
-                          t)))
-    (keymap-set project-prefix-map "m" #'magit-project-status)
-    (add-to-list 'project-switch-commands '(magit-project-status "Magit") t)))
-
 ;;; Shift Selection
 
 (defun magit--turn-on-shift-select-mode-p ()

Reply via email to