---
Hi,
With these changes rebasing your master on top of origin/master,
for example, takes only two keystrokes: R RET
--
Hannu
magit.el | 50 ++++++++++++++++++++++++++++++++++++++------------
1 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/magit.el b/magit.el
index e06aeeb..cac6d51 100644
--- a/magit.el
+++ b/magit.el
@@ -183,6 +183,14 @@ t mean pty, it enable magit to prompt for passphrase when
needed."
:group 'magit
:type 'boolean)
+(defcustom magit-completing-read-function 'magit-iswitchb-completing-read
+ "Function to be called when requesting input from the user."
+ :group 'magit
+ :type '(radio (function-item magit-iswitchb-completing-read)
+ (function-item magit-builtin-completing-read)
+ (function :tag "Other")))
+
+
(defface magit-header
'((t))
"Face for generic header lines.
@@ -327,9 +335,6 @@ Many Magit faces inherit from this one by default."
(defvar magit-custom-options '()
"List of custom options to pass git. Do not customise this.")
-(defvar magit-completing-read 'completing-read
- "Function to be called when requesting input from the user.")
-
(defvar magit-read-rev-history nil
"The history of inputs to `magit-read-rev'.")
@@ -519,6 +524,30 @@ Many Magit faces inherit from this one by default."
(make-variable-buffer-local 'magit-submode)
(put 'magit-submode 'permanent-local t)
+(defun magit-iswitchb-completing-read (prompt choices &optional predicate
require-match
+ initial-input hist def)
+ "iswitchb-based completing-read almost-replacement."
+ (require 'iswitchb)
+ (let ((iswitchb-make-buflist-hook
+ (lambda ()
+ (setq iswitchb-temp-buflist (if (consp (first choices))
+ (mapcar #'car choices)
+ choices)))))
+ (iswitchb-read-buffer (format "%s: " prompt) (or initial-input def)
require-match)))
+
+(defun magit-builtin-completing-read (prompt choices &optional predicate
require-match
+ initial-input hist def)
+ "Magit wrapper for standard completing-read function."
+ (completing-read (if def
+ (format "%s (default %s): " prompt def)
+ (format "%s: " prompt))
+ choices predicate require-match initial-input hist def))
+
+(defun magit-completing-read (prompt choices &optional predicate require-match
+ initial-input hist def)
+ (funcall magit-completing-read-function prompt choices predicate
require-match
+ initial-input hist def))
+
(defun magit-use-region-p ()
(if (fboundp 'use-region-p)
(use-region-p)
@@ -686,8 +715,8 @@ Otherwise, return nil."
(defun magit-read-top-dir (rawp)
(if (and (not rawp) magit-repo-dirs)
(let* ((repos (magit-list-repos magit-repo-dirs))
- (reply (funcall magit-completing-read "Git repository: "
- (magit-list-repos magit-repo-dirs))))
+ (reply (magit-completing-read "Git repository: "
+ (magit-list-repos
magit-repo-dirs))))
(file-name-as-directory
(cdr (assoc reply repos))))
(file-name-as-directory
@@ -822,8 +851,8 @@ pair (START . END), then the range is START..END.")
(format "%s (default %s): " prompt def)
(format "%s: " prompt)))
(interesting-refs (magit-list-interesting-refs))
- (reply (funcall magit-completing-read prompt interesting-refs
- nil nil nil 'magit-read-rev-history def))
+ (reply (magit-completing-read prompt interesting-refs nil nil nil
+ 'magit-read-rev-history def))
(rev (or (cdr (assoc reply interesting-refs)) reply)))
(if (string= rev "")
nil
@@ -887,12 +916,9 @@ PROMPT is used as the prompt, and defaults to \"Remote\".
DEF is the default value, and defaults to the value of
`magit-get-current-branch'."
(let* ((prompt (or prompt "Remote"))
(def (or def (magit-get-current-remote)))
- (prompt (if def
- (format "%s (default %s): " prompt def)
- (format "%s: " prompt)))
(remotes (magit-git-lines "remote"))
- (reply (funcall magit-completing-read prompt remotes
- nil nil nil nil def)))
+ (reply (magit-completing-read prompt remotes
+ nil nil nil nil def)))
(if (string= reply "") nil reply)))
;;; Sections
--
1.7.0.4