Merge remote branch 'refs/remotes/philjackson/magit-completing-read'

This commit is contained in:
Phil Jackson 2010-03-10 21:08:32 +00:00
commit 131f9d1db3

View file

@ -207,6 +207,9 @@ Many Magit faces inherit from this one by default."
"Face for branch head labels shown in log buffer." "Face for branch head labels shown in log buffer."
:group 'magit) :group 'magit)
(defvar magit-completing-read 'completing-read
"Function to be called when requesting input from the user.")
;;; Macros ;;; Macros
(defmacro magit-with-refresh (&rest body) (defmacro magit-with-refresh (&rest body)
@ -366,7 +369,7 @@ Many Magit faces inherit from this one by default."
(defun magit-read-top-dir (rawp) (defun magit-read-top-dir (rawp)
(if (and (not rawp) magit-repo-dirs) (if (and (not rawp) magit-repo-dirs)
(let* ((repos (magit-list-repos magit-repo-dirs)) (let* ((repos (magit-list-repos magit-repo-dirs))
(reply (completing-read "Git repository: " (reply (funcall magit-completing-read "Git repository: "
(magit-list-repos magit-repo-dirs)))) (magit-list-repos magit-repo-dirs))))
(file-name-as-directory (file-name-as-directory
(cdr (assoc reply repos)))) (cdr (assoc reply repos))))
@ -453,7 +456,7 @@ Many Magit faces inherit from this one by default."
(format "%s (default %s): " prompt def) (format "%s (default %s): " prompt def)
(format "%s: " prompt))) (format "%s: " prompt)))
(interesting-refs (magit-list-interesting-refs)) (interesting-refs (magit-list-interesting-refs))
(reply (completing-read prompt interesting-refs (reply (funcall magit-completing-read prompt interesting-refs
nil nil nil nil def)) nil nil nil nil def))
(rev (or (cdr (assoc reply interesting-refs)) reply))) (rev (or (cdr (assoc reply interesting-refs)) reply)))
(if (string= rev "") (if (string= rev "")
@ -2385,7 +2388,7 @@ in log buffer."
(magit-run* args nil nil nil t))) (magit-run* args nil nil nil t)))
(defun magit-read-remote (prompt def) (defun magit-read-remote (prompt def)
(completing-read (if def (funcall magit-completing-read (if def
(format "%s (default %s): " prompt def) (format "%s (default %s): " prompt def)
(format "%s: " prompt)) (format "%s: " prompt))
(magit-git-lines "remote") (magit-git-lines "remote")