branch: elpa/magit commit 6aec967ee4af617ddae577153208bd8a8bb011f0 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Move Ido kludges to a new package magit-ido --- lisp/magit-base.el | 43 +++++++++---------------------------------- lisp/magit-extras.el | 15 --------------- lisp/magit-submodule.el | 22 ++++++++-------------- lisp/magit-subtree.el | 1 - 4 files changed, 17 insertions(+), 64 deletions(-) diff --git a/lisp/magit-base.el b/lisp/magit-base.el index b2b401f201..635b3f835a 100644 --- a/lisp/magit-base.el +++ b/lisp/magit-base.el @@ -69,21 +69,17 @@ (defcustom magit-completing-read-function #'magit-builtin-completing-read "Function to be called when requesting input from the user. -If you have enabled `ivy-mode' or `helm-mode', then you don't -have to customize this option; `magit-builtin-completing-read' -will work just fine. However, if you use Ido completion, then -you do have to use `magit-ido-completing-read', because Ido is -less well behaved than the former, more modern alternatives. - -If you would like to use Ivy or Helm completion with Magit but -not enable the respective modes globally, then customize this -option to use `ivy-completing-read' or -`helm--completing-read-default'. If you choose to use -`ivy-completing-read', note that the items may always be shown in -alphabetical order, depending on your version of Ivy." +The default, `magit-builtin-completing-read', support third-party +completion frameworks, including `vertico-mode', `ivy-mode' and +`helm-mode'. + +However, if you would like to use Ivy or Helm completion with Magit but +not enable the respective modes globally, then customize this option to +use `ivy-completing-read' or `helm--completing-read-default'. + +If you still use `ido-mode', you'll likely need the `magit-ido' package." :group 'magit-essentials :type `(radio (function-item ,#'magit-builtin-completing-read) - (function-item ,#'magit-ido-completing-read) (function-item ivy-completing-read) (function-item helm--completing-read-default) (function :tag "Other function"))) @@ -699,27 +695,6 @@ third-party completion frameworks." hist def inherit-input-method))) (if no-split input values))) -(defun magit-ido-completing-read - (prompt choices &optional predicate require-match initial-input hist def) - "Ido-based `completing-read' almost-replacement. - -Unfortunately `ido-completing-read' is not suitable as a -drop-in replacement for `completing-read', instead we use -`ido-completing-read+' from the third-party package by the -same name." - (if (and (require 'ido-completing-read+ nil t) - (fboundp 'ido-completing-read+)) - (ido-completing-read+ prompt choices predicate require-match - initial-input hist - (or def (and require-match (car choices)))) - (display-warning 'magit "ido-completing-read+ is not installed - -To use Ido completion with Magit you need to install the -third-party `ido-completing-read+' packages. Falling -back to built-in `completing-read' for now." :error) - (magit-builtin-completing-read prompt choices predicate require-match - initial-input hist def))) - (defvar-keymap magit-minibuffer-local-ns-map :parent minibuffer-local-map "SPC" #'magit-whitespace-disallowed diff --git a/lisp/magit-extras.el b/lisp/magit-extras.el index 5e399440fe..63264584dc 100644 --- a/lisp/magit-extras.el +++ b/lisp/magit-extras.el @@ -34,8 +34,6 @@ (declare-function vc-git-command "vc-git" (buffer okstatus file-or-list &rest flags)) -(defvar ido-exit) -(defvar ido-fallback) (defvar project-prefix-map) (defvar project-switch-commands) @@ -193,19 +191,6 @@ blame to center around the line point is on." ;;; Emacs Tools -;;;###autoload -(defun ido-enter-magit-status () - "Drop into `magit-status' from file switching. - -To make this command available use something like: - - (keymap-set ido-common-completion-map - \"C-x g\" \\='ido-enter-magit-status)" - (interactive) - (setq ido-exit 'fallback) - (setq ido-fallback #'magit-status) - (exit-minibuffer)) - ;;;###autoload (defun magit-project-status () "Run `magit-status' in the current project's root." diff --git a/lisp/magit-submodule.el b/lisp/magit-submodule.el index a342e9ab76..18eb9dab7d 100644 --- a/lisp/magit-submodule.el +++ b/lisp/magit-submodule.el @@ -220,26 +220,20 @@ it is nil, then PATH also becomes the name." (interactive (magit-with-toplevel (let* ((url (magit-read-string-ns "Add submodule (remote url)")) - (path (let ((read-file-name-function - (if (or (eq read-file-name-function 'ido-read-file-name) - (advice-function-member-p - 'ido-read-file-name - read-file-name-function)) - ;; The Ido variant doesn't work properly here. - #'read-file-name-default - read-file-name-function))) - (directory-file-name - (file-relative-name - (read-directory-name - "Add submodules at path: " nil nil nil - (and (string-match "\\([^./]+\\)\\(\\.git\\)?$" url) - (match-string 1 url)))))))) + (path (magit-submodule-read-path "Add submodules at path: " url))) (list url (directory-file-name path) (magit-submodule-read-name-for-path path) (magit-submodule-arguments "--force"))))) (magit-submodule-add-1 url path name args)) +(defun magit-submodule-read-path (prompt url) + (directory-file-name + (file-relative-name + (read-directory-name prompt nil nil nil + (and (string-match "\\([^./]+\\)\\(\\.git\\)?$" url) + (match-string 1 url)))))) + (defun magit-submodule-add-1 (url &optional path name args) (magit-with-toplevel (magit-submodule--maybe-reuse-gitdir name path) diff --git a/lisp/magit-subtree.el b/lisp/magit-subtree.el index 4bd1ed1aa7..b771a23e45 100644 --- a/lisp/magit-subtree.el +++ b/lisp/magit-subtree.el @@ -82,7 +82,6 @@ (topdir (magit-toplevel)) (prefix (read-directory-name (concat prompt ": ") topdir default))) (if (file-name-absolute-p prefix) - ;; At least `ido-mode's variant is not compatible. (if (string-prefix-p topdir prefix) (file-relative-name prefix topdir) (user-error "%s isn't inside the repository at %s" prefix topdir))