diff options
| author | Gnus developers <ding@gnus.org> | 2010-09-30 08:39:23 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka <yamaoka@jpl.org> | 2010-09-30 08:39:23 +0000 |
| commit | 229b59da361fdfbea696ef7d829453222b78b219 (patch) | |
| tree | fde9a1b1de67f3d0522c7701dbb6551a739716df /lisp/gnus/gnus-util.el | |
| parent | 968ef9b4dae78c5badd7f377b26519c8840823e7 (diff) | |
| download | emacs-229b59da361fdfbea696ef7d829453222b78b219.tar.gz | |
Merge changes made in Gnus trunk.
nndraft.el (nndraft-request-expire-articles): Use the group name instead if "nndraft".
gnus.texi (Using IMAP): Remove the @acronyms from the headings.
nnregistry.el: Added.
nnimap.el (nnimap-insert-partial-structure): Be way more permissive when interpreting the structures.
GNUS-NEWS: Minor error in GNUS-NEWS - password-cache.el.
nnimap.el (nnimap-request-accept-article): Add \r\n to the lines to make this work with Cyrus.
gnus-registry.el: Don't prompt on load, which makes it impossible to build Gnus.
gnus-gravatar.el: Add gnus-gravatar-properties.
gnus-agent.el, gnus-art.el, gnus-bookmark.el, gnus-dired.el, gnus-group.el,\
gnus-int.el, gnus-msg.el, gnus-registry.el, gnus-score.el, gnus-srvr.el,\
gnus-sum.el, gnus-topic.el, gnus-util.el, gnus.el, mm-decode.el, mm-util.el,\
mm-view.el, mml-smime.el, mml.el, nnmairix.el, nnrss.el, smime.el:\
Introduce gnus-completing-read.
gnus-util.el: Make completing-read function configurable.
gnus-util.el: Add requires and fix history for iswitchb.
webmail.el: Remove netscape/my-deja, since they no longer exist.
gnus.el (gnus-local-domain): Declare variable obsolete.
nnimap.el (nnimap-insert-partial-structure): Get the type from the correct slot, too.
pop3.el (pop3-send-streaming-command, pop3-stream-length): New variable.
nnimap.el (nnimap-open-connection): Revert the auto-network->starttls code.
nnimap.el (nnimap-request-set-mark): Erase the buffer before issuing commands.
nnimap.el (nnimap-split-rule): Mark as obsolete.
gnus-sum.el (gnus-valid-move-group-p): Make sure that `group' is a symbol.
nnimap.el (nnimap-split-incoming-mail): Allow `default' as nnimap-split-methods value.
nnimap.el (nnimap-request-article): Downcase the NILs so that they are nil.
nndoc.el (nndoc-retrieve-groups): New function.
gnus.texi: Fix Gravatar documentation.
Diffstat (limited to 'lisp/gnus/gnus-util.el')
| -rw-r--r-- | lisp/gnus/gnus-util.el | 95 |
1 files changed, 70 insertions, 25 deletions
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 5ebccc03f0f..2f9bdd62e6e 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -44,6 +44,32 @@ (defmacro with-no-warnings (&rest body) `(progn ,@body)))) +(defcustom gnus-completing-read-function + #'gnus-std-completing-read + "Function to do a completing read." + :group 'gnus-meta + :type '(radio (function-item + :doc "Use Emacs' standard `completing-read' function." + gnus-std-completing-read) + (function-item :doc "Use iswitchb's completing-read function." + gnus-icompleting-read) + (function-item :doc "Use ido's completing-read function." + gnus-ido-completing-read) + (function))) + +(defcustom gnus-completion-styles + (if (and (boundp 'completion-styles-alist) + (boundp 'completion-styles)) + (append (when (and (assq 'substring completion-styles-alist) + (not (memq 'substring completion-styles))) + (list 'substring)) + completion-styles) + nil) + "Value of `completion-styles' to use when completing." + :version "24.1" + :group 'gnus-meta + :type 'list) + ;; Fixme: this should be a gnus variable, not nnmail-. (defvar nnmail-pathname-coding-system) (defvar nnmail-active-file-coding-system) @@ -344,16 +370,6 @@ TIME defaults to the current time." (define-key keymap key (pop plist)) (pop plist))))) -(defun gnus-completing-read-with-default (default prompt &rest args) - ;; Like `completing-read', except that DEFAULT is the default argument. - (let* ((prompt (if default - (concat prompt " (default " default "): ") - (concat prompt ": "))) - (answer (apply 'completing-read prompt args))) - (if (or (null answer) (zerop (length answer))) - default - answer))) - ;; Two silly functions to ensure that all `y-or-n-p' questions clear ;; the echo area. ;; @@ -1574,21 +1590,50 @@ SPEC is a predicate specifier that contains stuff like `or', `and', `(,(car spec) ,@(mapcar 'gnus-make-predicate-1 (cdr spec))) (error "Invalid predicate specifier: %s" spec))))) -(defun gnus-completing-read (prompt table &optional predicate require-match - history) - (when (and history - (not (boundp history))) - (set history nil)) - (completing-read - (if (symbol-value history) - (concat prompt " (" (car (symbol-value history)) "): ") - (concat prompt ": ")) - table - predicate - require-match - nil - history - (car (symbol-value history)))) +(defun gnus-std-completing-read (prompt collection &optional require-match + initial-input history def) + (completing-read prompt collection nil require-match + initial-input history def)) + +(defun gnus-icompleting-read (prompt collection &optional require-match + initial-input history def) + (require 'iswitchb) + (let ((iswitchb-make-buflist-hook + (lambda () + (setq iswitchb-temp-buflist + (let ((choices (append (list) + (when initial-input (list initial-input)) + (symbol-value history) collection)) + filtered-choices) + (while choices + (when (and (car choices) (not (member (car choices) filtered-choices))) + (setq filtered-choices (cons (car choices) filtered-choices))) + (setq choices (cdr 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-ido-completing-read (prompt collection &optional require-match + initial-input history def) + (require 'ido) + (ido-completing-read prompt collection nil require-match + initial-input history def)) + +(defun gnus-completing-read (prompt collection &optional require-match + initial-input history def) + "Do a completing read with the configured `gnus-completing-read-function'." + (let ((completion-styles gnus-completion-styles)) + (funcall + gnus-completing-read-function + (concat prompt (when def + (concat " (default " def ")")) + ": ") + collection require-match initial-input history def))) (defun gnus-graphic-display-p () (if (featurep 'xemacs) |
