summaryrefslogtreecommitdiff
path: root/lisp/gnus/gnus-util.el
diff options
context:
space:
mode:
authorGnus developers <ding@gnus.org>2010-10-03 00:33:27 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2010-10-03 00:33:27 +0000
commit870409d4fb06834c28e75cd653ad8aa2a7e8f581 (patch)
tree8068a94b7d19168f48eef4ea22c081ca1c031209 /lisp/gnus/gnus-util.el
parent2a847524ab57b1b3d6eaa7e12b96be52dbb79509 (diff)
downloademacs-870409d4fb06834c28e75cd653ad8aa2a7e8f581.tar.gz
Merge changes made in Gnus trunk.
shr.el: Start implementation. shr.el: Continue implementation. gnus-gravatar.el (gnus-gravatar-insert): Adjust character where we should go backward. shr.el: Minimally useful state achieved. mm-decode.el (mm-text-html-renderer): Switch to using shr.el for HTML rendering. shr.el: (shr-insert): Add a newline after every picture before text. gnus.texi (Splitting Mail): Really fix the @ref syntax. shr.el (shr-add-font): Use overlays for combining faces. shr.el (shr-add-font): Use overlays for combining faces. shr.el (shr-insert): Pass upwards the text start point. gnus-util.el: Reintroduce multiple completion functions.
Diffstat (limited to 'lisp/gnus/gnus-util.el')
-rw-r--r--lisp/gnus/gnus-util.el63
1 files changed, 50 insertions, 13 deletions
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index d188ebab734..0bf5b66a71d 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -44,11 +44,19 @@
(defmacro with-no-warnings (&rest body)
`(progn ,@body))))
-(defcustom gnus-use-ido nil
- "Whether to use `ido' for `completing-read'."
+(defcustom gnus-completing-read-function 'gnus-emacs-completing-read
+ "Function use to do completing read."
:version "24.1"
:group 'gnus-meta
- :type 'boolean)
+ :type '(radio (function-item
+ :doc "Use Emacs standard `completing-read' function."
+ gnus-emacs-completing-read)
+ (function-item
+ :doc "Use `ido-completing-read' function."
+ gnus-ido-completing-read)
+ (function-item
+ :doc "Use iswitchb based completing-read function."
+ gnus-iswitchb-completing-read)))
(defcustom gnus-completion-styles
(if (and (boundp 'completion-styles-alist)
@@ -1585,17 +1593,46 @@ SPEC is a predicate specifier that contains stuff like `or', `and',
(defun gnus-completing-read (prompt collection &optional require-match
initial-input history def)
- "Call `completing-read' or `ido-completing-read'.
-Depends on `gnus-use-ido'."
+ "Call `gnus-completing-read-function'."
+ (funcall gnus-completing-read-function
+ (concat prompt (when def
+ (concat " (default " def ")"))
+ ": ")
+ collection require-match initial-input history def))
+
+(defun gnus-emacs-completing-read (prompt collection &optional require-match
+ initial-input history def)
+ "Call standard `completing-read-function'."
(let ((completion-styles gnus-completion-styles))
- (funcall
- (if gnus-use-ido
- 'ido-completing-read
- 'completing-read)
- (concat prompt (when def
- (concat " (default " def ")"))
- ": ")
- collection nil require-match initial-input history def)))
+ (completing-read prompt collection nil require-match initial-input history def)))
+
+(defun gnus-ido-completing-read (prompt collection &optional require-match
+ initial-input history def)
+ "Call `ido-completing-read-function'."
+ (require 'ido)
+ (ido-completing-read prompt collection nil require-match initial-input history def))
+
+(defun gnus-iswitchb-completing-read (prompt collection &optional require-match
+ initial-input history def)
+ "`iswitchb' based completing-read function."
+ (require 'iswitchb)
+ (let ((iswitchb-make-buflist-hook
+ (lambda ()
+ (setq iswitchb-temp-buflist
+ (let ((choices (append
+ (when initial-input (list initial-input))
+ (symbol-value history) collection))
+ filtered-choices)
+ (dolist (x choices)
+ (setq filtered-choices (adjoin x filtered-choices)))
+ (nreverse filtered-choices))))))
+ (unwind-protect
+ (progn
+ (when (not iswitchb-mode)
+ (add-hook 'minibuffer-setup-hook 'iswitchb-minibuffer-setup))
+ (iswitchb-read-buffer prompt def require-match))
+ (when (not iswitchb-mode)
+ (remove-hook 'minibuffer-setup-hook 'iswitchb-minibuffer-setup)))))
(defun gnus-graphic-display-p ()
(if (featurep 'xemacs)