Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] Introduce gnus-completing-read
@ 2010-09-28 15:35 Julien Danjou
  2010-09-28 15:49 ` Eric Abrahamsen
                   ` (4 more replies)
  0 siblings, 5 replies; 48+ messages in thread
From: Julien Danjou @ 2010-09-28 15:35 UTC (permalink / raw)
  To: ding; +Cc: Julien Danjou

Signed-off-by: Julien Danjou <julien@danjou.info>
---

Hi there,

As promised yesterday, here's my patch!

It adds `gnus-completion-styles' which set `completion-styles' when calling
`completing-read'.

It adds `gnus-use-ido' which makes `gnus-completing-read' use
`ido-completing-read' rather than `completing-read'

It replaces (almost) all occurences of `completing-read' with
`gnus-completing-read', so it works with ido too.

It also probably fixes one or two bugs I found reading the code, but
maybe add others. So a review and some tests would be good. Anyhow, if
someone runs into a bug it should not be hard to fix. But merging with no
bugs would be better, of course.

 lisp/ChangeLog        |   76 +++++++++++++++++++++++++++++++++++
 lisp/gnus-agent.el    |   11 ++---
 lisp/gnus-art.el      |   17 ++++----
 lisp/gnus-bookmark.el |    4 +-
 lisp/gnus-diary.el    |    8 ++--
 lisp/gnus-dired.el    |    8 +---
 lisp/gnus-group.el    |  104 ++++++++++++++++++++++--------------------------
 lisp/gnus-int.el      |    9 ++--
 lisp/gnus-msg.el      |   26 ++++++------
 lisp/gnus-registry.el |   11 ++---
 lisp/gnus-score.el    |   27 +++++++------
 lisp/gnus-srvr.el     |    7 ++-
 lisp/gnus-sum.el      |   75 ++++++++++++++---------------------
 lisp/gnus-topic.el    |   24 ++++++-----
 lisp/gnus-util.el     |   57 +++++++++++++++------------
 lisp/gnus.el          |    6 +-
 lisp/mm-decode.el     |    4 +-
 lisp/mm-util.el       |   14 +++---
 lisp/mm-view.el       |    9 ++--
 lisp/mml-smime.el     |   17 ++++----
 lisp/mml.el           |   26 +++++++------
 lisp/nnir.el          |    2 +-
 lisp/nnmairix.el      |   26 ++++++------
 lisp/nnrss.el         |    6 +-
 lisp/smime.el         |   18 +++-----
 25 files changed, 324 insertions(+), 268 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bb8269a..d5546f9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -17,6 +17,82 @@
 	* gnus-gravatar.el (gnus-gravatar-insert): Search backward for
 	real-name, and then for mail address rather than doing : or , search.
 
+2010-09-27  Julien Danjou  <julien@danjou.info>
+
+	* gnus-srvr.el (gnus-server-add-server): Use gnus-completing-read.
+	(gnus-server-goto-server): Use gnus-completing-read.
+
+	* mm-view.el (mm-view-pkcs7-decrypt): Use gnus-completing-read.
+
+	* mm-util.el (defalias): Use gnus-completing-read.
+	(mm-codepage-setup): Use gnus-completing-read.
+
+	* smime.el (smime-sign-buffer): Use gnus-completing-read.
+	(smime-decrypt-buffer): Use gnus-completing-read.
+
+	* mml-smime.el (mml-smime-openssl-sign-query): Use gnus-completing-read.
+
+	* mml.el (mml-minibuffer-read-type): Use gnus-completing-read.
+	(mml-minibuffer-read-disposition): Use gnus-completing-read.
+	(mml-insert-multipart): Use gnus-completing-read.
+
+	* gnus-msg.el (gnus-summary-yank-message): Use gnus-completing-read.
+
+	* gnus-int.el (gnus-start-news-server): Use gnus-completing-read.
+
+	* mm-decode.el (mm-interactively-view-part): Use gnus-completing-read.
+
+	* gnus-dired.el (gnus-dired-attach): Use gnus-completing-read.
+
+	* gnus.el (gnus-read-method): Use gnus-completing-read.
+
+	* gnus-bookmark.el (gnus-bookmark-jump): Use gnus-completing-read.
+
+	* gnus-art.el (gnus-mime-view-part-as-type): Use gnus-completing-read.
+	(gnus-mime-action-on-part): Use gnus-completing-read.
+	(gnus-article-encrypt-body): Use gnus-completing-read.
+
+	* gnus-topic.el (gnus-topic-jump-to-topic): Use gnus-completing-read.
+	(gnus-topic-move-matching): Use gnus-completing-read.
+	(gnus-topic-copy-matching): Use gnus-completing-read.
+	(gnus-topic-sort-topics): Use gnus-completing-read.
+	(gnus-topic-move): Use gnus-completing-read.
+
+	* gnus-agent.el (gnus-agent-read-group): Remove prompt computing.
+	(gnus-agent-add-group): Use gnus-completing-read.
+
+	* nnmairix.el (nnmairix-create-server-and-default-group): Use
+	gnus-completing-read.
+	(nnmairix-update-groups): Use gnus-completing-read.
+	(nnmairix-get-server): Use gnus-completing-read.
+	(nnmairix-backend-to-server): Use gnus-completing-read.
+	(nnmairix-goto-original-article): Use gnus-completing-read.
+	(nnmairix-get-group-from-file-path): Use gnus-completing-read.
+
+	* nnrss.el (nnrss-find-rss-via-syndic8): Use gnus-completing-read.
+
+	* gnus-group.el (gnus-group-completing-read): Use gnus-completing-read.
+	(gnus-group-make-useful-group): Use gnus-completing-read.
+	(gnus-group-make-web-group): Use gnus-completing-read.
+	(gnus-group-add-to-virtual): Use gnus-completing-read.
+	(gnus-group-browse-foreign-server): Use gnus-completing-read.
+
+	* gnus-sum.el (gnus-summary-goto-article): Use gnus-completing-read.
+	(gnus-summary-limit-to-extra): Use gnus-completing-read.
+	(gnus-summary-execute-command): Use gnus-completing-read.
+	(gnus-summary-respool-article): Use gnus-completing-read.
+	(gnus-read-move-group-name): Use gnus-completing-read.
+
+	* gnus-score.el (gnus-summary-increase-score): Use gnus-completing-read.
+	(gnus-summary-score-effect): Use gnus-completing-read.
+
+	* gnus-registry.el (gnus-registry-read-mark): Use gnus-completing-read.
+
+	* gnus-util.el (gnus-completing-read): Use gnus-use-ido to apply the
+	right completing-read function.
+	(gnus-use-ido): New variable
+	(gnus-completing-read-with-default): Remove.
+
 2010-09-28  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* lpath.el: Remove url-http-file-exists-p, w32-focus-frame, and
diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el
index 4788deb..1cb3637 100644
--- a/lisp/gnus-agent.el
+++ b/lisp/gnus-agent.el
@@ -459,10 +459,7 @@ manipulated as follows:
   (let ((def (or (gnus-group-group-name) gnus-newsgroup-name)))
     (when def
       (setq def (gnus-group-decoded-name def)))
-    (gnus-group-completing-read (if def
-				    (concat "Group Name (" def "): ")
-				  "Group Name: ")
-				nil nil t nil nil def)))
+    (gnus-group-completing-read nil t nil nil def)))
 
 ;;; Fetching setup functions.
 
@@ -816,9 +813,9 @@ be a select method."
   (interactive
    (list
     (intern
-     (completing-read
-      "Add to category: "
-      (mapcar (lambda (cat) (list (symbol-name (car cat))))
+     (gnus-completing-read
+      "Add to category"
+      (mapcar (lambda (cat) (symbol-name (car cat)))
 	      gnus-category-alist)
       nil t))
     current-prefix-arg))
diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el
index 6e5cd4d..4e2d43c 100644
--- a/lisp/gnus-art.el
+++ b/lisp/gnus-art.el
@@ -5131,11 +5131,10 @@ available media-types."
   (unless mime-type
     (setq mime-type
 	  (let ((default (gnus-mime-view-part-as-type-internal)))
-	    (completing-read
-	     (format "View as MIME type (default %s): "
-		     (car default))
-	     (mapcar #'list (mailcap-mime-types))
-	     pred nil nil nil
+	    (gnus-completing-read
+	     "View as MIME type"
+	     (remove-if-not pred (mailcap-mime-types))
+	     nil nil nil
 	     (car default)))))
   (gnus-article-check-buffer)
   (let ((handle (get-text-property (point) 'gnus-data)))
@@ -5404,7 +5403,7 @@ If no internal viewer is available, use an external viewer."
 (defun gnus-mime-action-on-part (&optional action)
   "Do something with the MIME attachment at \(point\)."
   (interactive
-   (list (completing-read "Action: " gnus-mime-action-alist nil t)))
+   (list (gnus-completing-read "Action" (mapcar 'car gnus-mime-action-alist) t)))
   (gnus-article-check-buffer)
   (let ((action-pair (assoc action gnus-mime-action-alist)))
     (if action-pair
@@ -8370,9 +8369,9 @@ For example:
   (interactive
    (list
     (or gnus-article-encrypt-protocol
-	(completing-read "Encrypt protocol: "
-			 gnus-article-encrypt-protocol-alist
-			 nil t))
+	(gnus-completing-read "Encrypt protocol"
+                              (mapcar 'car gnus-article-encrypt-protocol-alist)
+                              t))
     current-prefix-arg))
   ;; User might hit `K E' instead of `K e', so prompt once.
   (when (and gnus-article-encrypt-protocol
diff --git a/lisp/gnus-bookmark.el b/lisp/gnus-bookmark.el
index 137479b..4237508 100644
--- a/lisp/gnus-bookmark.el
+++ b/lisp/gnus-bookmark.el
@@ -289,8 +289,8 @@ So the cdr of each bookmark is an alist too.")
   (interactive)
   (gnus-bookmark-maybe-load-default-file)
   (let* ((bookmark (or bmk-name
-	  (completing-read "Jump to bookmarked article: "
-			   gnus-bookmark-alist)))
+                       (gnus-completing-read "Jump to bookmarked article"
+                                             (mapcar 'car gnus-bookmark-alist))))
 	 (bmk-record (cadr (assoc bookmark gnus-bookmark-alist)))
 	 (group (cdr (assoc 'group bmk-record)))
 	 (message-id (cdr (assoc 'message-id bmk-record))))
diff --git a/lisp/gnus-diary.el b/lisp/gnus-diary.el
index 18130bb..76d469b 100644
--- a/lisp/gnus-diary.el
+++ b/lisp/gnus-diary.el
@@ -368,11 +368,11 @@ If ARG (or prefix) is non-nil, force prompting for all fields."
 				 header ": ")))
 	     (setq value
 		   (if (listp (nth 1 head))
-		       (completing-read prompt (cons '("*" nil) (nth 1 head))
-					nil t value
-					gnus-diary-header-value-history)
+		       (gnus-completing-read prompt (cons '("*" nil) (nth 1 head))
+                                             t value
+                                             'gnus-diary-header-value-history)
 		     (read-string prompt value
-				  gnus-diary-header-value-history))))
+				  'gnus-diary-header-value-history))))
 	   (setq ask nil)
 	   (setq invalid nil)
 	   (condition-case ()
diff --git a/lisp/gnus-dired.el b/lisp/gnus-dired.el
index f9502b4..da20c66 100644
--- a/lisp/gnus-dired.el
+++ b/lisp/gnus-dired.el
@@ -152,12 +152,8 @@ filenames."
 	  (setq destination
 		(if (= (length bufs) 1)
 		    (get-buffer (car bufs))
-		  (completing-read "Attach to which mail composition buffer: "
-				   (mapcar
-				    (lambda (b)
-				      (cons b (get-buffer b)))
-				    bufs)
-				   nil t)))
+		  (gnus-completing-read "Attach to which mail composition buffer"
+                                         bufs t)))
 	;; setup a new mail composition buffer
 	(let ((mail-user-agent gnus-dired-mail-mode)
 	      ;; A workaround to prevent Gnus from displaying the Gnus
diff --git a/lisp/gnus-group.el b/lisp/gnus-group.el
index 7dddb9b..bb4faee 100644
--- a/lisp/gnus-group.el
+++ b/lisp/gnus-group.el
@@ -2164,44 +2164,35 @@ be permanent."
 		group)))
 	(goto-char start)))))
 
-(defun gnus-group-completing-read (prompt &optional collection predicate
-					  require-match initial-input hist def
-					  &rest args)
+(defun gnus-group-completing-read (prompt &optional collection
+					  require-match initial-input hist def)
   "Read a group name with completion.  Non-ASCII group names are allowed.
 The arguments are the same as `completing-read' except that COLLECTION
 and HIST default to `gnus-active-hashtb' and `gnus-group-history'
 respectively if they are omitted."
-  (let ((completion-styles (and (boundp 'completion-styles)
-				completion-styles))
-	group)
-    (push 'substring completion-styles)
-    (mapatoms (lambda (symbol)
-		(setq group (symbol-name symbol))
-		(set (intern (if (string-match "[^\000-\177]" group)
-				 (gnus-group-decoded-name group)
-			       group)
-			     collection)
-		     group))
-	      (prog1
-		  (or collection
-		      (setq collection (or gnus-active-hashtb [0])))
-		(setq collection (gnus-make-hashtable (length collection)))))
-    (setq group (apply 'completing-read prompt collection predicate
-		       require-match initial-input
-		       (or hist 'gnus-group-history)
-		       def args))
-    (or (prog1
-	    (symbol-value (intern-soft group collection))
-	  (setq collection nil))
-	(mm-encode-coding-string group (gnus-group-name-charset nil group)))))
+  (let* ((choices (mapcar (lambda (symbol)
+                            (let ((group (symbol-name symbol)))
+                              (if (string-match "[^\000-\177]" group)
+                                  (gnus-group-decoded-name group)
+                                group)))
+                          (remove-if-not
+                           'symbolp
+                           (or collection (or gnus-active-hashtb [0])))))
+         (group
+          (gnus-completing-read prompt choices
+                                require-match initial-input
+                                (or hist 'gnus-group-history)
+                                def)))
+    (or (symbol-value (intern-soft group collection))
+        (mm-encode-coding-string group (gnus-group-name-charset nil group)))))
 
 ;;;###autoload
 (defun gnus-fetch-group (group &optional articles)
   "Start Gnus if necessary and enter GROUP.
 If ARTICLES, display those articles.
 Returns whether the fetching was successful or not."
-  (interactive (list (gnus-group-completing-read "Group name: "
-						 nil nil nil
+  (interactive (list (gnus-group-completing-read "Group name"
+						 nil nil
 						 (gnus-group-name-at-point))))
   (unless (gnus-alive-p)
     (gnus-no-server))
@@ -2261,7 +2252,7 @@ Return the name of the group if selection was successful."
   (interactive
    (list
     ;; (gnus-read-group "Group name: ")
-    (gnus-group-completing-read "Group: ")
+    (gnus-group-completing-read "Group")
     (gnus-read-method "From method: ")))
   ;; Transform the select method into a unique server.
   (when (stringp method)
@@ -2328,7 +2319,7 @@ specified by `gnus-gmane-group-download-format'."
   ;; See <http://gmane.org/export.php> for more information.
   (interactive
    (list
-    (gnus-group-completing-read "Gmane group: ")
+    (gnus-group-completing-read "Gmane group")
     (read-number "Start article number: ")
     (read-number "How many articles: ")))
   (unless range (setq range 500))
@@ -2362,7 +2353,7 @@ Valid input formats include:
   ;;   prompt the user to decide: "View via `browse-url' or in Gnus? "
   ;;   (`gnus-read-ephemeral-gmane-group-url')
   (interactive
-   (list (gnus-group-completing-read "Gmane URL: ")))
+   (list (gnus-group-completing-read "Gmane URL")))
   (let (group start range)
     (cond
      ;; URLs providing `group', `start' and `range':
@@ -2456,13 +2447,13 @@ If PROMPT (the prefix) is a number, use the prompt specified in
 `gnus-group-jump-to-group-prompt'."
   (interactive
    (list (gnus-group-completing-read
-	  "Group: " nil nil (gnus-read-active-file-p)
-	  (if current-prefix-arg
-	      (cdr (assq current-prefix-arg gnus-group-jump-to-group-prompt))
-	    (or (and (stringp gnus-group-jump-to-group-prompt)
-		     gnus-group-jump-to-group-prompt)
-		(let ((p (cdr (assq 0 gnus-group-jump-to-group-prompt))))
-		  (and (stringp p) p)))))))
+          "Group" nil (gnus-read-active-file-p)
+          (if current-prefix-arg
+              (cdr (assq current-prefix-arg gnus-group-jump-to-group-prompt))
+            (or (and (stringp gnus-group-jump-to-group-prompt)
+                     gnus-group-jump-to-group-prompt)
+                (let ((p (cdr (assq 0 gnus-group-jump-to-group-prompt))))
+                  (and (stringp p) p)))))))
 
   (when (equal group "")
     (error "Empty group name"))
@@ -2653,7 +2644,7 @@ If EXCLUDE-GROUP, do not go to that group."
 (defun gnus-group-make-group-simple (&optional group)
   "Add a new newsgroup.
 The user will be prompted for GROUP."
-  (interactive (list (gnus-group-completing-read "Group: ")))
+  (interactive (list (gnus-group-completing-read "Group")))
   (gnus-group-make-group (gnus-group-real-name group)
 			 (gnus-group-server group)
 			 nil nil t))
@@ -2912,8 +2903,9 @@ and NEW-NAME will be prompted for."
 (defun gnus-group-make-useful-group (group method)
   "Create one of the groups described in `gnus-useful-groups'."
   (interactive
-   (let ((entry (assoc (completing-read "Create group: " gnus-useful-groups
-					nil t)
+   (let ((entry (assoc (gnus-completing-read "Create group"
+                                             (mapcar 'car gnus-useful-groups)
+                                             t)
 		       gnus-useful-groups)))
      (list (cadr entry)
 	   ;; Don't use `caddr' here since macros within the `interactive'
@@ -3005,11 +2997,11 @@ If SOLID (the prefix), create a solid group."
 			   (symbol-name (caar nnweb-type-definition))))
 	 (type
 	  (gnus-string-or
-	   (completing-read
-	    (format "Search engine type (default %s): " default-type)
-	    (mapcar (lambda (elem) (list (symbol-name (car elem))))
+	   (gnus-completing-read
+	    "Search engine type"
+	    (mapcar (lambda (elem) (symbol-name (car elem)))
 		    nnweb-type-definition)
-	    nil t nil 'gnus-group-web-type-history)
+	    t nil 'gnus-group-web-type-history)
 	   default-type))
 	 (search
 	  (read-string
@@ -3100,8 +3092,8 @@ mail messages or news articles in files that have numeric names."
   "Add the current group to a virtual group."
   (interactive
    (list current-prefix-arg
-	 (completing-read "Add to virtual group: " gnus-newsrc-hashtb nil t
-			  "nnvirtual:")))
+	 (gnus-group-completing-read "Add to virtual group"
+                                     nil t "nnvirtual:")))
   (unless (eq (car (gnus-find-method-for-group vgroup)) 'nnvirtual)
     (error "%s is not an nnvirtual group" vgroup))
   (gnus-close-group vgroup)
@@ -3672,7 +3664,7 @@ If given numerical prefix, toggle the N next groups."
 Killed newsgroups are subscribed.  If SILENT, don't try to update the
 group line."
   (interactive (list (gnus-group-completing-read
-		      "Group: " nil nil (gnus-read-active-file-p))))
+		      "Group" (gnus-read-active-file-p))))
   (let ((newsrc (gnus-group-entry group)))
     (cond
      ((string-match "^[ \t]*$" group)
@@ -4013,7 +4005,7 @@ If DONT-SCAN is non-nil, scan non-activated groups as well."
 If given a prefix argument, prompt for a group."
   (interactive
    (list (or (when current-prefix-arg
-	       (gnus-group-completing-read "Group: "))
+	       (gnus-group-completing-read "Group"))
 	     (gnus-group-group-name)
 	     gnus-newsgroup-name)))
   (unless group
@@ -4314,18 +4306,18 @@ If called interactively, this function will ask for a select method
 If not, METHOD should be a list where the first element is the method
 and the second element is the address."
   (interactive
-   (list (let ((how (completing-read
-		     "Which back end: "
-		     (append gnus-valid-select-methods gnus-server-alist)
-		     nil t (cons "nntp" 0) 'gnus-method-history)))
+   (list (let ((how (gnus-completing-read
+		     "Which back end"
+		     (mapcar 'car (append gnus-valid-select-methods gnus-server-alist))
+		     t (cons "nntp" 0) 'gnus-method-history)))
 	   ;; We either got a back end name or a virtual server name.
 	   ;; If the first, we also need an address.
 	   (if (assoc how gnus-valid-select-methods)
 	       (list (intern how)
 		     ;; Suggested by mapjph@bath.ac.uk.
-		     (completing-read
-		      "Address: "
-		      (mapcar 'list gnus-secondary-servers)))
+		     (gnus-completing-read
+		      "Address"
+		      gnus-secondary-servers))
 	     ;; We got a server name.
 	     how))))
   (gnus-browse-foreign-server method))
diff --git a/lisp/gnus-int.el b/lisp/gnus-int.el
index 3245b16..33d020f 100644
--- a/lisp/gnus-int.el
+++ b/lisp/gnus-int.el
@@ -94,11 +94,10 @@ If CONFIRM is non-nil, the user will be asked for an NNTP server."
       (when confirm
 	;; Read server name with completion.
 	(setq gnus-nntp-server
-	      (completing-read "NNTP server: "
-			       (mapcar 'list
-				       (cons (list gnus-nntp-server)
-					     gnus-secondary-servers))
-			       nil nil gnus-nntp-server)))
+	      (gnus-completing-read "NNTP server"
+                                    (cons gnus-nntp-server
+                                          gnus-secondary-servers)
+                                    nil gnus-nntp-server)))
 
       (when (and gnus-nntp-server
 		 (stringp gnus-nntp-server)
diff --git a/lisp/gnus-msg.el b/lisp/gnus-msg.el
index a2a2652..a3794f2 100644
--- a/lisp/gnus-msg.el
+++ b/lisp/gnus-msg.el
@@ -578,8 +578,8 @@ If ARG is 1, prompt for a group name to find the posting style."
 		(if arg
 		    (if (= 1 (prefix-numeric-value arg))
 			(gnus-group-completing-read
-			 "Use posting style of group: "
-			 nil nil (gnus-read-active-file-p))
+			 "Use posting style of group"
+			 nil (gnus-read-active-file-p))
 		      (gnus-group-group-name))
 		  ""))
 	  ;; #### see comment in gnus-setup-message -- drv
@@ -607,8 +607,8 @@ network.  The corresponding back end must have a 'request-post method."
 	  (setq gnus-newsgroup-name
 		(if arg
 		    (if (= 1 (prefix-numeric-value arg))
-			(gnus-group-completing-read "Use group: "
-						    nil nil
+			(gnus-group-completing-read "Use group"
+						    nil
 						    (gnus-read-active-file-p))
 		      (gnus-group-group-name))
 		  ""))
@@ -628,7 +628,7 @@ a news."
   (let ((gnus-newsgroup-name
 	 (if arg
 	     (if (= 1 (prefix-numeric-value arg))
-		 (gnus-group-completing-read "Newsgroup: " nil nil
+		 (gnus-group-completing-read "Newsgroup" nil
 					     (gnus-read-active-file-p))
 	       (gnus-group-group-name))
 	   ""))
@@ -654,8 +654,8 @@ posting style."
 	  (setq gnus-newsgroup-name
 		(if arg
 		    (if (= 1 (prefix-numeric-value arg))
-			(gnus-group-completing-read "Use group: "
-						    nil nil
+			(gnus-group-completing-read "Use group"
+						    nil
 						    (gnus-read-active-file-p))
 		      "")
 		  gnus-newsgroup-name))
@@ -684,8 +684,8 @@ network.  The corresponding back end must have a 'request-post method."
 	  (setq gnus-newsgroup-name
 		(if arg
 		    (if (= 1 (prefix-numeric-value arg))
-			(gnus-group-completing-read "Use group: "
-						    nil nil
+			(gnus-group-completing-read "Use group"
+						    nil
 						    (gnus-read-active-file-p))
 		      "")
 		  gnus-newsgroup-name))
@@ -710,7 +710,7 @@ a news."
   (let ((gnus-newsgroup-name
 	 (if arg
 	     (if (= 1 (prefix-numeric-value arg))
-		 (gnus-group-completing-read "Newsgroup: " nil nil
+		 (gnus-group-completing-read "Newsgroup" nil
 					     (gnus-read-active-file-p))
 	       "")
 	   gnus-newsgroup-name))
@@ -1028,8 +1028,8 @@ If SILENT, don't prompt the user."
 			 gnus-last-posting-server)
 		    ;; Just use the last value.
 		    gnus-last-posting-server
-		  (completing-read
-		   "Posting method: " method-alist nil t
+		  (gnus-completing-read
+		   "Posting method" (mapcar 'car method-alist) t
 		   (cons (or gnus-last-posting-server "") 0))))
 	  method-alist))))
      ;; Override normal method.
@@ -1487,7 +1487,7 @@ If YANK is non-nil, include the original article."
 (defun gnus-summary-yank-message (buffer n)
   "Yank the current article into a composed message."
   (interactive
-   (list (completing-read "Buffer: " (mapcar 'list (message-buffers)) nil t)
+   (list (gnus-completing-read "Buffer" (message-buffers) t)
 	 current-prefix-arg))
   (gnus-summary-iterate n
     (let ((gnus-inhibit-treatment t))
diff --git a/lisp/gnus-registry.el b/lisp/gnus-registry.el
index a30847b..984890a 100644
--- a/lisp/gnus-registry.el
+++ b/lisp/gnus-registry.el
@@ -857,12 +857,11 @@ Uses `gnus-registry-marks' to find what shortcuts to install."
 
 (defun gnus-registry-read-mark ()
   "Read a mark name from the user with completion."
-  (let ((mark (gnus-completing-read-with-default
-	       (symbol-name gnus-registry-default-mark)
-	       "Label"
-	       (mapcar (lambda (x)	; completion list
-			 (cons (symbol-name (car-safe x)) (car-safe x)))
-		       gnus-registry-marks))))
+  (let ((mark (gnus-completing-read
+               "Label"
+               (mapcar 'symbol-name (mapcar 'car gnus-registry-marks))
+               nil nil nil
+	       (symbol-name gnus-registry-default-mark))))
     (when (stringp mark)
       (intern mark))))
 
diff --git a/lisp/gnus-score.el b/lisp/gnus-score.el
index 03ff30d..26c3ca3 100644
--- a/lisp/gnus-score.el
+++ b/lisp/gnus-score.el
@@ -680,14 +680,14 @@ file for the command instead of the current score file."
 	  (and gnus-extra-headers
 	       (equal (nth 1 entry) "extra")
 	       (intern			; need symbol
-		(gnus-completing-read-with-default
-		 (symbol-name (car gnus-extra-headers))	; default response
-		 "Score extra header"	; prompt
-		 (mapcar (lambda (x)	; completion list
-			   (cons (symbol-name x) x))
-			 gnus-extra-headers)
-		 nil			; no completion limit
-		 t))))			; require match
+                (let ((collection (mapcar 'symbol-name gnus-extra-headers)))
+                  (gnus-completing-read
+                   "Score extra header"  ; prompt
+                   collection            ; completion list
+                   t                     ; require match
+                   nil                   ; no history
+                   nil                   ; no initial-input
+                   (car collection)))))) ; default value
     ;; extra is now nil or a symbol.
 
     ;; We have all the data, so we enter this score.
@@ -913,10 +913,13 @@ MATCH is the string we are looking for.
 TYPE is the score type.
 SCORE is the score to add.
 EXTRA is the possible non-standard header."
-  (interactive (list (completing-read "Header: "
-				      gnus-header-index
-				      (lambda (x) (fboundp (nth 2 x)))
-				      t)
+  (interactive (list (gnus-completing-read "Header"
+                                           (mapcar
+                                            'car
+                                            (remove-if-not
+                                             (lambda (x) (fboundp (nth 2 x)))
+                                             gnus-header-index))
+                                           t)
 		     (read-string "Match: ")
 		     (if (y-or-n-p "Use regexp match? ") 'r 's)
 		     (string-to-number (read-string "Score: "))))
diff --git a/lisp/gnus-srvr.el b/lisp/gnus-srvr.el
index 11164a8..2b13f39 100644
--- a/lisp/gnus-srvr.el
+++ b/lisp/gnus-srvr.el
@@ -571,8 +571,9 @@ The following commands are available:
 
 (defun gnus-server-add-server (how where)
   (interactive
-   (list (intern (completing-read "Server method: "
-				  gnus-valid-select-methods nil t))
+   (list (intern (gnus-completing-read "Server method"
+                                       (mapcar 'car gnus-valid-select-methods)
+                                       t))
 	 (read-string "Server name: ")))
   (when (assq where gnus-server-alist)
     (error "Server with that name already defined"))
@@ -582,7 +583,7 @@ The following commands are available:
 (defun gnus-server-goto-server (server)
   "Jump to a server line."
   (interactive
-   (list (completing-read "Goto server: " gnus-server-alist nil t)))
+   (list (gnus-completing-read "Goto server" (mapcar 'car gnus-server-alist) t)))
   (let ((to (text-property-any (point-min) (point-max)
 			       'gnus-server (intern server))))
     (when to
diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el
index b8b17b3..59b9682 100644
--- a/lisp/gnus-sum.el
+++ b/lisp/gnus-sum.el
@@ -7999,10 +7999,9 @@ If FORCE, go to the article even if it isn't displayed.  If FORCE
 is a number, it is the line the article is to be displayed on."
   (interactive
    (list
-    (completing-read
-     "Article number or Message-ID: "
-     (mapcar (lambda (number) (list (int-to-string number)))
-	     gnus-newsgroup-limit))
+    (gnus-completing-read
+     "Article number or Message-ID"
+     (mapcar 'int-to-string gnus-newsgroup-limit))
     current-prefix-arg
     t))
   (prog1
@@ -8256,16 +8255,13 @@ articles that are younger than AGE days."
   (interactive
    (let ((header
 	  (intern
-	   (gnus-completing-read-with-default
-	    (symbol-name (car gnus-extra-headers))
+	   (gnus-completing-read
 	    (if current-prefix-arg
 		"Exclude extra header"
 	      "Limit extra header")
-	    (mapcar (lambda (x)
-		      (cons (symbol-name x) x))
-		    gnus-extra-headers)
-	    nil
-	    t))))
+	    (mapcar 'symbol-name gnus-extra-headers)
+	    t nil nil
+            (symbol-name (car gnus-extra-headers))))))
      (list header
 	   (read-string (format "%s header %s (regexp): "
 				(if current-prefix-arg "Exclude" "Limit to")
@@ -9234,14 +9230,14 @@ If HEADER is an empty string (or nil), the match is done on the entire
 article.  If BACKWARD (the prefix) is non-nil, search backward instead."
   (interactive
    (list (let ((completion-ignore-case t))
-	   (completing-read
-	    "Header name: "
-	    (mapcar (lambda (header) (list (format "%s" header)))
+	   (gnus-completing-read
+	    "Header name"
+	    (mapcar 'symbol-name
 		    (append
-		     '("Number" "Subject" "From" "Lines" "Date"
-		       "Message-ID" "Xref" "References" "Body")
+		     '(Number Subject From Lines Date
+		       Message-ID Xref References Body)
 		     gnus-extra-headers))
-	    nil 'require-match))
+	    'require-match))
 	 (read-string "Regexp: ")
 	 (read-key-sequence "Command: ")
 	 current-prefix-arg))
@@ -9937,9 +9933,9 @@ latter case, they will be copied into the relevant groups."
 				  (car (gnus-find-method-for-group
 					gnus-newsgroup-name)))))
 		(method
-		 (gnus-completing-read-with-default
-		  methname "Backend to use when respooling"
-		  methods nil t nil 'gnus-mail-method-history))
+		 (gnus-completing-read
+		  "Backend to use when respooling"
+		  methods t nil 'gnus-mail-method-history methname))
 		ms)
 	   (cond
 	    ((zerop (length (setq ms (gnus-servers-using-backend
@@ -9949,7 +9945,7 @@ latter case, they will be copied into the relevant groups."
 	     (car ms))
 	    (t
 	     (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
-	       (cdr (assoc (completing-read "Server name: " ms-alist nil t)
+	       (cdr (assoc (gnus-completing-read "Server name" ms-alist t)
 			   ms-alist))))))))
   (unless method
     (error "No method given for respooling"))
@@ -11921,29 +11917,20 @@ save those articles instead."
 		      (format "these %d articles" (length articles))
 		    "this article")))
 	 (to-newsgroup
-	  (let (active group)
-	    (when (or (null split-name) (= 1 (length split-name)))
-	      (setq active (gnus-make-hashtable (length gnus-active-hashtb)))
-	      (mapatoms (lambda (symbol)
-			  (setq group (symbol-name symbol))
-			  (when (string-match "[^\000-\177]" group)
-			    (setq group (gnus-group-decoded-name group)))
-			  (set (intern group active) group))
-			gnus-active-hashtb))
-	    (cond
-	     ((null split-name)
-	      (gnus-completing-read-with-default
-	       default prom active 'gnus-valid-move-group-p nil prefix
-	       'gnus-group-history))
-	     ((= 1 (length split-name))
-	      (gnus-completing-read-with-default
-	       (car split-name) prom active 'gnus-valid-move-group-p nil nil
-	       'gnus-group-history))
-	     (t
-	      (gnus-completing-read-with-default
-	       nil prom (mapcar 'list (nreverse split-name)) nil nil nil
-	       'gnus-group-history)))))
-	 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
+          (cond
+           ((null split-name)
+            (gnus-group-completing-read
+             prom
+             (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb)
+             nil prefix nil default))
+           ((= 1 (length split-name))
+            (gnus-group-completing-read
+             prom (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb)
+             nil prefix 'gnus-group-history (car split-name)))
+           (t
+            (gnus-completing-read
+             prom (nreverse split-name) nil nil 'gnus-group-history))))
+         (to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
 	 encoded)
     (when to-newsgroup
       (if (or (string= to-newsgroup "")
diff --git a/lisp/gnus-topic.el b/lisp/gnus-topic.el
index 7c71035..b600fac 100644
--- a/lisp/gnus-topic.el
+++ b/lisp/gnus-topic.el
@@ -161,9 +161,7 @@ See Info node `(gnus)Formatting Variables'."
 (defun gnus-topic-jump-to-topic (topic)
   "Go to TOPIC."
   (interactive
-   (list (completing-read "Go to topic: "
-			  (mapcar 'list (gnus-topic-list))
-			  nil t)))
+   (list (gnus-completing-read "Go to topic" (gnus-topic-list) t)))
   (let ((buffer-read-only nil))
     (dolist (topic (gnus-current-topics topic))
       (unless (gnus-topic-goto-topic topic)
@@ -1303,7 +1301,7 @@ When used interactively, PARENT will be the topic under point."
 If COPYP, copy the groups instead."
   (interactive
    (list current-prefix-arg
-	 (gnus-completing-read "Move to topic" gnus-topic-alist nil t
+	 (gnus-completing-read "Move to topic" (mapcar 'car gnus-topic-alist) t
 			       'gnus-topic-history)))
   (let ((use-marked (and (not n) (not (gnus-region-active-p))
 			 gnus-group-marked t))
@@ -1350,7 +1348,7 @@ If COPYP, copy the groups instead."
   "Copy the current group to a topic."
   (interactive
    (list current-prefix-arg
-	 (completing-read "Copy to topic: " gnus-topic-alist nil t)))
+	 (gnus-completing-read "Copy to topic" (mapcar 'car gnus-topic-alist) t)))
   (gnus-topic-move-group n topic t))
 
 (defun gnus-topic-kill-group (&optional n discard)
@@ -1443,7 +1441,8 @@ If PERMANENT, make it stay shown in subsequent sessions as well."
 	(gnus-topic-remove-topic t nil)
       (let ((topic
 	     (gnus-topic-find-topology
-	      (completing-read "Show topic: " gnus-topic-alist nil t))))
+	      (gnus-completing-read "Show topic"
+                                    (mapcar 'car gnus-topic-alist) t))))
 	(setcar (cddr (cadr topic)) nil)
 	(setcar (cdr (cadr topic)) 'visible)
 	(gnus-group-list-groups)))))
@@ -1491,7 +1490,8 @@ If NON-RECURSIVE (which is the prefix) is t, don't unmark its subtopics."
    (let (topic)
      (nreverse
       (list
-       (setq topic (completing-read "Move to topic: " gnus-topic-alist nil t))
+       (setq topic (gnus-completing-read "Move to topic"
+                                         (mapcar 'car gnus-topic-alist) t))
        (read-string (format "Move to %s (regexp): " topic))))))
   (gnus-group-mark-regexp regexp)
   (gnus-topic-move-group nil topic copyp))
@@ -1502,7 +1502,8 @@ If NON-RECURSIVE (which is the prefix) is t, don't unmark its subtopics."
    (let (topic)
      (nreverse
       (list
-       (setq topic (completing-read "Copy to topic: " gnus-topic-alist nil t))
+       (setq topic (gnus-completing-read "Copy to topic"
+                                         (mapcar 'car gnus-topic-alist) t))
        (read-string (format "Copy to %s (regexp): " topic))))))
   (gnus-topic-move-matching regexp topic t))
 
@@ -1723,8 +1724,9 @@ If REVERSE, sort in reverse order."
   "Sort topics in TOPIC alphabetically by topic name.
 If REVERSE, reverse the sorting order."
   (interactive
-   (list (completing-read "Sort topics in : " gnus-topic-alist nil t
-			  (gnus-current-topic))
+   (list (gnus-completing-read "Sort topics in"
+                               (mapcar 'car gnus-topic-alist) t
+                               (gnus-current-topic))
 	 current-prefix-arg))
   (let ((topic-topology (or (and topic (cdr (gnus-topic-find-topology topic)))
 			    gnus-topic-topology)))
@@ -1738,7 +1740,7 @@ If REVERSE, reverse the sorting order."
   (interactive
    (list
     (gnus-group-topic-name)
-    (completing-read "Move to topic: " gnus-topic-alist nil t)))
+    (gnus-completing-read "Move to topic" (mapcar 'car gnus-topic-alist) t)))
   (unless (and current to)
     (error "Can't find topic"))
   (let ((current-top (cdr (gnus-topic-find-topology current)))
diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el
index 5ebccc0..d188eba 100644
--- a/lisp/gnus-util.el
+++ b/lisp/gnus-util.el
@@ -44,6 +44,25 @@
     (defmacro with-no-warnings (&rest body)
       `(progn ,@body))))
 
+(defcustom gnus-use-ido nil
+  "Whether to use `ido' for `completing-read'."
+  :version "24.1"
+  :group 'gnus-meta
+  :type 'boolean)
+
+(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 +363,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 +1583,19 @@ 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-completing-read (prompt collection &optional require-match
+                                    initial-input history def)
+  "Call `completing-read' or `ido-completing-read'.
+Depends on `gnus-use-ido'."
+  (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)))
 
 (defun gnus-graphic-display-p ()
   (if (featurep 'xemacs)
diff --git a/lisp/gnus.el b/lisp/gnus.el
index dafaafc..c01cd62 100644
--- a/lisp/gnus.el
+++ b/lisp/gnus.el
@@ -4240,9 +4240,9 @@ Allow completion over sensible values."
 		  gnus-predefined-server-alist
 		  gnus-server-alist))
 	 (method
-	  (completing-read
-	   prompt servers
-	   nil t nil 'gnus-method-history)))
+	  (gnus-completing-read
+	   prompt (mapcar 'car servers)
+	   t nil 'gnus-method-history)))
     (cond
      ((equal method "")
       (setq method gnus-select-method))
diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el
index 9b756ed..7562e57 100644
--- a/lisp/mm-decode.el
+++ b/lisp/mm-decode.el
@@ -1323,11 +1323,11 @@ Use CMD as the process."
   "Display HANDLE using METHOD."
   (let* ((type (mm-handle-media-type handle))
 	 (methods
-	  (mapcar (lambda (i) (list (cdr (assoc 'viewer i))))
+	  (mapcar (lambda (i) (cdr (assoc 'viewer i)))
 		  (mailcap-mime-info type 'all)))
 	 (method (let ((minibuffer-local-completion-map
 			mm-viewer-completion-map))
-		   (completing-read "Viewer: " methods))))
+		   (gnus-completing-read "Viewer" methods))))
     (when (string= method "")
       (error "No method given"))
     (if (string-match "^[^% \t]+$" method)
diff --git a/lisp/mm-util.el b/lisp/mm-util.el
index 7f0d338..c408c61 100644
--- a/lisp/mm-util.el
+++ b/lisp/mm-util.el
@@ -68,11 +68,11 @@
       . ,(lambda (prompt)
 	   "Return a charset."
 	   (intern
-	    (completing-read
+	    (gnus-completing-read
 	     prompt
-	     (mapcar (lambda (e) (list (symbol-name (car e))))
+	     (mapcar (lambda (e) (symbol-name (car e)))
 		     mm-mime-mule-charset-alist)
-	     nil t))))
+	     t))))
      ;; `subst-char-in-string' is not available in XEmacs 21.4.
      (subst-char-in-string
       . ,(lambda (from to string &optional inplace)
@@ -281,8 +281,8 @@ to the contents of the accessible portion of the buffer."
 	'read-coding-system))
      (t (lambda (prompt &optional default-coding-system)
 	  "Prompt the user for a coding system."
-	  (completing-read
-	   prompt (mapcar (lambda (s) (list (symbol-name (car s))))
+	  (gnus-completing-read
+	   prompt (mapcar (lambda (s) (symbol-name (car s)))
 			  mm-mime-mule-charset-alist)))))))
 
 (defvar mm-coding-system-list nil)
@@ -316,8 +316,8 @@ the alias.  Else windows-NUMBER is used."
 			 (cp-supported-codepages)
 		       ;; Removed in Emacs 23 (unicode), so signal an error:
 		       (error "`codepage-setup' not present in this Emacs version"))))
-     (list (completing-read "Setup DOS Codepage: (default 437) " candidates
-			    nil t nil nil "437"))))
+     (list (gnus-completing-read "Setup DOS Codepage" candidates
+                                 t nil nil "437"))))
   (when alias
     (setq alias (if (stringp alias)
 		    (intern alias)
diff --git a/lisp/mm-view.el b/lisp/mm-view.el
index 1a2d940..566908c 100644
--- a/lisp/mm-view.el
+++ b/lisp/mm-view.el
@@ -31,6 +31,7 @@
 (require 'mm-decode)
 (require 'smime)
 
+(autoload 'gnus-completing-read "gnus-util")
 (autoload 'gnus-article-prepare-display "gnus-art")
 (autoload 'vcard-parse-string "vcard")
 (autoload 'vcard-format-string "vcard")
@@ -676,11 +677,9 @@
    (if (= (length smime-keys) 1)
        (cadar smime-keys)
      (smime-get-key-by-email
-      (completing-read
-       (concat "Decipher using key"
-	       (if smime-keys (concat "(default " (caar smime-keys) "): ")
-		 ": "))
-       smime-keys nil nil nil nil (car-safe (car-safe smime-keys))))))
+      (gnus-completing-read
+       "Decipher using key"
+       smime-keys nil nil nil (car-safe (car-safe smime-keys))))))
   (goto-char (point-min))
   (while (search-forward "\r\n" nil t)
     (replace-match "\n"))
diff --git a/lisp/mml-smime.el b/lisp/mml-smime.el
index a99538b..62e742f 100644
--- a/lisp/mml-smime.el
+++ b/lisp/mml-smime.el
@@ -161,10 +161,10 @@ Whether the passphrase is cached at all is controlled by
 					     "")))))
 		(and from (smime-get-key-by-email from)))
 	      (smime-get-key-by-email
-	       (completing-read "Sign this part with what signature? "
-				smime-keys nil nil
-				(and (listp (car-safe smime-keys))
-				     (caar smime-keys))))))))
+	       (gnus-completing-read "Sign this part with what signature"
+                                     smime-keys nil nil
+                                     (and (listp (car-safe smime-keys))
+                                          (caar smime-keys))))))))
 
 (defun mml-smime-get-file-cert ()
   (ignore-errors
@@ -213,15 +213,16 @@ Whether the passphrase is cached at all is controlled by
       (quit))
     result))
 
-(autoload 'gnus-completing-read-with-default "gnus-util")
+(autoload 'gnus-completing-read "gnus-util")
 
 (defun mml-smime-openssl-encrypt-query ()
   ;; todo: try dns/ldap automatically first, before prompting user
   (let (certs done)
     (while (not done)
-      (ecase (read (gnus-completing-read-with-default
-		    "ldap" "Fetch certificate from"
-		    '(("dns") ("ldap") ("file")) nil t))
+      (ecase (read (gnus-completing-read
+		    "Fetch certificate from"
+		    '(("dns") ("ldap") ("file")) t nil nil
+                    "ldap"))
 	(dns (setq certs (append certs
 				 (mml-smime-get-dns-cert))))
 	(ldap (setq certs (append certs
diff --git a/lisp/mml.el b/lisp/mml.el
index 15b1bb7..3cf0f37 100644
--- a/lisp/mml.el
+++ b/lisp/mml.el
@@ -40,6 +40,7 @@
 (autoload 'message-make-message-id "message")
 (declare-function gnus-setup-posting-charset "gnus-msg" (group))
 (autoload 'gnus-make-local-hook "gnus-util")
+(autoload 'gnus-completing-read "gnus-util")
 (autoload 'message-fetch-field "message")
 (autoload 'message-mark-active-p "message")
 (autoload 'message-info "message")
@@ -1188,9 +1189,10 @@ If not set, `default-directory' will be used."
 		      ;; looks like, and offer text/plain if it looks
 		      ;; like text/plain.
 		      "application/octet-stream"))
-	 (string (completing-read
-		  (format "Content type (default %s): " default)
-		  (mapcar 'list (mailcap-mime-types)))))
+	 (string (gnus-completing-read
+		  "Content type"
+		  (mailcap-mime-types)
+                  nil nil nil default)))
     (if (not (equal string ""))
 	string
       default)))
@@ -1204,10 +1206,10 @@ If not set, `default-directory' will be used."
 (defun mml-minibuffer-read-disposition (type &optional default filename)
   (unless default
     (setq default (mml-content-disposition type filename)))
-  (let ((disposition (completing-read
-		      (format "Disposition (default %s): " default)
-		      '(("attachment") ("inline") (""))
-		      nil t nil nil default)))
+  (let ((disposition (gnus-completing-read
+		      "Disposition"
+		      '("attachment" "inline")
+		      t nil nil default)))
     (if (not (equal disposition ""))
 	disposition
       default)))
@@ -1395,11 +1397,11 @@ TYPE is the MIME type to use."
 
 (defun mml-insert-multipart (&optional type)
   (interactive (if (message-in-body-p)
-		   (list (completing-read "Multipart type (default mixed): "
-					  '(("mixed") ("alternative")
-					    ("digest") ("parallel")
-					    ("signed") ("encrypted"))
-					  nil nil "mixed"))
+		   (list (gnus-completing-read "Multipart type"
+                                               '("mixed" "alternative"
+                                                 "digest" "parallel"
+                                                 "signed" "encrypted")
+                                               nil "mixed"))
 		 (error "Use this command in the message body")))
   (or type
       (setq type "mixed"))
diff --git a/lisp/nnir.el b/lisp/nnir.el
index db8b397..455a0fd 100644
--- a/lisp/nnir.el
+++ b/lisp/nnir.el
@@ -1588,7 +1588,7 @@ Tested with Namazu 2.0.6 on a GNU/Linux system."
   (let ((sym (car parmspec))
         (prompt (cdr parmspec)))
     (if (listp prompt)
-	(let* ((result (apply 'completing-read prompt))
+	(let* ((result (gnus-completing-read prompt nil))
 	       (mapping (or (assoc result nnir-imap-search-arguments)
 			    (assoc nil nnir-imap-search-arguments))))
 	  (cons sym (format (cdr mapping) result)))
diff --git a/lisp/nnmairix.el b/lisp/nnmairix.el
index bca549a..9672c04 100644
--- a/lisp/nnmairix.el
+++ b/lisp/nnmairix.el
@@ -848,8 +848,8 @@ called interactively, user will be asked for parameters."
 All necessary information will be queried from the user."
   (interactive)
   (let* ((name (read-string "Name of the mairix server: "))
-	(server (completing-read "Back end server (TAB for completion): "
-				 (nnmairix-get-valid-servers) nil 1))
+	(server (gnus-completing-read "Back end server"
+				 (nnmairix-get-valid-servers) t))
 	(mairix (read-string "Command to call mairix: " "mairix"))
 	(defaultgroup (read-string "Default search group: "))
 	(backend (symbol-name (car (gnus-server-to-method server))))
@@ -1165,7 +1165,7 @@ nnmairix server. Only marks from current session will be set."
 If SKIPDEFAULT is t, the default search group will not be
 updated.
 If UPDATEDB is t, database for SERVERNAME will be updated first."
-  (interactive (list (completing-read "Update groups on server: "
+  (interactive (list (gnus-completing-read "Update groups on server"
 				(nnmairix-get-nnmairix-servers))))
   (save-excursion
     (when (string-match ".*:\\(.*\\)" servername)
@@ -1302,7 +1302,7 @@ Otherwise, ask user for server."
 	  (while
 	      (equal '("")
 		  (setq nnmairix-last-server
-			(list (completing-read "Server: " openedserver nil 1
+			(list (gnus-completing-read "Server" openedserver t
 					       (or nnmairix-last-server
 						   "nnmairix:"))))))
 	  nnmairix-last-server)
@@ -1492,10 +1492,10 @@ group."
 	  (when (not found)
 	    (setq mairixserver
 		  (gnus-server-to-method
-		   (completing-read
-		    (format "Cannot determine which nnmairix server indexes %s. Please specify: "
+		   (gnus-completing-read
+		    (format "Cannot determine which nnmairix server indexes %s. Please specify"
 			    (gnus-method-to-server server))
-		    (nnmairix-get-nnmairix-servers) nil nil "nnmairix:")))
+		    (nnmairix-get-nnmairix-servers) nil "nnmairix:")))
 	    ;; Save result in parameter of default search group so that
 	    ;; we don't have to ask again
 	    (setq defaultgroup (gnus-group-prefixed-name
@@ -1643,9 +1643,9 @@ search in raw mode."
 	      (gnus-registry-add-group mid cur)))))
       (if (> (length allgroups) 1)
 	  (setq group
-		(completing-read
-		 "Message exists in more than one group. Choose: "
-		 allgroups nil t))
+		(gnus-completing-read
+		 "Message exists in more than one group. Choose"
+		 allgroups t))
 	(setq group (car allgroups))))
     (if group
 	;; show article in summary buffer
@@ -1748,9 +1748,9 @@ SERVER."
 	     (gnus-group-prefixed-name group (car cur))
 	     allgroups))))
       (if (> (length allgroups) 1)
-	  (setq group (completing-read
-		       "Group %s exists on more than one IMAP server. Choose: "
-		       allgroups nil t))
+	  (setq group (gnus-completing-read
+		       "Group %s exists on more than one IMAP server. Choose"
+		       allgroups t))
 	(setq group (car allgroups))))
     group))
 
diff --git a/lisp/nnrss.el b/lisp/nnrss.el
index 379fee2..8897b37 100644
--- a/lisp/nnrss.el
+++ b/lisp/nnrss.el
@@ -1058,9 +1058,9 @@ whether they are `offsite' or `onsite'."
 				    (cdr (assoc "feedid" listinfo)))))
 			   feedinfo)))
 	      (cdr (assoc
-		    (completing-read
-		     "Multiple feeds found.  Select one: "
-		     selection nil t) urllist)))))))))
+		    (gnus-completing-read
+		     "Multiple feeds found. Select one"
+		     selection t) urllist)))))))))
 
 (defun nnrss-rss-p (data)
   "Test if DATA is an RSS feed.
diff --git a/lisp/smime.el b/lisp/smime.el
index a266819..2492007 100644
--- a/lisp/smime.el
+++ b/lisp/smime.el
@@ -371,12 +371,9 @@ KEYFILE should contain a PEM encoded key and certificate."
 	     (if keyfile
 		 keyfile
 	       (smime-get-key-with-certs-by-email
-		(completing-read
-		 (concat "Sign using key"
-			 (if smime-keys
-			     (concat " (default " (caar smime-keys) "): ")
-			   ": "))
-		 smime-keys nil nil (car-safe (car-safe smime-keys))))))
+		(gnus-completing-read
+		 "Sign using key"
+		 smime-keys nil (car-safe (car-safe smime-keys))))))
       (error "Signing failed"))))
 
 (defun smime-encrypt-buffer (&optional certfiles buffer)
@@ -502,11 +499,9 @@ in the buffer specified by `smime-details-buffer'."
      (expand-file-name
       (or keyfile
 	  (smime-get-key-by-email
-	   (completing-read
-	    (concat "Decipher using key"
-		    (if smime-keys (concat " (default " (caar smime-keys) "): ")
-		      ": "))
-	    smime-keys nil nil (car-safe (car-safe smime-keys)))))))))
+	   (gnus-completing-read
+	    "Decipher using key"
+	    smime-keys nil (car-safe (car-safe smime-keys)))))))))
 
 ;; Various operations
 
@@ -660,6 +655,7 @@ A string or a list of strings is returned."
   (define-key smime-mode-map "f" 'smime-certificate-info))
 
 (autoload 'gnus-run-mode-hooks "gnus-util")
+(autoload 'gnus-completing-read "gnus-util")
 
 (defun smime-mode ()
   "Major mode for browsing, viewing and fetching certificates.
-- 
1.7.1




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-28 15:35 [PATCH] Introduce gnus-completing-read Julien Danjou
@ 2010-09-28 15:49 ` Eric Abrahamsen
  2010-09-28 15:55 ` Florian Ragwitz
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 48+ messages in thread
From: Eric Abrahamsen @ 2010-09-28 15:49 UTC (permalink / raw)
  To: ding

On Tue, Sep 28 2010, Julien Danjou wrote:

> Signed-off-by: Julien Danjou <julien@danjou.info>
> ---
>
> Hi there,
>
> As promised yesterday, here's my patch!
>
> It adds `gnus-completion-styles' which set `completion-styles' when calling
> `completing-read'.
>
> It adds `gnus-use-ido' which makes `gnus-completing-read' use
> `ido-completing-read' rather than `completing-read'
>
> It replaces (almost) all occurences of `completing-read' with
> `gnus-completing-read', so it works with ido too.

[...]

Brilliant, I've been waiting for this. Thanks a lot!




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-28 15:35 [PATCH] Introduce gnus-completing-read Julien Danjou
  2010-09-28 15:49 ` Eric Abrahamsen
@ 2010-09-28 15:55 ` Florian Ragwitz
  2010-09-28 16:04   ` Julien Danjou
  2010-09-28 15:55 ` Dan Christensen
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 48+ messages in thread
From: Florian Ragwitz @ 2010-09-28 15:55 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 2390 bytes --]

Julien Danjou <julien@danjou.info> writes:
> Hi there,
>
> As promised yesterday, here's my patch!
>
> It adds `gnus-completion-styles' which set `completion-styles' when calling
> `completing-read'.

I like your idea, and your patch. Thank you.

> It adds `gnus-use-ido' which makes `gnus-completing-read' use
> `ido-completing-read' rather than `completing-read'

I don't like that too much. How about something along the lines of

--8<---------------cut here---------------start------------->8---
(defun pod-completing-read (prompt choices)
  "Use `completing-read' to do a completing read."
  (completing-read prompt choices))

(defun pod-icompleting-read (prompt choices)
  "Use iswitchb to do a completing read."
  (let ((iswitchb-make-buflist-hook
         (lambda ()
           (setq iswitchb-temp-buflist choices))))
    (unwind-protect
        (progn
          (when (not iswitchb-mode)
            (add-hook 'minibuffer-setup-hook 'iswitchb-minibuffer-setup))
          (iswitchb-read-buffer prompt))
      (when (not iswitchb-mode)
        (remove-hook 'minibuffer-setup-hook 'iswitchb-minibuffer-setup)))))

(defun pod-ido-completing-read (prompt choices)
  "Use ido to do a completing read."
  (ido-completing-read prompt choices))

(defcustom pod-completing-read-function
  #'pod-icompleting-read
  "Ask the user to select a single item from a list.
Used by `pod-link-section', `pod-link-module', and
`pod-link-module-section'."
  :group 'pod-mode
  :type '(radio (function-item
                 :doc "Use Emacs' standard `completing-read' function."
                 pod-completing-read)
                (function-item :doc "Use iswitchb's completing-read function."
                               pod-icompleting-read)
                (function-item :doc "Use ido's completing-read function."
                               pod-ido-completing-read)
                (function)))

(defun pod-do-completing-read (&rest args)
  "Do a completing read with the configured `pod-completing-read-function'."
  (apply pod-completing-read-function args))
--8<---------------cut here---------------end--------------->8---

This is what I did a couple of months back for pod-mode.el. I believe it
makes for nicer customisation. If you like this as well, I'd be happy to
prepare an updated patch using the above, and extending it also support
REQUIRE-MATCH, INITIAL-INPUT, HISTORY, etc.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-28 15:35 [PATCH] Introduce gnus-completing-read Julien Danjou
  2010-09-28 15:49 ` Eric Abrahamsen
  2010-09-28 15:55 ` Florian Ragwitz
@ 2010-09-28 15:55 ` Dan Christensen
  2010-09-28 16:00   ` Julien Danjou
  2010-09-28 20:07 ` Ted Zlatanov
  2010-10-01 15:57 ` Matt Lundin
  4 siblings, 1 reply; 48+ messages in thread
From: Dan Christensen @ 2010-09-28 15:55 UTC (permalink / raw)
  To: ding

Julien Danjou <julien@danjou.info> writes:

> It adds `gnus-completion-styles' which set `completion-styles' when calling
> `completing-read'.

I haven't tried it, but noticed one minor thing:

> diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el
> index 4788deb..1cb3637 100644
> --- a/lisp/gnus-agent.el
> +++ b/lisp/gnus-agent.el
> @@ -459,10 +459,7 @@ manipulated as follows:
>    (let ((def (or (gnus-group-group-name) gnus-newsgroup-name)))
>      (when def
>        (setq def (gnus-group-decoded-name def)))
> -    (gnus-group-completing-read (if def
> -				    (concat "Group Name (" def "): ")
> -				  "Group Name: ")
> -				nil nil t nil nil def)))
> +    (gnus-group-completing-read nil t nil nil def)))

Should the new code have "Group Name" as the first argument?

I also like the way you check completion-styles-alist to see if
substring support is available.

Dan




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-28 15:55 ` Dan Christensen
@ 2010-09-28 16:00   ` Julien Danjou
  2010-09-28 16:02     ` Julien Danjou
  0 siblings, 1 reply; 48+ messages in thread
From: Julien Danjou @ 2010-09-28 16:00 UTC (permalink / raw)
  To: Dan Christensen; +Cc: ding

[-- Attachment #1: Type: text/plain, Size: 881 bytes --]

On Tue, Sep 28 2010, Dan Christensen wrote:

>> diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el
>> index 4788deb..1cb3637 100644
>> --- a/lisp/gnus-agent.el
>> +++ b/lisp/gnus-agent.el
>> @@ -459,10 +459,7 @@ manipulated as follows:
>>    (let ((def (or (gnus-group-group-name) gnus-newsgroup-name)))
>>      (when def
>>        (setq def (gnus-group-decoded-name def)))
>> -    (gnus-group-completing-read (if def
>> -				    (concat "Group Name (" def "): ")
>> -				  "Group Name: ")
>> -				nil nil t nil nil def)))
>> +    (gnus-group-completing-read nil t nil nil def)))
>
> Should the new code have "Group Name" as the first argument?

Good catch, thanks!

That gave me the idea to make the prompt optional, since usually it's
just "Group". Patch following this mail.

-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] Introduce gnus-completing-read
  2010-09-28 16:00   ` Julien Danjou
@ 2010-09-28 16:02     ` Julien Danjou
  0 siblings, 0 replies; 48+ messages in thread
From: Julien Danjou @ 2010-09-28 16:02 UTC (permalink / raw)
  To: ding; +Cc: Julien Danjou

Signed-off-by: Julien Danjou <julien@danjou.info>
---
 lisp/ChangeLog        |   76 +++++++++++++++++++++++++++++++++++
 lisp/gnus-agent.el    |   11 ++---
 lisp/gnus-art.el      |   17 ++++----
 lisp/gnus-bookmark.el |    4 +-
 lisp/gnus-diary.el    |    8 ++--
 lisp/gnus-dired.el    |    8 +---
 lisp/gnus-group.el    |  104 ++++++++++++++++++++++--------------------------
 lisp/gnus-int.el      |    9 ++--
 lisp/gnus-msg.el      |   26 ++++++------
 lisp/gnus-registry.el |   11 ++---
 lisp/gnus-score.el    |   27 +++++++------
 lisp/gnus-srvr.el     |    7 ++-
 lisp/gnus-sum.el      |   75 ++++++++++++++---------------------
 lisp/gnus-topic.el    |   24 ++++++-----
 lisp/gnus-util.el     |   57 +++++++++++++++------------
 lisp/gnus.el          |    6 +-
 lisp/mm-decode.el     |    4 +-
 lisp/mm-util.el       |   14 +++---
 lisp/mm-view.el       |    9 ++--
 lisp/mml-smime.el     |   17 ++++----
 lisp/mml.el           |   26 +++++++------
 lisp/nnir.el          |    2 +-
 lisp/nnmairix.el      |   26 ++++++------
 lisp/nnrss.el         |    6 +-
 lisp/smime.el         |   18 +++-----
 25 files changed, 324 insertions(+), 268 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bb8269a..d5546f9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -17,6 +17,82 @@
 	* gnus-gravatar.el (gnus-gravatar-insert): Search backward for
 	real-name, and then for mail address rather than doing : or , search.
 
+2010-09-27  Julien Danjou  <julien@danjou.info>
+
+	* gnus-srvr.el (gnus-server-add-server): Use gnus-completing-read.
+	(gnus-server-goto-server): Use gnus-completing-read.
+
+	* mm-view.el (mm-view-pkcs7-decrypt): Use gnus-completing-read.
+
+	* mm-util.el (defalias): Use gnus-completing-read.
+	(mm-codepage-setup): Use gnus-completing-read.
+
+	* smime.el (smime-sign-buffer): Use gnus-completing-read.
+	(smime-decrypt-buffer): Use gnus-completing-read.
+
+	* mml-smime.el (mml-smime-openssl-sign-query): Use gnus-completing-read.
+
+	* mml.el (mml-minibuffer-read-type): Use gnus-completing-read.
+	(mml-minibuffer-read-disposition): Use gnus-completing-read.
+	(mml-insert-multipart): Use gnus-completing-read.
+
+	* gnus-msg.el (gnus-summary-yank-message): Use gnus-completing-read.
+
+	* gnus-int.el (gnus-start-news-server): Use gnus-completing-read.
+
+	* mm-decode.el (mm-interactively-view-part): Use gnus-completing-read.
+
+	* gnus-dired.el (gnus-dired-attach): Use gnus-completing-read.
+
+	* gnus.el (gnus-read-method): Use gnus-completing-read.
+
+	* gnus-bookmark.el (gnus-bookmark-jump): Use gnus-completing-read.
+
+	* gnus-art.el (gnus-mime-view-part-as-type): Use gnus-completing-read.
+	(gnus-mime-action-on-part): Use gnus-completing-read.
+	(gnus-article-encrypt-body): Use gnus-completing-read.
+
+	* gnus-topic.el (gnus-topic-jump-to-topic): Use gnus-completing-read.
+	(gnus-topic-move-matching): Use gnus-completing-read.
+	(gnus-topic-copy-matching): Use gnus-completing-read.
+	(gnus-topic-sort-topics): Use gnus-completing-read.
+	(gnus-topic-move): Use gnus-completing-read.
+
+	* gnus-agent.el (gnus-agent-read-group): Remove prompt computing.
+	(gnus-agent-add-group): Use gnus-completing-read.
+
+	* nnmairix.el (nnmairix-create-server-and-default-group): Use
+	gnus-completing-read.
+	(nnmairix-update-groups): Use gnus-completing-read.
+	(nnmairix-get-server): Use gnus-completing-read.
+	(nnmairix-backend-to-server): Use gnus-completing-read.
+	(nnmairix-goto-original-article): Use gnus-completing-read.
+	(nnmairix-get-group-from-file-path): Use gnus-completing-read.
+
+	* nnrss.el (nnrss-find-rss-via-syndic8): Use gnus-completing-read.
+
+	* gnus-group.el (gnus-group-completing-read): Use gnus-completing-read.
+	(gnus-group-make-useful-group): Use gnus-completing-read.
+	(gnus-group-make-web-group): Use gnus-completing-read.
+	(gnus-group-add-to-virtual): Use gnus-completing-read.
+	(gnus-group-browse-foreign-server): Use gnus-completing-read.
+
+	* gnus-sum.el (gnus-summary-goto-article): Use gnus-completing-read.
+	(gnus-summary-limit-to-extra): Use gnus-completing-read.
+	(gnus-summary-execute-command): Use gnus-completing-read.
+	(gnus-summary-respool-article): Use gnus-completing-read.
+	(gnus-read-move-group-name): Use gnus-completing-read.
+
+	* gnus-score.el (gnus-summary-increase-score): Use gnus-completing-read.
+	(gnus-summary-score-effect): Use gnus-completing-read.
+
+	* gnus-registry.el (gnus-registry-read-mark): Use gnus-completing-read.
+
+	* gnus-util.el (gnus-completing-read): Use gnus-use-ido to apply the
+	right completing-read function.
+	(gnus-use-ido): New variable
+	(gnus-completing-read-with-default): Remove.
+
 2010-09-28  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* lpath.el: Remove url-http-file-exists-p, w32-focus-frame, and
diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el
index 4788deb..8043620 100644
--- a/lisp/gnus-agent.el
+++ b/lisp/gnus-agent.el
@@ -459,10 +459,7 @@ manipulated as follows:
   (let ((def (or (gnus-group-group-name) gnus-newsgroup-name)))
     (when def
       (setq def (gnus-group-decoded-name def)))
-    (gnus-group-completing-read (if def
-				    (concat "Group Name (" def "): ")
-				  "Group Name: ")
-				nil nil t nil nil def)))
+    (gnus-group-completing-read nil nil t nil nil def)))
 
 ;;; Fetching setup functions.
 
@@ -816,9 +813,9 @@ be a select method."
   (interactive
    (list
     (intern
-     (completing-read
-      "Add to category: "
-      (mapcar (lambda (cat) (list (symbol-name (car cat))))
+     (gnus-completing-read
+      "Add to category"
+      (mapcar (lambda (cat) (symbol-name (car cat)))
 	      gnus-category-alist)
       nil t))
     current-prefix-arg))
diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el
index 6e5cd4d..4e2d43c 100644
--- a/lisp/gnus-art.el
+++ b/lisp/gnus-art.el
@@ -5131,11 +5131,10 @@ available media-types."
   (unless mime-type
     (setq mime-type
 	  (let ((default (gnus-mime-view-part-as-type-internal)))
-	    (completing-read
-	     (format "View as MIME type (default %s): "
-		     (car default))
-	     (mapcar #'list (mailcap-mime-types))
-	     pred nil nil nil
+	    (gnus-completing-read
+	     "View as MIME type"
+	     (remove-if-not pred (mailcap-mime-types))
+	     nil nil nil
 	     (car default)))))
   (gnus-article-check-buffer)
   (let ((handle (get-text-property (point) 'gnus-data)))
@@ -5404,7 +5403,7 @@ If no internal viewer is available, use an external viewer."
 (defun gnus-mime-action-on-part (&optional action)
   "Do something with the MIME attachment at \(point\)."
   (interactive
-   (list (completing-read "Action: " gnus-mime-action-alist nil t)))
+   (list (gnus-completing-read "Action" (mapcar 'car gnus-mime-action-alist) t)))
   (gnus-article-check-buffer)
   (let ((action-pair (assoc action gnus-mime-action-alist)))
     (if action-pair
@@ -8370,9 +8369,9 @@ For example:
   (interactive
    (list
     (or gnus-article-encrypt-protocol
-	(completing-read "Encrypt protocol: "
-			 gnus-article-encrypt-protocol-alist
-			 nil t))
+	(gnus-completing-read "Encrypt protocol"
+                              (mapcar 'car gnus-article-encrypt-protocol-alist)
+                              t))
     current-prefix-arg))
   ;; User might hit `K E' instead of `K e', so prompt once.
   (when (and gnus-article-encrypt-protocol
diff --git a/lisp/gnus-bookmark.el b/lisp/gnus-bookmark.el
index 137479b..4237508 100644
--- a/lisp/gnus-bookmark.el
+++ b/lisp/gnus-bookmark.el
@@ -289,8 +289,8 @@ So the cdr of each bookmark is an alist too.")
   (interactive)
   (gnus-bookmark-maybe-load-default-file)
   (let* ((bookmark (or bmk-name
-	  (completing-read "Jump to bookmarked article: "
-			   gnus-bookmark-alist)))
+                       (gnus-completing-read "Jump to bookmarked article"
+                                             (mapcar 'car gnus-bookmark-alist))))
 	 (bmk-record (cadr (assoc bookmark gnus-bookmark-alist)))
 	 (group (cdr (assoc 'group bmk-record)))
 	 (message-id (cdr (assoc 'message-id bmk-record))))
diff --git a/lisp/gnus-diary.el b/lisp/gnus-diary.el
index 18130bb..76d469b 100644
--- a/lisp/gnus-diary.el
+++ b/lisp/gnus-diary.el
@@ -368,11 +368,11 @@ If ARG (or prefix) is non-nil, force prompting for all fields."
 				 header ": ")))
 	     (setq value
 		   (if (listp (nth 1 head))
-		       (completing-read prompt (cons '("*" nil) (nth 1 head))
-					nil t value
-					gnus-diary-header-value-history)
+		       (gnus-completing-read prompt (cons '("*" nil) (nth 1 head))
+                                             t value
+                                             'gnus-diary-header-value-history)
 		     (read-string prompt value
-				  gnus-diary-header-value-history))))
+				  'gnus-diary-header-value-history))))
 	   (setq ask nil)
 	   (setq invalid nil)
 	   (condition-case ()
diff --git a/lisp/gnus-dired.el b/lisp/gnus-dired.el
index f9502b4..da20c66 100644
--- a/lisp/gnus-dired.el
+++ b/lisp/gnus-dired.el
@@ -152,12 +152,8 @@ filenames."
 	  (setq destination
 		(if (= (length bufs) 1)
 		    (get-buffer (car bufs))
-		  (completing-read "Attach to which mail composition buffer: "
-				   (mapcar
-				    (lambda (b)
-				      (cons b (get-buffer b)))
-				    bufs)
-				   nil t)))
+		  (gnus-completing-read "Attach to which mail composition buffer"
+                                         bufs t)))
 	;; setup a new mail composition buffer
 	(let ((mail-user-agent gnus-dired-mail-mode)
 	      ;; A workaround to prevent Gnus from displaying the Gnus
diff --git a/lisp/gnus-group.el b/lisp/gnus-group.el
index 7dddb9b..eb594f3 100644
--- a/lisp/gnus-group.el
+++ b/lisp/gnus-group.el
@@ -2164,44 +2164,35 @@ be permanent."
 		group)))
 	(goto-char start)))))
 
-(defun gnus-group-completing-read (prompt &optional collection predicate
-					  require-match initial-input hist def
-					  &rest args)
+(defun gnus-group-completing-read (&optional prompt collection
+                                             require-match initial-input hist def)
   "Read a group name with completion.  Non-ASCII group names are allowed.
 The arguments are the same as `completing-read' except that COLLECTION
 and HIST default to `gnus-active-hashtb' and `gnus-group-history'
 respectively if they are omitted."
-  (let ((completion-styles (and (boundp 'completion-styles)
-				completion-styles))
-	group)
-    (push 'substring completion-styles)
-    (mapatoms (lambda (symbol)
-		(setq group (symbol-name symbol))
-		(set (intern (if (string-match "[^\000-\177]" group)
-				 (gnus-group-decoded-name group)
-			       group)
-			     collection)
-		     group))
-	      (prog1
-		  (or collection
-		      (setq collection (or gnus-active-hashtb [0])))
-		(setq collection (gnus-make-hashtable (length collection)))))
-    (setq group (apply 'completing-read prompt collection predicate
-		       require-match initial-input
-		       (or hist 'gnus-group-history)
-		       def args))
-    (or (prog1
-	    (symbol-value (intern-soft group collection))
-	  (setq collection nil))
-	(mm-encode-coding-string group (gnus-group-name-charset nil group)))))
+  (let* ((choices (mapcar (lambda (symbol)
+                            (let ((group (symbol-name symbol)))
+                              (if (string-match "[^\000-\177]" group)
+                                  (gnus-group-decoded-name group)
+                                group)))
+                          (remove-if-not
+                           'symbolp
+                           (or collection (or gnus-active-hashtb [0])))))
+         (group
+          (gnus-completing-read (or prompt "Group") choices
+                                require-match initial-input
+                                (or hist 'gnus-group-history)
+                                def)))
+    (or (symbol-value (intern-soft group collection))
+        (mm-encode-coding-string group (gnus-group-name-charset nil group)))))
 
 ;;;###autoload
 (defun gnus-fetch-group (group &optional articles)
   "Start Gnus if necessary and enter GROUP.
 If ARTICLES, display those articles.
 Returns whether the fetching was successful or not."
-  (interactive (list (gnus-group-completing-read "Group name: "
-						 nil nil nil
+  (interactive (list (gnus-group-completing-read nil
+						 nil nil
 						 (gnus-group-name-at-point))))
   (unless (gnus-alive-p)
     (gnus-no-server))
@@ -2261,7 +2252,7 @@ Return the name of the group if selection was successful."
   (interactive
    (list
     ;; (gnus-read-group "Group name: ")
-    (gnus-group-completing-read "Group: ")
+    (gnus-group-completing-read)
     (gnus-read-method "From method: ")))
   ;; Transform the select method into a unique server.
   (when (stringp method)
@@ -2328,7 +2319,7 @@ specified by `gnus-gmane-group-download-format'."
   ;; See <http://gmane.org/export.php> for more information.
   (interactive
    (list
-    (gnus-group-completing-read "Gmane group: ")
+    (gnus-group-completing-read "Gmane group")
     (read-number "Start article number: ")
     (read-number "How many articles: ")))
   (unless range (setq range 500))
@@ -2362,7 +2353,7 @@ Valid input formats include:
   ;;   prompt the user to decide: "View via `browse-url' or in Gnus? "
   ;;   (`gnus-read-ephemeral-gmane-group-url')
   (interactive
-   (list (gnus-group-completing-read "Gmane URL: ")))
+   (list (gnus-group-completing-read "Gmane URL")))
   (let (group start range)
     (cond
      ;; URLs providing `group', `start' and `range':
@@ -2456,13 +2447,13 @@ If PROMPT (the prefix) is a number, use the prompt specified in
 `gnus-group-jump-to-group-prompt'."
   (interactive
    (list (gnus-group-completing-read
-	  "Group: " nil nil (gnus-read-active-file-p)
-	  (if current-prefix-arg
-	      (cdr (assq current-prefix-arg gnus-group-jump-to-group-prompt))
-	    (or (and (stringp gnus-group-jump-to-group-prompt)
-		     gnus-group-jump-to-group-prompt)
-		(let ((p (cdr (assq 0 gnus-group-jump-to-group-prompt))))
-		  (and (stringp p) p)))))))
+          nil nil (gnus-read-active-file-p)
+          (if current-prefix-arg
+              (cdr (assq current-prefix-arg gnus-group-jump-to-group-prompt))
+            (or (and (stringp gnus-group-jump-to-group-prompt)
+                     gnus-group-jump-to-group-prompt)
+                (let ((p (cdr (assq 0 gnus-group-jump-to-group-prompt))))
+                  (and (stringp p) p)))))))
 
   (when (equal group "")
     (error "Empty group name"))
@@ -2653,7 +2644,7 @@ If EXCLUDE-GROUP, do not go to that group."
 (defun gnus-group-make-group-simple (&optional group)
   "Add a new newsgroup.
 The user will be prompted for GROUP."
-  (interactive (list (gnus-group-completing-read "Group: ")))
+  (interactive (list (gnus-group-completing-read)))
   (gnus-group-make-group (gnus-group-real-name group)
 			 (gnus-group-server group)
 			 nil nil t))
@@ -2912,8 +2903,9 @@ and NEW-NAME will be prompted for."
 (defun gnus-group-make-useful-group (group method)
   "Create one of the groups described in `gnus-useful-groups'."
   (interactive
-   (let ((entry (assoc (completing-read "Create group: " gnus-useful-groups
-					nil t)
+   (let ((entry (assoc (gnus-completing-read "Create group"
+                                             (mapcar 'car gnus-useful-groups)
+                                             t)
 		       gnus-useful-groups)))
      (list (cadr entry)
 	   ;; Don't use `caddr' here since macros within the `interactive'
@@ -3005,11 +2997,11 @@ If SOLID (the prefix), create a solid group."
 			   (symbol-name (caar nnweb-type-definition))))
 	 (type
 	  (gnus-string-or
-	   (completing-read
-	    (format "Search engine type (default %s): " default-type)
-	    (mapcar (lambda (elem) (list (symbol-name (car elem))))
+	   (gnus-completing-read
+	    "Search engine type"
+	    (mapcar (lambda (elem) (symbol-name (car elem)))
 		    nnweb-type-definition)
-	    nil t nil 'gnus-group-web-type-history)
+	    t nil 'gnus-group-web-type-history)
 	   default-type))
 	 (search
 	  (read-string
@@ -3100,8 +3092,8 @@ mail messages or news articles in files that have numeric names."
   "Add the current group to a virtual group."
   (interactive
    (list current-prefix-arg
-	 (completing-read "Add to virtual group: " gnus-newsrc-hashtb nil t
-			  "nnvirtual:")))
+	 (gnus-group-completing-read "Add to virtual group"
+                                     nil t "nnvirtual:")))
   (unless (eq (car (gnus-find-method-for-group vgroup)) 'nnvirtual)
     (error "%s is not an nnvirtual group" vgroup))
   (gnus-close-group vgroup)
@@ -3672,7 +3664,7 @@ If given numerical prefix, toggle the N next groups."
 Killed newsgroups are subscribed.  If SILENT, don't try to update the
 group line."
   (interactive (list (gnus-group-completing-read
-		      "Group: " nil nil (gnus-read-active-file-p))))
+		      nil (gnus-read-active-file-p))))
   (let ((newsrc (gnus-group-entry group)))
     (cond
      ((string-match "^[ \t]*$" group)
@@ -4013,7 +4005,7 @@ If DONT-SCAN is non-nil, scan non-activated groups as well."
 If given a prefix argument, prompt for a group."
   (interactive
    (list (or (when current-prefix-arg
-	       (gnus-group-completing-read "Group: "))
+	       (gnus-group-completing-read))
 	     (gnus-group-group-name)
 	     gnus-newsgroup-name)))
   (unless group
@@ -4314,18 +4306,18 @@ If called interactively, this function will ask for a select method
 If not, METHOD should be a list where the first element is the method
 and the second element is the address."
   (interactive
-   (list (let ((how (completing-read
-		     "Which back end: "
-		     (append gnus-valid-select-methods gnus-server-alist)
-		     nil t (cons "nntp" 0) 'gnus-method-history)))
+   (list (let ((how (gnus-completing-read
+		     "Which back end"
+		     (mapcar 'car (append gnus-valid-select-methods gnus-server-alist))
+		     t (cons "nntp" 0) 'gnus-method-history)))
 	   ;; We either got a back end name or a virtual server name.
 	   ;; If the first, we also need an address.
 	   (if (assoc how gnus-valid-select-methods)
 	       (list (intern how)
 		     ;; Suggested by mapjph@bath.ac.uk.
-		     (completing-read
-		      "Address: "
-		      (mapcar 'list gnus-secondary-servers)))
+		     (gnus-completing-read
+		      "Address"
+		      gnus-secondary-servers))
 	     ;; We got a server name.
 	     how))))
   (gnus-browse-foreign-server method))
diff --git a/lisp/gnus-int.el b/lisp/gnus-int.el
index 3245b16..33d020f 100644
--- a/lisp/gnus-int.el
+++ b/lisp/gnus-int.el
@@ -94,11 +94,10 @@ If CONFIRM is non-nil, the user will be asked for an NNTP server."
       (when confirm
 	;; Read server name with completion.
 	(setq gnus-nntp-server
-	      (completing-read "NNTP server: "
-			       (mapcar 'list
-				       (cons (list gnus-nntp-server)
-					     gnus-secondary-servers))
-			       nil nil gnus-nntp-server)))
+	      (gnus-completing-read "NNTP server"
+                                    (cons gnus-nntp-server
+                                          gnus-secondary-servers)
+                                    nil gnus-nntp-server)))
 
       (when (and gnus-nntp-server
 		 (stringp gnus-nntp-server)
diff --git a/lisp/gnus-msg.el b/lisp/gnus-msg.el
index a2a2652..a3794f2 100644
--- a/lisp/gnus-msg.el
+++ b/lisp/gnus-msg.el
@@ -578,8 +578,8 @@ If ARG is 1, prompt for a group name to find the posting style."
 		(if arg
 		    (if (= 1 (prefix-numeric-value arg))
 			(gnus-group-completing-read
-			 "Use posting style of group: "
-			 nil nil (gnus-read-active-file-p))
+			 "Use posting style of group"
+			 nil (gnus-read-active-file-p))
 		      (gnus-group-group-name))
 		  ""))
 	  ;; #### see comment in gnus-setup-message -- drv
@@ -607,8 +607,8 @@ network.  The corresponding back end must have a 'request-post method."
 	  (setq gnus-newsgroup-name
 		(if arg
 		    (if (= 1 (prefix-numeric-value arg))
-			(gnus-group-completing-read "Use group: "
-						    nil nil
+			(gnus-group-completing-read "Use group"
+						    nil
 						    (gnus-read-active-file-p))
 		      (gnus-group-group-name))
 		  ""))
@@ -628,7 +628,7 @@ a news."
   (let ((gnus-newsgroup-name
 	 (if arg
 	     (if (= 1 (prefix-numeric-value arg))
-		 (gnus-group-completing-read "Newsgroup: " nil nil
+		 (gnus-group-completing-read "Newsgroup" nil
 					     (gnus-read-active-file-p))
 	       (gnus-group-group-name))
 	   ""))
@@ -654,8 +654,8 @@ posting style."
 	  (setq gnus-newsgroup-name
 		(if arg
 		    (if (= 1 (prefix-numeric-value arg))
-			(gnus-group-completing-read "Use group: "
-						    nil nil
+			(gnus-group-completing-read "Use group"
+						    nil
 						    (gnus-read-active-file-p))
 		      "")
 		  gnus-newsgroup-name))
@@ -684,8 +684,8 @@ network.  The corresponding back end must have a 'request-post method."
 	  (setq gnus-newsgroup-name
 		(if arg
 		    (if (= 1 (prefix-numeric-value arg))
-			(gnus-group-completing-read "Use group: "
-						    nil nil
+			(gnus-group-completing-read "Use group"
+						    nil
 						    (gnus-read-active-file-p))
 		      "")
 		  gnus-newsgroup-name))
@@ -710,7 +710,7 @@ a news."
   (let ((gnus-newsgroup-name
 	 (if arg
 	     (if (= 1 (prefix-numeric-value arg))
-		 (gnus-group-completing-read "Newsgroup: " nil nil
+		 (gnus-group-completing-read "Newsgroup" nil
 					     (gnus-read-active-file-p))
 	       "")
 	   gnus-newsgroup-name))
@@ -1028,8 +1028,8 @@ If SILENT, don't prompt the user."
 			 gnus-last-posting-server)
 		    ;; Just use the last value.
 		    gnus-last-posting-server
-		  (completing-read
-		   "Posting method: " method-alist nil t
+		  (gnus-completing-read
+		   "Posting method" (mapcar 'car method-alist) t
 		   (cons (or gnus-last-posting-server "") 0))))
 	  method-alist))))
      ;; Override normal method.
@@ -1487,7 +1487,7 @@ If YANK is non-nil, include the original article."
 (defun gnus-summary-yank-message (buffer n)
   "Yank the current article into a composed message."
   (interactive
-   (list (completing-read "Buffer: " (mapcar 'list (message-buffers)) nil t)
+   (list (gnus-completing-read "Buffer" (message-buffers) t)
 	 current-prefix-arg))
   (gnus-summary-iterate n
     (let ((gnus-inhibit-treatment t))
diff --git a/lisp/gnus-registry.el b/lisp/gnus-registry.el
index a30847b..984890a 100644
--- a/lisp/gnus-registry.el
+++ b/lisp/gnus-registry.el
@@ -857,12 +857,11 @@ Uses `gnus-registry-marks' to find what shortcuts to install."
 
 (defun gnus-registry-read-mark ()
   "Read a mark name from the user with completion."
-  (let ((mark (gnus-completing-read-with-default
-	       (symbol-name gnus-registry-default-mark)
-	       "Label"
-	       (mapcar (lambda (x)	; completion list
-			 (cons (symbol-name (car-safe x)) (car-safe x)))
-		       gnus-registry-marks))))
+  (let ((mark (gnus-completing-read
+               "Label"
+               (mapcar 'symbol-name (mapcar 'car gnus-registry-marks))
+               nil nil nil
+	       (symbol-name gnus-registry-default-mark))))
     (when (stringp mark)
       (intern mark))))
 
diff --git a/lisp/gnus-score.el b/lisp/gnus-score.el
index 03ff30d..26c3ca3 100644
--- a/lisp/gnus-score.el
+++ b/lisp/gnus-score.el
@@ -680,14 +680,14 @@ file for the command instead of the current score file."
 	  (and gnus-extra-headers
 	       (equal (nth 1 entry) "extra")
 	       (intern			; need symbol
-		(gnus-completing-read-with-default
-		 (symbol-name (car gnus-extra-headers))	; default response
-		 "Score extra header"	; prompt
-		 (mapcar (lambda (x)	; completion list
-			   (cons (symbol-name x) x))
-			 gnus-extra-headers)
-		 nil			; no completion limit
-		 t))))			; require match
+                (let ((collection (mapcar 'symbol-name gnus-extra-headers)))
+                  (gnus-completing-read
+                   "Score extra header"  ; prompt
+                   collection            ; completion list
+                   t                     ; require match
+                   nil                   ; no history
+                   nil                   ; no initial-input
+                   (car collection)))))) ; default value
     ;; extra is now nil or a symbol.
 
     ;; We have all the data, so we enter this score.
@@ -913,10 +913,13 @@ MATCH is the string we are looking for.
 TYPE is the score type.
 SCORE is the score to add.
 EXTRA is the possible non-standard header."
-  (interactive (list (completing-read "Header: "
-				      gnus-header-index
-				      (lambda (x) (fboundp (nth 2 x)))
-				      t)
+  (interactive (list (gnus-completing-read "Header"
+                                           (mapcar
+                                            'car
+                                            (remove-if-not
+                                             (lambda (x) (fboundp (nth 2 x)))
+                                             gnus-header-index))
+                                           t)
 		     (read-string "Match: ")
 		     (if (y-or-n-p "Use regexp match? ") 'r 's)
 		     (string-to-number (read-string "Score: "))))
diff --git a/lisp/gnus-srvr.el b/lisp/gnus-srvr.el
index 11164a8..2b13f39 100644
--- a/lisp/gnus-srvr.el
+++ b/lisp/gnus-srvr.el
@@ -571,8 +571,9 @@ The following commands are available:
 
 (defun gnus-server-add-server (how where)
   (interactive
-   (list (intern (completing-read "Server method: "
-				  gnus-valid-select-methods nil t))
+   (list (intern (gnus-completing-read "Server method"
+                                       (mapcar 'car gnus-valid-select-methods)
+                                       t))
 	 (read-string "Server name: ")))
   (when (assq where gnus-server-alist)
     (error "Server with that name already defined"))
@@ -582,7 +583,7 @@ The following commands are available:
 (defun gnus-server-goto-server (server)
   "Jump to a server line."
   (interactive
-   (list (completing-read "Goto server: " gnus-server-alist nil t)))
+   (list (gnus-completing-read "Goto server" (mapcar 'car gnus-server-alist) t)))
   (let ((to (text-property-any (point-min) (point-max)
 			       'gnus-server (intern server))))
     (when to
diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el
index b8b17b3..59b9682 100644
--- a/lisp/gnus-sum.el
+++ b/lisp/gnus-sum.el
@@ -7999,10 +7999,9 @@ If FORCE, go to the article even if it isn't displayed.  If FORCE
 is a number, it is the line the article is to be displayed on."
   (interactive
    (list
-    (completing-read
-     "Article number or Message-ID: "
-     (mapcar (lambda (number) (list (int-to-string number)))
-	     gnus-newsgroup-limit))
+    (gnus-completing-read
+     "Article number or Message-ID"
+     (mapcar 'int-to-string gnus-newsgroup-limit))
     current-prefix-arg
     t))
   (prog1
@@ -8256,16 +8255,13 @@ articles that are younger than AGE days."
   (interactive
    (let ((header
 	  (intern
-	   (gnus-completing-read-with-default
-	    (symbol-name (car gnus-extra-headers))
+	   (gnus-completing-read
 	    (if current-prefix-arg
 		"Exclude extra header"
 	      "Limit extra header")
-	    (mapcar (lambda (x)
-		      (cons (symbol-name x) x))
-		    gnus-extra-headers)
-	    nil
-	    t))))
+	    (mapcar 'symbol-name gnus-extra-headers)
+	    t nil nil
+            (symbol-name (car gnus-extra-headers))))))
      (list header
 	   (read-string (format "%s header %s (regexp): "
 				(if current-prefix-arg "Exclude" "Limit to")
@@ -9234,14 +9230,14 @@ If HEADER is an empty string (or nil), the match is done on the entire
 article.  If BACKWARD (the prefix) is non-nil, search backward instead."
   (interactive
    (list (let ((completion-ignore-case t))
-	   (completing-read
-	    "Header name: "
-	    (mapcar (lambda (header) (list (format "%s" header)))
+	   (gnus-completing-read
+	    "Header name"
+	    (mapcar 'symbol-name
 		    (append
-		     '("Number" "Subject" "From" "Lines" "Date"
-		       "Message-ID" "Xref" "References" "Body")
+		     '(Number Subject From Lines Date
+		       Message-ID Xref References Body)
 		     gnus-extra-headers))
-	    nil 'require-match))
+	    'require-match))
 	 (read-string "Regexp: ")
 	 (read-key-sequence "Command: ")
 	 current-prefix-arg))
@@ -9937,9 +9933,9 @@ latter case, they will be copied into the relevant groups."
 				  (car (gnus-find-method-for-group
 					gnus-newsgroup-name)))))
 		(method
-		 (gnus-completing-read-with-default
-		  methname "Backend to use when respooling"
-		  methods nil t nil 'gnus-mail-method-history))
+		 (gnus-completing-read
+		  "Backend to use when respooling"
+		  methods t nil 'gnus-mail-method-history methname))
 		ms)
 	   (cond
 	    ((zerop (length (setq ms (gnus-servers-using-backend
@@ -9949,7 +9945,7 @@ latter case, they will be copied into the relevant groups."
 	     (car ms))
 	    (t
 	     (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
-	       (cdr (assoc (completing-read "Server name: " ms-alist nil t)
+	       (cdr (assoc (gnus-completing-read "Server name" ms-alist t)
 			   ms-alist))))))))
   (unless method
     (error "No method given for respooling"))
@@ -11921,29 +11917,20 @@ save those articles instead."
 		      (format "these %d articles" (length articles))
 		    "this article")))
 	 (to-newsgroup
-	  (let (active group)
-	    (when (or (null split-name) (= 1 (length split-name)))
-	      (setq active (gnus-make-hashtable (length gnus-active-hashtb)))
-	      (mapatoms (lambda (symbol)
-			  (setq group (symbol-name symbol))
-			  (when (string-match "[^\000-\177]" group)
-			    (setq group (gnus-group-decoded-name group)))
-			  (set (intern group active) group))
-			gnus-active-hashtb))
-	    (cond
-	     ((null split-name)
-	      (gnus-completing-read-with-default
-	       default prom active 'gnus-valid-move-group-p nil prefix
-	       'gnus-group-history))
-	     ((= 1 (length split-name))
-	      (gnus-completing-read-with-default
-	       (car split-name) prom active 'gnus-valid-move-group-p nil nil
-	       'gnus-group-history))
-	     (t
-	      (gnus-completing-read-with-default
-	       nil prom (mapcar 'list (nreverse split-name)) nil nil nil
-	       'gnus-group-history)))))
-	 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
+          (cond
+           ((null split-name)
+            (gnus-group-completing-read
+             prom
+             (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb)
+             nil prefix nil default))
+           ((= 1 (length split-name))
+            (gnus-group-completing-read
+             prom (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb)
+             nil prefix 'gnus-group-history (car split-name)))
+           (t
+            (gnus-completing-read
+             prom (nreverse split-name) nil nil 'gnus-group-history))))
+         (to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
 	 encoded)
     (when to-newsgroup
       (if (or (string= to-newsgroup "")
diff --git a/lisp/gnus-topic.el b/lisp/gnus-topic.el
index 7c71035..b600fac 100644
--- a/lisp/gnus-topic.el
+++ b/lisp/gnus-topic.el
@@ -161,9 +161,7 @@ See Info node `(gnus)Formatting Variables'."
 (defun gnus-topic-jump-to-topic (topic)
   "Go to TOPIC."
   (interactive
-   (list (completing-read "Go to topic: "
-			  (mapcar 'list (gnus-topic-list))
-			  nil t)))
+   (list (gnus-completing-read "Go to topic" (gnus-topic-list) t)))
   (let ((buffer-read-only nil))
     (dolist (topic (gnus-current-topics topic))
       (unless (gnus-topic-goto-topic topic)
@@ -1303,7 +1301,7 @@ When used interactively, PARENT will be the topic under point."
 If COPYP, copy the groups instead."
   (interactive
    (list current-prefix-arg
-	 (gnus-completing-read "Move to topic" gnus-topic-alist nil t
+	 (gnus-completing-read "Move to topic" (mapcar 'car gnus-topic-alist) t
 			       'gnus-topic-history)))
   (let ((use-marked (and (not n) (not (gnus-region-active-p))
 			 gnus-group-marked t))
@@ -1350,7 +1348,7 @@ If COPYP, copy the groups instead."
   "Copy the current group to a topic."
   (interactive
    (list current-prefix-arg
-	 (completing-read "Copy to topic: " gnus-topic-alist nil t)))
+	 (gnus-completing-read "Copy to topic" (mapcar 'car gnus-topic-alist) t)))
   (gnus-topic-move-group n topic t))
 
 (defun gnus-topic-kill-group (&optional n discard)
@@ -1443,7 +1441,8 @@ If PERMANENT, make it stay shown in subsequent sessions as well."
 	(gnus-topic-remove-topic t nil)
       (let ((topic
 	     (gnus-topic-find-topology
-	      (completing-read "Show topic: " gnus-topic-alist nil t))))
+	      (gnus-completing-read "Show topic"
+                                    (mapcar 'car gnus-topic-alist) t))))
 	(setcar (cddr (cadr topic)) nil)
 	(setcar (cdr (cadr topic)) 'visible)
 	(gnus-group-list-groups)))))
@@ -1491,7 +1490,8 @@ If NON-RECURSIVE (which is the prefix) is t, don't unmark its subtopics."
    (let (topic)
      (nreverse
       (list
-       (setq topic (completing-read "Move to topic: " gnus-topic-alist nil t))
+       (setq topic (gnus-completing-read "Move to topic"
+                                         (mapcar 'car gnus-topic-alist) t))
        (read-string (format "Move to %s (regexp): " topic))))))
   (gnus-group-mark-regexp regexp)
   (gnus-topic-move-group nil topic copyp))
@@ -1502,7 +1502,8 @@ If NON-RECURSIVE (which is the prefix) is t, don't unmark its subtopics."
    (let (topic)
      (nreverse
       (list
-       (setq topic (completing-read "Copy to topic: " gnus-topic-alist nil t))
+       (setq topic (gnus-completing-read "Copy to topic"
+                                         (mapcar 'car gnus-topic-alist) t))
        (read-string (format "Copy to %s (regexp): " topic))))))
   (gnus-topic-move-matching regexp topic t))
 
@@ -1723,8 +1724,9 @@ If REVERSE, sort in reverse order."
   "Sort topics in TOPIC alphabetically by topic name.
 If REVERSE, reverse the sorting order."
   (interactive
-   (list (completing-read "Sort topics in : " gnus-topic-alist nil t
-			  (gnus-current-topic))
+   (list (gnus-completing-read "Sort topics in"
+                               (mapcar 'car gnus-topic-alist) t
+                               (gnus-current-topic))
 	 current-prefix-arg))
   (let ((topic-topology (or (and topic (cdr (gnus-topic-find-topology topic)))
 			    gnus-topic-topology)))
@@ -1738,7 +1740,7 @@ If REVERSE, reverse the sorting order."
   (interactive
    (list
     (gnus-group-topic-name)
-    (completing-read "Move to topic: " gnus-topic-alist nil t)))
+    (gnus-completing-read "Move to topic" (mapcar 'car gnus-topic-alist) t)))
   (unless (and current to)
     (error "Can't find topic"))
   (let ((current-top (cdr (gnus-topic-find-topology current)))
diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el
index 5ebccc0..d188eba 100644
--- a/lisp/gnus-util.el
+++ b/lisp/gnus-util.el
@@ -44,6 +44,25 @@
     (defmacro with-no-warnings (&rest body)
       `(progn ,@body))))
 
+(defcustom gnus-use-ido nil
+  "Whether to use `ido' for `completing-read'."
+  :version "24.1"
+  :group 'gnus-meta
+  :type 'boolean)
+
+(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 +363,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 +1583,19 @@ 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-completing-read (prompt collection &optional require-match
+                                    initial-input history def)
+  "Call `completing-read' or `ido-completing-read'.
+Depends on `gnus-use-ido'."
+  (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)))
 
 (defun gnus-graphic-display-p ()
   (if (featurep 'xemacs)
diff --git a/lisp/gnus.el b/lisp/gnus.el
index dafaafc..c01cd62 100644
--- a/lisp/gnus.el
+++ b/lisp/gnus.el
@@ -4240,9 +4240,9 @@ Allow completion over sensible values."
 		  gnus-predefined-server-alist
 		  gnus-server-alist))
 	 (method
-	  (completing-read
-	   prompt servers
-	   nil t nil 'gnus-method-history)))
+	  (gnus-completing-read
+	   prompt (mapcar 'car servers)
+	   t nil 'gnus-method-history)))
     (cond
      ((equal method "")
       (setq method gnus-select-method))
diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el
index 9b756ed..7562e57 100644
--- a/lisp/mm-decode.el
+++ b/lisp/mm-decode.el
@@ -1323,11 +1323,11 @@ Use CMD as the process."
   "Display HANDLE using METHOD."
   (let* ((type (mm-handle-media-type handle))
 	 (methods
-	  (mapcar (lambda (i) (list (cdr (assoc 'viewer i))))
+	  (mapcar (lambda (i) (cdr (assoc 'viewer i)))
 		  (mailcap-mime-info type 'all)))
 	 (method (let ((minibuffer-local-completion-map
 			mm-viewer-completion-map))
-		   (completing-read "Viewer: " methods))))
+		   (gnus-completing-read "Viewer" methods))))
     (when (string= method "")
       (error "No method given"))
     (if (string-match "^[^% \t]+$" method)
diff --git a/lisp/mm-util.el b/lisp/mm-util.el
index 7f0d338..c408c61 100644
--- a/lisp/mm-util.el
+++ b/lisp/mm-util.el
@@ -68,11 +68,11 @@
       . ,(lambda (prompt)
 	   "Return a charset."
 	   (intern
-	    (completing-read
+	    (gnus-completing-read
 	     prompt
-	     (mapcar (lambda (e) (list (symbol-name (car e))))
+	     (mapcar (lambda (e) (symbol-name (car e)))
 		     mm-mime-mule-charset-alist)
-	     nil t))))
+	     t))))
      ;; `subst-char-in-string' is not available in XEmacs 21.4.
      (subst-char-in-string
       . ,(lambda (from to string &optional inplace)
@@ -281,8 +281,8 @@ to the contents of the accessible portion of the buffer."
 	'read-coding-system))
      (t (lambda (prompt &optional default-coding-system)
 	  "Prompt the user for a coding system."
-	  (completing-read
-	   prompt (mapcar (lambda (s) (list (symbol-name (car s))))
+	  (gnus-completing-read
+	   prompt (mapcar (lambda (s) (symbol-name (car s)))
 			  mm-mime-mule-charset-alist)))))))
 
 (defvar mm-coding-system-list nil)
@@ -316,8 +316,8 @@ the alias.  Else windows-NUMBER is used."
 			 (cp-supported-codepages)
 		       ;; Removed in Emacs 23 (unicode), so signal an error:
 		       (error "`codepage-setup' not present in this Emacs version"))))
-     (list (completing-read "Setup DOS Codepage: (default 437) " candidates
-			    nil t nil nil "437"))))
+     (list (gnus-completing-read "Setup DOS Codepage" candidates
+                                 t nil nil "437"))))
   (when alias
     (setq alias (if (stringp alias)
 		    (intern alias)
diff --git a/lisp/mm-view.el b/lisp/mm-view.el
index 1a2d940..566908c 100644
--- a/lisp/mm-view.el
+++ b/lisp/mm-view.el
@@ -31,6 +31,7 @@
 (require 'mm-decode)
 (require 'smime)
 
+(autoload 'gnus-completing-read "gnus-util")
 (autoload 'gnus-article-prepare-display "gnus-art")
 (autoload 'vcard-parse-string "vcard")
 (autoload 'vcard-format-string "vcard")
@@ -676,11 +677,9 @@
    (if (= (length smime-keys) 1)
        (cadar smime-keys)
      (smime-get-key-by-email
-      (completing-read
-       (concat "Decipher using key"
-	       (if smime-keys (concat "(default " (caar smime-keys) "): ")
-		 ": "))
-       smime-keys nil nil nil nil (car-safe (car-safe smime-keys))))))
+      (gnus-completing-read
+       "Decipher using key"
+       smime-keys nil nil nil (car-safe (car-safe smime-keys))))))
   (goto-char (point-min))
   (while (search-forward "\r\n" nil t)
     (replace-match "\n"))
diff --git a/lisp/mml-smime.el b/lisp/mml-smime.el
index a99538b..62e742f 100644
--- a/lisp/mml-smime.el
+++ b/lisp/mml-smime.el
@@ -161,10 +161,10 @@ Whether the passphrase is cached at all is controlled by
 					     "")))))
 		(and from (smime-get-key-by-email from)))
 	      (smime-get-key-by-email
-	       (completing-read "Sign this part with what signature? "
-				smime-keys nil nil
-				(and (listp (car-safe smime-keys))
-				     (caar smime-keys))))))))
+	       (gnus-completing-read "Sign this part with what signature"
+                                     smime-keys nil nil
+                                     (and (listp (car-safe smime-keys))
+                                          (caar smime-keys))))))))
 
 (defun mml-smime-get-file-cert ()
   (ignore-errors
@@ -213,15 +213,16 @@ Whether the passphrase is cached at all is controlled by
       (quit))
     result))
 
-(autoload 'gnus-completing-read-with-default "gnus-util")
+(autoload 'gnus-completing-read "gnus-util")
 
 (defun mml-smime-openssl-encrypt-query ()
   ;; todo: try dns/ldap automatically first, before prompting user
   (let (certs done)
     (while (not done)
-      (ecase (read (gnus-completing-read-with-default
-		    "ldap" "Fetch certificate from"
-		    '(("dns") ("ldap") ("file")) nil t))
+      (ecase (read (gnus-completing-read
+		    "Fetch certificate from"
+		    '(("dns") ("ldap") ("file")) t nil nil
+                    "ldap"))
 	(dns (setq certs (append certs
 				 (mml-smime-get-dns-cert))))
 	(ldap (setq certs (append certs
diff --git a/lisp/mml.el b/lisp/mml.el
index 15b1bb7..3cf0f37 100644
--- a/lisp/mml.el
+++ b/lisp/mml.el
@@ -40,6 +40,7 @@
 (autoload 'message-make-message-id "message")
 (declare-function gnus-setup-posting-charset "gnus-msg" (group))
 (autoload 'gnus-make-local-hook "gnus-util")
+(autoload 'gnus-completing-read "gnus-util")
 (autoload 'message-fetch-field "message")
 (autoload 'message-mark-active-p "message")
 (autoload 'message-info "message")
@@ -1188,9 +1189,10 @@ If not set, `default-directory' will be used."
 		      ;; looks like, and offer text/plain if it looks
 		      ;; like text/plain.
 		      "application/octet-stream"))
-	 (string (completing-read
-		  (format "Content type (default %s): " default)
-		  (mapcar 'list (mailcap-mime-types)))))
+	 (string (gnus-completing-read
+		  "Content type"
+		  (mailcap-mime-types)
+                  nil nil nil default)))
     (if (not (equal string ""))
 	string
       default)))
@@ -1204,10 +1206,10 @@ If not set, `default-directory' will be used."
 (defun mml-minibuffer-read-disposition (type &optional default filename)
   (unless default
     (setq default (mml-content-disposition type filename)))
-  (let ((disposition (completing-read
-		      (format "Disposition (default %s): " default)
-		      '(("attachment") ("inline") (""))
-		      nil t nil nil default)))
+  (let ((disposition (gnus-completing-read
+		      "Disposition"
+		      '("attachment" "inline")
+		      t nil nil default)))
     (if (not (equal disposition ""))
 	disposition
       default)))
@@ -1395,11 +1397,11 @@ TYPE is the MIME type to use."
 
 (defun mml-insert-multipart (&optional type)
   (interactive (if (message-in-body-p)
-		   (list (completing-read "Multipart type (default mixed): "
-					  '(("mixed") ("alternative")
-					    ("digest") ("parallel")
-					    ("signed") ("encrypted"))
-					  nil nil "mixed"))
+		   (list (gnus-completing-read "Multipart type"
+                                               '("mixed" "alternative"
+                                                 "digest" "parallel"
+                                                 "signed" "encrypted")
+                                               nil "mixed"))
 		 (error "Use this command in the message body")))
   (or type
       (setq type "mixed"))
diff --git a/lisp/nnir.el b/lisp/nnir.el
index db8b397..455a0fd 100644
--- a/lisp/nnir.el
+++ b/lisp/nnir.el
@@ -1588,7 +1588,7 @@ Tested with Namazu 2.0.6 on a GNU/Linux system."
   (let ((sym (car parmspec))
         (prompt (cdr parmspec)))
     (if (listp prompt)
-	(let* ((result (apply 'completing-read prompt))
+	(let* ((result (gnus-completing-read prompt nil))
 	       (mapping (or (assoc result nnir-imap-search-arguments)
 			    (assoc nil nnir-imap-search-arguments))))
 	  (cons sym (format (cdr mapping) result)))
diff --git a/lisp/nnmairix.el b/lisp/nnmairix.el
index bca549a..9672c04 100644
--- a/lisp/nnmairix.el
+++ b/lisp/nnmairix.el
@@ -848,8 +848,8 @@ called interactively, user will be asked for parameters."
 All necessary information will be queried from the user."
   (interactive)
   (let* ((name (read-string "Name of the mairix server: "))
-	(server (completing-read "Back end server (TAB for completion): "
-				 (nnmairix-get-valid-servers) nil 1))
+	(server (gnus-completing-read "Back end server"
+				 (nnmairix-get-valid-servers) t))
 	(mairix (read-string "Command to call mairix: " "mairix"))
 	(defaultgroup (read-string "Default search group: "))
 	(backend (symbol-name (car (gnus-server-to-method server))))
@@ -1165,7 +1165,7 @@ nnmairix server. Only marks from current session will be set."
 If SKIPDEFAULT is t, the default search group will not be
 updated.
 If UPDATEDB is t, database for SERVERNAME will be updated first."
-  (interactive (list (completing-read "Update groups on server: "
+  (interactive (list (gnus-completing-read "Update groups on server"
 				(nnmairix-get-nnmairix-servers))))
   (save-excursion
     (when (string-match ".*:\\(.*\\)" servername)
@@ -1302,7 +1302,7 @@ Otherwise, ask user for server."
 	  (while
 	      (equal '("")
 		  (setq nnmairix-last-server
-			(list (completing-read "Server: " openedserver nil 1
+			(list (gnus-completing-read "Server" openedserver t
 					       (or nnmairix-last-server
 						   "nnmairix:"))))))
 	  nnmairix-last-server)
@@ -1492,10 +1492,10 @@ group."
 	  (when (not found)
 	    (setq mairixserver
 		  (gnus-server-to-method
-		   (completing-read
-		    (format "Cannot determine which nnmairix server indexes %s. Please specify: "
+		   (gnus-completing-read
+		    (format "Cannot determine which nnmairix server indexes %s. Please specify"
 			    (gnus-method-to-server server))
-		    (nnmairix-get-nnmairix-servers) nil nil "nnmairix:")))
+		    (nnmairix-get-nnmairix-servers) nil "nnmairix:")))
 	    ;; Save result in parameter of default search group so that
 	    ;; we don't have to ask again
 	    (setq defaultgroup (gnus-group-prefixed-name
@@ -1643,9 +1643,9 @@ search in raw mode."
 	      (gnus-registry-add-group mid cur)))))
       (if (> (length allgroups) 1)
 	  (setq group
-		(completing-read
-		 "Message exists in more than one group. Choose: "
-		 allgroups nil t))
+		(gnus-completing-read
+		 "Message exists in more than one group. Choose"
+		 allgroups t))
 	(setq group (car allgroups))))
     (if group
 	;; show article in summary buffer
@@ -1748,9 +1748,9 @@ SERVER."
 	     (gnus-group-prefixed-name group (car cur))
 	     allgroups))))
       (if (> (length allgroups) 1)
-	  (setq group (completing-read
-		       "Group %s exists on more than one IMAP server. Choose: "
-		       allgroups nil t))
+	  (setq group (gnus-completing-read
+		       "Group %s exists on more than one IMAP server. Choose"
+		       allgroups t))
 	(setq group (car allgroups))))
     group))
 
diff --git a/lisp/nnrss.el b/lisp/nnrss.el
index 379fee2..8897b37 100644
--- a/lisp/nnrss.el
+++ b/lisp/nnrss.el
@@ -1058,9 +1058,9 @@ whether they are `offsite' or `onsite'."
 				    (cdr (assoc "feedid" listinfo)))))
 			   feedinfo)))
 	      (cdr (assoc
-		    (completing-read
-		     "Multiple feeds found.  Select one: "
-		     selection nil t) urllist)))))))))
+		    (gnus-completing-read
+		     "Multiple feeds found. Select one"
+		     selection t) urllist)))))))))
 
 (defun nnrss-rss-p (data)
   "Test if DATA is an RSS feed.
diff --git a/lisp/smime.el b/lisp/smime.el
index a266819..2492007 100644
--- a/lisp/smime.el
+++ b/lisp/smime.el
@@ -371,12 +371,9 @@ KEYFILE should contain a PEM encoded key and certificate."
 	     (if keyfile
 		 keyfile
 	       (smime-get-key-with-certs-by-email
-		(completing-read
-		 (concat "Sign using key"
-			 (if smime-keys
-			     (concat " (default " (caar smime-keys) "): ")
-			   ": "))
-		 smime-keys nil nil (car-safe (car-safe smime-keys))))))
+		(gnus-completing-read
+		 "Sign using key"
+		 smime-keys nil (car-safe (car-safe smime-keys))))))
       (error "Signing failed"))))
 
 (defun smime-encrypt-buffer (&optional certfiles buffer)
@@ -502,11 +499,9 @@ in the buffer specified by `smime-details-buffer'."
      (expand-file-name
       (or keyfile
 	  (smime-get-key-by-email
-	   (completing-read
-	    (concat "Decipher using key"
-		    (if smime-keys (concat " (default " (caar smime-keys) "): ")
-		      ": "))
-	    smime-keys nil nil (car-safe (car-safe smime-keys)))))))))
+	   (gnus-completing-read
+	    "Decipher using key"
+	    smime-keys nil (car-safe (car-safe smime-keys)))))))))
 
 ;; Various operations
 
@@ -660,6 +655,7 @@ A string or a list of strings is returned."
   (define-key smime-mode-map "f" 'smime-certificate-info))
 
 (autoload 'gnus-run-mode-hooks "gnus-util")
+(autoload 'gnus-completing-read "gnus-util")
 
 (defun smime-mode ()
   "Major mode for browsing, viewing and fetching certificates.
-- 
1.7.1




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-28 15:55 ` Florian Ragwitz
@ 2010-09-28 16:04   ` Julien Danjou
  2010-09-28 19:31     ` Florian Ragwitz
  0 siblings, 1 reply; 48+ messages in thread
From: Julien Danjou @ 2010-09-28 16:04 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 434 bytes --]

On Tue, Sep 28 2010, Florian Ragwitz wrote:

> This is what I did a couple of months back for pod-mode.el. I believe it
> makes for nicer customisation. If you like this as well, I'd be happy to
> prepare an updated patch using the above, and extending it also support
> REQUIRE-MATCH, INITIAL-INPUT, HISTORY, etc.

I like that. Please, go ahead!

-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-28 16:04   ` Julien Danjou
@ 2010-09-28 19:31     ` Florian Ragwitz
  2010-09-28 20:47       ` Julien Danjou
  0 siblings, 1 reply; 48+ messages in thread
From: Florian Ragwitz @ 2010-09-28 19:31 UTC (permalink / raw)
  To: ding


[-- Attachment #1.1: Type: text/plain, Size: 800 bytes --]

Julien Danjou <julien@danjou.info> writes:
> On Tue, Sep 28 2010, Florian Ragwitz wrote:
>
>> This is what I did a couple of months back for pod-mode.el. I believe it
>> makes for nicer customisation. If you like this as well, I'd be happy to
>> prepare an updated patch using the above, and extending it also support
>> REQUIRE-MATCH, INITIAL-INPUT, HISTORY, etc.
>
> I like that. Please, go ahead!

Here's a patch adding what I've been talking about on top of your
patch. Note that gnus-icompleting-read ignores its HISTORY argument. I
haven't quite figured out how to do that, assuming iswitchb supports
some sort of history at all. However, it's already useful to me as is,
as I can make use of all my iswitchb customisations while only missing
out on a feature I don't particularly care about.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: Make completing-read function configurable --]
[-- Type: text/x-diff, Size: 4968 bytes --]

From 7ed22dee4f254d7af4223213dd8c05b00ca8429d Mon Sep 17 00:00:00 2001
From: Florian Ragwitz <rafl@debian.org>
Date: Tue, 28 Sep 2010 21:24:45 +0200
Subject: [PATCH] Make completing-read function configurable

Also provide some default implementations using completing-read,
iswitchb, and ido-completing-read.
---
 lisp/ChangeLog    |   11 ++++++++++
 lisp/gnus-util.el |   56 +++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 57 insertions(+), 10 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d5546f9..f3e5a54 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
+2010-09-28  Florian Ragwitz  <rafl@debian.org>
+
+	* gnus-util.el (gnus-use-ido): Removed.
+	(gnus-std-completing-read): Add wrapper around completing-read.
+	(gnus-icompleting-read): Add wrapper around ibuffer-read-buffer.
+	(gnus-ido-completing-read): Add wrapper around ido-completing-read.
+	(gnus-completing-read-function): Add to chose from the above completion
+	functions or to provide a custom one.
+	(gnus-completing-read): Use the completing-read function configured
+	with gnus-completing-read-function.
+
 2010-09-28  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* mail-source.el (mail-source-report-new-mail)
diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el
index d188eba..1c390c7 100644
--- a/lisp/gnus-util.el
+++ b/lisp/gnus-util.el
@@ -44,11 +44,18 @@
     (defmacro with-no-warnings (&rest body)
       `(progn ,@body))))
 
-(defcustom gnus-use-ido nil
-  "Whether to use `ido' for `completing-read'."
-  :version "24.1"
+(defcustom gnus-completing-read-function
+  #'gnus-std-completing-read
+  "Function to do a completing read."
   :group 'gnus-meta
-  :type 'boolean)
+  :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)
@@ -1583,19 +1590,48 @@ 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-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)
+  (let ((iswitchb-make-buflist-hook
+         (lambda ()
+           (setq iswitchb-temp-buflist
+                 (let ((choices (append (list)
+                                        (when initial-input (list initial-input))
+                                        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)
+  (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)
-  "Call `completing-read' or `ido-completing-read'.
-Depends on `gnus-use-ido'."
+  "Do a completing read with the configured `gnus-completing-read-function'."
   (let ((completion-styles gnus-completion-styles))
     (funcall
-     (if gnus-use-ido
-         'ido-completing-read
-       'completing-read)
+     gnus-completing-read-function
      (concat prompt (when def
                       (concat " (default " def ")"))
              ": ")
-     collection nil require-match initial-input history def)))
+     collection require-match initial-input history def)))
 
 (defun gnus-graphic-display-p ()
   (if (featurep 'xemacs)
-- 
1.7.1


[-- Attachment #1.3: Type: text/plain, Size: 58 bytes --]


Here's the same thing combined with your initial patch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.4: Introduce gnus-completing-read --]
[-- Type: text/x-diff, Size: 54884 bytes --]

From 70b9d629b53480965639385faa352687a7ef61ca Mon Sep 17 00:00:00 2001
From: Julien Danjou <julien@danjou.info>
Date: Tue, 28 Sep 2010 18:06:46 +0200
Subject: [PATCH] Introduce gnus-completing-read

Signed-off-by: Julien Danjou <julien@danjou.info>
Signed-off-by: Florian Ragwitz <rafl@debian.org>
[rafl@debian.org: Added gnus-completing-read-function and iswitchb support]
---
 lisp/ChangeLog        |   87 +++++++++++++++++++++++++++++++++++++++++
 lisp/gnus-agent.el    |   11 ++---
 lisp/gnus-art.el      |   17 ++++----
 lisp/gnus-bookmark.el |    4 +-
 lisp/gnus-diary.el    |    8 ++--
 lisp/gnus-dired.el    |    8 +---
 lisp/gnus-group.el    |  104 ++++++++++++++++++++++--------------------------
 lisp/gnus-int.el      |    9 ++--
 lisp/gnus-msg.el      |   26 ++++++------
 lisp/gnus-registry.el |   11 ++---
 lisp/gnus-score.el    |   27 +++++++------
 lisp/gnus-srvr.el     |    7 ++-
 lisp/gnus-sum.el      |   75 ++++++++++++++---------------------
 lisp/gnus-topic.el    |   24 ++++++-----
 lisp/gnus-util.el     |   93 ++++++++++++++++++++++++++++++++------------
 lisp/gnus.el          |    6 +-
 lisp/mm-decode.el     |    4 +-
 lisp/mm-util.el       |   14 +++---
 lisp/mm-view.el       |    9 ++--
 lisp/mml-smime.el     |   17 ++++----
 lisp/mml.el           |   26 +++++++------
 lisp/nnir.el          |    2 +-
 lisp/nnmairix.el      |   26 ++++++------
 lisp/nnrss.el         |    6 +-
 lisp/smime.el         |   18 +++-----
 25 files changed, 371 insertions(+), 268 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bb8269a..f3e5a54 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
+2010-09-28  Florian Ragwitz  <rafl@debian.org>
+
+	* gnus-util.el (gnus-use-ido): Removed.
+	(gnus-std-completing-read): Add wrapper around completing-read.
+	(gnus-icompleting-read): Add wrapper around ibuffer-read-buffer.
+	(gnus-ido-completing-read): Add wrapper around ido-completing-read.
+	(gnus-completing-read-function): Add to chose from the above completion
+	functions or to provide a custom one.
+	(gnus-completing-read): Use the completing-read function configured
+	with gnus-completing-read-function.
+
 2010-09-28  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* mail-source.el (mail-source-report-new-mail)
@@ -17,6 +28,82 @@
 	* gnus-gravatar.el (gnus-gravatar-insert): Search backward for
 	real-name, and then for mail address rather than doing : or , search.
 
+2010-09-27  Julien Danjou  <julien@danjou.info>
+
+	* gnus-srvr.el (gnus-server-add-server): Use gnus-completing-read.
+	(gnus-server-goto-server): Use gnus-completing-read.
+
+	* mm-view.el (mm-view-pkcs7-decrypt): Use gnus-completing-read.
+
+	* mm-util.el (defalias): Use gnus-completing-read.
+	(mm-codepage-setup): Use gnus-completing-read.
+
+	* smime.el (smime-sign-buffer): Use gnus-completing-read.
+	(smime-decrypt-buffer): Use gnus-completing-read.
+
+	* mml-smime.el (mml-smime-openssl-sign-query): Use gnus-completing-read.
+
+	* mml.el (mml-minibuffer-read-type): Use gnus-completing-read.
+	(mml-minibuffer-read-disposition): Use gnus-completing-read.
+	(mml-insert-multipart): Use gnus-completing-read.
+
+	* gnus-msg.el (gnus-summary-yank-message): Use gnus-completing-read.
+
+	* gnus-int.el (gnus-start-news-server): Use gnus-completing-read.
+
+	* mm-decode.el (mm-interactively-view-part): Use gnus-completing-read.
+
+	* gnus-dired.el (gnus-dired-attach): Use gnus-completing-read.
+
+	* gnus.el (gnus-read-method): Use gnus-completing-read.
+
+	* gnus-bookmark.el (gnus-bookmark-jump): Use gnus-completing-read.
+
+	* gnus-art.el (gnus-mime-view-part-as-type): Use gnus-completing-read.
+	(gnus-mime-action-on-part): Use gnus-completing-read.
+	(gnus-article-encrypt-body): Use gnus-completing-read.
+
+	* gnus-topic.el (gnus-topic-jump-to-topic): Use gnus-completing-read.
+	(gnus-topic-move-matching): Use gnus-completing-read.
+	(gnus-topic-copy-matching): Use gnus-completing-read.
+	(gnus-topic-sort-topics): Use gnus-completing-read.
+	(gnus-topic-move): Use gnus-completing-read.
+
+	* gnus-agent.el (gnus-agent-read-group): Remove prompt computing.
+	(gnus-agent-add-group): Use gnus-completing-read.
+
+	* nnmairix.el (nnmairix-create-server-and-default-group): Use
+	gnus-completing-read.
+	(nnmairix-update-groups): Use gnus-completing-read.
+	(nnmairix-get-server): Use gnus-completing-read.
+	(nnmairix-backend-to-server): Use gnus-completing-read.
+	(nnmairix-goto-original-article): Use gnus-completing-read.
+	(nnmairix-get-group-from-file-path): Use gnus-completing-read.
+
+	* nnrss.el (nnrss-find-rss-via-syndic8): Use gnus-completing-read.
+
+	* gnus-group.el (gnus-group-completing-read): Use gnus-completing-read.
+	(gnus-group-make-useful-group): Use gnus-completing-read.
+	(gnus-group-make-web-group): Use gnus-completing-read.
+	(gnus-group-add-to-virtual): Use gnus-completing-read.
+	(gnus-group-browse-foreign-server): Use gnus-completing-read.
+
+	* gnus-sum.el (gnus-summary-goto-article): Use gnus-completing-read.
+	(gnus-summary-limit-to-extra): Use gnus-completing-read.
+	(gnus-summary-execute-command): Use gnus-completing-read.
+	(gnus-summary-respool-article): Use gnus-completing-read.
+	(gnus-read-move-group-name): Use gnus-completing-read.
+
+	* gnus-score.el (gnus-summary-increase-score): Use gnus-completing-read.
+	(gnus-summary-score-effect): Use gnus-completing-read.
+
+	* gnus-registry.el (gnus-registry-read-mark): Use gnus-completing-read.
+
+	* gnus-util.el (gnus-completing-read): Use gnus-use-ido to apply the
+	right completing-read function.
+	(gnus-use-ido): New variable
+	(gnus-completing-read-with-default): Remove.
+
 2010-09-28  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* lpath.el: Remove url-http-file-exists-p, w32-focus-frame, and
diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el
index 4788deb..8043620 100644
--- a/lisp/gnus-agent.el
+++ b/lisp/gnus-agent.el
@@ -459,10 +459,7 @@ manipulated as follows:
   (let ((def (or (gnus-group-group-name) gnus-newsgroup-name)))
     (when def
       (setq def (gnus-group-decoded-name def)))
-    (gnus-group-completing-read (if def
-				    (concat "Group Name (" def "): ")
-				  "Group Name: ")
-				nil nil t nil nil def)))
+    (gnus-group-completing-read nil nil t nil nil def)))
 
 ;;; Fetching setup functions.
 
@@ -816,9 +813,9 @@ be a select method."
   (interactive
    (list
     (intern
-     (completing-read
-      "Add to category: "
-      (mapcar (lambda (cat) (list (symbol-name (car cat))))
+     (gnus-completing-read
+      "Add to category"
+      (mapcar (lambda (cat) (symbol-name (car cat)))
 	      gnus-category-alist)
       nil t))
     current-prefix-arg))
diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el
index 6e5cd4d..4e2d43c 100644
--- a/lisp/gnus-art.el
+++ b/lisp/gnus-art.el
@@ -5131,11 +5131,10 @@ available media-types."
   (unless mime-type
     (setq mime-type
 	  (let ((default (gnus-mime-view-part-as-type-internal)))
-	    (completing-read
-	     (format "View as MIME type (default %s): "
-		     (car default))
-	     (mapcar #'list (mailcap-mime-types))
-	     pred nil nil nil
+	    (gnus-completing-read
+	     "View as MIME type"
+	     (remove-if-not pred (mailcap-mime-types))
+	     nil nil nil
 	     (car default)))))
   (gnus-article-check-buffer)
   (let ((handle (get-text-property (point) 'gnus-data)))
@@ -5404,7 +5403,7 @@ If no internal viewer is available, use an external viewer."
 (defun gnus-mime-action-on-part (&optional action)
   "Do something with the MIME attachment at \(point\)."
   (interactive
-   (list (completing-read "Action: " gnus-mime-action-alist nil t)))
+   (list (gnus-completing-read "Action" (mapcar 'car gnus-mime-action-alist) t)))
   (gnus-article-check-buffer)
   (let ((action-pair (assoc action gnus-mime-action-alist)))
     (if action-pair
@@ -8370,9 +8369,9 @@ For example:
   (interactive
    (list
     (or gnus-article-encrypt-protocol
-	(completing-read "Encrypt protocol: "
-			 gnus-article-encrypt-protocol-alist
-			 nil t))
+	(gnus-completing-read "Encrypt protocol"
+                              (mapcar 'car gnus-article-encrypt-protocol-alist)
+                              t))
     current-prefix-arg))
   ;; User might hit `K E' instead of `K e', so prompt once.
   (when (and gnus-article-encrypt-protocol
diff --git a/lisp/gnus-bookmark.el b/lisp/gnus-bookmark.el
index 137479b..4237508 100644
--- a/lisp/gnus-bookmark.el
+++ b/lisp/gnus-bookmark.el
@@ -289,8 +289,8 @@ So the cdr of each bookmark is an alist too.")
   (interactive)
   (gnus-bookmark-maybe-load-default-file)
   (let* ((bookmark (or bmk-name
-	  (completing-read "Jump to bookmarked article: "
-			   gnus-bookmark-alist)))
+                       (gnus-completing-read "Jump to bookmarked article"
+                                             (mapcar 'car gnus-bookmark-alist))))
 	 (bmk-record (cadr (assoc bookmark gnus-bookmark-alist)))
 	 (group (cdr (assoc 'group bmk-record)))
 	 (message-id (cdr (assoc 'message-id bmk-record))))
diff --git a/lisp/gnus-diary.el b/lisp/gnus-diary.el
index 18130bb..76d469b 100644
--- a/lisp/gnus-diary.el
+++ b/lisp/gnus-diary.el
@@ -368,11 +368,11 @@ If ARG (or prefix) is non-nil, force prompting for all fields."
 				 header ": ")))
 	     (setq value
 		   (if (listp (nth 1 head))
-		       (completing-read prompt (cons '("*" nil) (nth 1 head))
-					nil t value
-					gnus-diary-header-value-history)
+		       (gnus-completing-read prompt (cons '("*" nil) (nth 1 head))
+                                             t value
+                                             'gnus-diary-header-value-history)
 		     (read-string prompt value
-				  gnus-diary-header-value-history))))
+				  'gnus-diary-header-value-history))))
 	   (setq ask nil)
 	   (setq invalid nil)
 	   (condition-case ()
diff --git a/lisp/gnus-dired.el b/lisp/gnus-dired.el
index f9502b4..da20c66 100644
--- a/lisp/gnus-dired.el
+++ b/lisp/gnus-dired.el
@@ -152,12 +152,8 @@ filenames."
 	  (setq destination
 		(if (= (length bufs) 1)
 		    (get-buffer (car bufs))
-		  (completing-read "Attach to which mail composition buffer: "
-				   (mapcar
-				    (lambda (b)
-				      (cons b (get-buffer b)))
-				    bufs)
-				   nil t)))
+		  (gnus-completing-read "Attach to which mail composition buffer"
+                                         bufs t)))
 	;; setup a new mail composition buffer
 	(let ((mail-user-agent gnus-dired-mail-mode)
 	      ;; A workaround to prevent Gnus from displaying the Gnus
diff --git a/lisp/gnus-group.el b/lisp/gnus-group.el
index 7dddb9b..eb594f3 100644
--- a/lisp/gnus-group.el
+++ b/lisp/gnus-group.el
@@ -2164,44 +2164,35 @@ be permanent."
 		group)))
 	(goto-char start)))))
 
-(defun gnus-group-completing-read (prompt &optional collection predicate
-					  require-match initial-input hist def
-					  &rest args)
+(defun gnus-group-completing-read (&optional prompt collection
+                                             require-match initial-input hist def)
   "Read a group name with completion.  Non-ASCII group names are allowed.
 The arguments are the same as `completing-read' except that COLLECTION
 and HIST default to `gnus-active-hashtb' and `gnus-group-history'
 respectively if they are omitted."
-  (let ((completion-styles (and (boundp 'completion-styles)
-				completion-styles))
-	group)
-    (push 'substring completion-styles)
-    (mapatoms (lambda (symbol)
-		(setq group (symbol-name symbol))
-		(set (intern (if (string-match "[^\000-\177]" group)
-				 (gnus-group-decoded-name group)
-			       group)
-			     collection)
-		     group))
-	      (prog1
-		  (or collection
-		      (setq collection (or gnus-active-hashtb [0])))
-		(setq collection (gnus-make-hashtable (length collection)))))
-    (setq group (apply 'completing-read prompt collection predicate
-		       require-match initial-input
-		       (or hist 'gnus-group-history)
-		       def args))
-    (or (prog1
-	    (symbol-value (intern-soft group collection))
-	  (setq collection nil))
-	(mm-encode-coding-string group (gnus-group-name-charset nil group)))))
+  (let* ((choices (mapcar (lambda (symbol)
+                            (let ((group (symbol-name symbol)))
+                              (if (string-match "[^\000-\177]" group)
+                                  (gnus-group-decoded-name group)
+                                group)))
+                          (remove-if-not
+                           'symbolp
+                           (or collection (or gnus-active-hashtb [0])))))
+         (group
+          (gnus-completing-read (or prompt "Group") choices
+                                require-match initial-input
+                                (or hist 'gnus-group-history)
+                                def)))
+    (or (symbol-value (intern-soft group collection))
+        (mm-encode-coding-string group (gnus-group-name-charset nil group)))))
 
 ;;;###autoload
 (defun gnus-fetch-group (group &optional articles)
   "Start Gnus if necessary and enter GROUP.
 If ARTICLES, display those articles.
 Returns whether the fetching was successful or not."
-  (interactive (list (gnus-group-completing-read "Group name: "
-						 nil nil nil
+  (interactive (list (gnus-group-completing-read nil
+						 nil nil
 						 (gnus-group-name-at-point))))
   (unless (gnus-alive-p)
     (gnus-no-server))
@@ -2261,7 +2252,7 @@ Return the name of the group if selection was successful."
   (interactive
    (list
     ;; (gnus-read-group "Group name: ")
-    (gnus-group-completing-read "Group: ")
+    (gnus-group-completing-read)
     (gnus-read-method "From method: ")))
   ;; Transform the select method into a unique server.
   (when (stringp method)
@@ -2328,7 +2319,7 @@ specified by `gnus-gmane-group-download-format'."
   ;; See <http://gmane.org/export.php> for more information.
   (interactive
    (list
-    (gnus-group-completing-read "Gmane group: ")
+    (gnus-group-completing-read "Gmane group")
     (read-number "Start article number: ")
     (read-number "How many articles: ")))
   (unless range (setq range 500))
@@ -2362,7 +2353,7 @@ Valid input formats include:
   ;;   prompt the user to decide: "View via `browse-url' or in Gnus? "
   ;;   (`gnus-read-ephemeral-gmane-group-url')
   (interactive
-   (list (gnus-group-completing-read "Gmane URL: ")))
+   (list (gnus-group-completing-read "Gmane URL")))
   (let (group start range)
     (cond
      ;; URLs providing `group', `start' and `range':
@@ -2456,13 +2447,13 @@ If PROMPT (the prefix) is a number, use the prompt specified in
 `gnus-group-jump-to-group-prompt'."
   (interactive
    (list (gnus-group-completing-read
-	  "Group: " nil nil (gnus-read-active-file-p)
-	  (if current-prefix-arg
-	      (cdr (assq current-prefix-arg gnus-group-jump-to-group-prompt))
-	    (or (and (stringp gnus-group-jump-to-group-prompt)
-		     gnus-group-jump-to-group-prompt)
-		(let ((p (cdr (assq 0 gnus-group-jump-to-group-prompt))))
-		  (and (stringp p) p)))))))
+          nil nil (gnus-read-active-file-p)
+          (if current-prefix-arg
+              (cdr (assq current-prefix-arg gnus-group-jump-to-group-prompt))
+            (or (and (stringp gnus-group-jump-to-group-prompt)
+                     gnus-group-jump-to-group-prompt)
+                (let ((p (cdr (assq 0 gnus-group-jump-to-group-prompt))))
+                  (and (stringp p) p)))))))
 
   (when (equal group "")
     (error "Empty group name"))
@@ -2653,7 +2644,7 @@ If EXCLUDE-GROUP, do not go to that group."
 (defun gnus-group-make-group-simple (&optional group)
   "Add a new newsgroup.
 The user will be prompted for GROUP."
-  (interactive (list (gnus-group-completing-read "Group: ")))
+  (interactive (list (gnus-group-completing-read)))
   (gnus-group-make-group (gnus-group-real-name group)
 			 (gnus-group-server group)
 			 nil nil t))
@@ -2912,8 +2903,9 @@ and NEW-NAME will be prompted for."
 (defun gnus-group-make-useful-group (group method)
   "Create one of the groups described in `gnus-useful-groups'."
   (interactive
-   (let ((entry (assoc (completing-read "Create group: " gnus-useful-groups
-					nil t)
+   (let ((entry (assoc (gnus-completing-read "Create group"
+                                             (mapcar 'car gnus-useful-groups)
+                                             t)
 		       gnus-useful-groups)))
      (list (cadr entry)
 	   ;; Don't use `caddr' here since macros within the `interactive'
@@ -3005,11 +2997,11 @@ If SOLID (the prefix), create a solid group."
 			   (symbol-name (caar nnweb-type-definition))))
 	 (type
 	  (gnus-string-or
-	   (completing-read
-	    (format "Search engine type (default %s): " default-type)
-	    (mapcar (lambda (elem) (list (symbol-name (car elem))))
+	   (gnus-completing-read
+	    "Search engine type"
+	    (mapcar (lambda (elem) (symbol-name (car elem)))
 		    nnweb-type-definition)
-	    nil t nil 'gnus-group-web-type-history)
+	    t nil 'gnus-group-web-type-history)
 	   default-type))
 	 (search
 	  (read-string
@@ -3100,8 +3092,8 @@ mail messages or news articles in files that have numeric names."
   "Add the current group to a virtual group."
   (interactive
    (list current-prefix-arg
-	 (completing-read "Add to virtual group: " gnus-newsrc-hashtb nil t
-			  "nnvirtual:")))
+	 (gnus-group-completing-read "Add to virtual group"
+                                     nil t "nnvirtual:")))
   (unless (eq (car (gnus-find-method-for-group vgroup)) 'nnvirtual)
     (error "%s is not an nnvirtual group" vgroup))
   (gnus-close-group vgroup)
@@ -3672,7 +3664,7 @@ If given numerical prefix, toggle the N next groups."
 Killed newsgroups are subscribed.  If SILENT, don't try to update the
 group line."
   (interactive (list (gnus-group-completing-read
-		      "Group: " nil nil (gnus-read-active-file-p))))
+		      nil (gnus-read-active-file-p))))
   (let ((newsrc (gnus-group-entry group)))
     (cond
      ((string-match "^[ \t]*$" group)
@@ -4013,7 +4005,7 @@ If DONT-SCAN is non-nil, scan non-activated groups as well."
 If given a prefix argument, prompt for a group."
   (interactive
    (list (or (when current-prefix-arg
-	       (gnus-group-completing-read "Group: "))
+	       (gnus-group-completing-read))
 	     (gnus-group-group-name)
 	     gnus-newsgroup-name)))
   (unless group
@@ -4314,18 +4306,18 @@ If called interactively, this function will ask for a select method
 If not, METHOD should be a list where the first element is the method
 and the second element is the address."
   (interactive
-   (list (let ((how (completing-read
-		     "Which back end: "
-		     (append gnus-valid-select-methods gnus-server-alist)
-		     nil t (cons "nntp" 0) 'gnus-method-history)))
+   (list (let ((how (gnus-completing-read
+		     "Which back end"
+		     (mapcar 'car (append gnus-valid-select-methods gnus-server-alist))
+		     t (cons "nntp" 0) 'gnus-method-history)))
 	   ;; We either got a back end name or a virtual server name.
 	   ;; If the first, we also need an address.
 	   (if (assoc how gnus-valid-select-methods)
 	       (list (intern how)
 		     ;; Suggested by mapjph@bath.ac.uk.
-		     (completing-read
-		      "Address: "
-		      (mapcar 'list gnus-secondary-servers)))
+		     (gnus-completing-read
+		      "Address"
+		      gnus-secondary-servers))
 	     ;; We got a server name.
 	     how))))
   (gnus-browse-foreign-server method))
diff --git a/lisp/gnus-int.el b/lisp/gnus-int.el
index 3245b16..33d020f 100644
--- a/lisp/gnus-int.el
+++ b/lisp/gnus-int.el
@@ -94,11 +94,10 @@ If CONFIRM is non-nil, the user will be asked for an NNTP server."
       (when confirm
 	;; Read server name with completion.
 	(setq gnus-nntp-server
-	      (completing-read "NNTP server: "
-			       (mapcar 'list
-				       (cons (list gnus-nntp-server)
-					     gnus-secondary-servers))
-			       nil nil gnus-nntp-server)))
+	      (gnus-completing-read "NNTP server"
+                                    (cons gnus-nntp-server
+                                          gnus-secondary-servers)
+                                    nil gnus-nntp-server)))
 
       (when (and gnus-nntp-server
 		 (stringp gnus-nntp-server)
diff --git a/lisp/gnus-msg.el b/lisp/gnus-msg.el
index a2a2652..a3794f2 100644
--- a/lisp/gnus-msg.el
+++ b/lisp/gnus-msg.el
@@ -578,8 +578,8 @@ If ARG is 1, prompt for a group name to find the posting style."
 		(if arg
 		    (if (= 1 (prefix-numeric-value arg))
 			(gnus-group-completing-read
-			 "Use posting style of group: "
-			 nil nil (gnus-read-active-file-p))
+			 "Use posting style of group"
+			 nil (gnus-read-active-file-p))
 		      (gnus-group-group-name))
 		  ""))
 	  ;; #### see comment in gnus-setup-message -- drv
@@ -607,8 +607,8 @@ network.  The corresponding back end must have a 'request-post method."
 	  (setq gnus-newsgroup-name
 		(if arg
 		    (if (= 1 (prefix-numeric-value arg))
-			(gnus-group-completing-read "Use group: "
-						    nil nil
+			(gnus-group-completing-read "Use group"
+						    nil
 						    (gnus-read-active-file-p))
 		      (gnus-group-group-name))
 		  ""))
@@ -628,7 +628,7 @@ a news."
   (let ((gnus-newsgroup-name
 	 (if arg
 	     (if (= 1 (prefix-numeric-value arg))
-		 (gnus-group-completing-read "Newsgroup: " nil nil
+		 (gnus-group-completing-read "Newsgroup" nil
 					     (gnus-read-active-file-p))
 	       (gnus-group-group-name))
 	   ""))
@@ -654,8 +654,8 @@ posting style."
 	  (setq gnus-newsgroup-name
 		(if arg
 		    (if (= 1 (prefix-numeric-value arg))
-			(gnus-group-completing-read "Use group: "
-						    nil nil
+			(gnus-group-completing-read "Use group"
+						    nil
 						    (gnus-read-active-file-p))
 		      "")
 		  gnus-newsgroup-name))
@@ -684,8 +684,8 @@ network.  The corresponding back end must have a 'request-post method."
 	  (setq gnus-newsgroup-name
 		(if arg
 		    (if (= 1 (prefix-numeric-value arg))
-			(gnus-group-completing-read "Use group: "
-						    nil nil
+			(gnus-group-completing-read "Use group"
+						    nil
 						    (gnus-read-active-file-p))
 		      "")
 		  gnus-newsgroup-name))
@@ -710,7 +710,7 @@ a news."
   (let ((gnus-newsgroup-name
 	 (if arg
 	     (if (= 1 (prefix-numeric-value arg))
-		 (gnus-group-completing-read "Newsgroup: " nil nil
+		 (gnus-group-completing-read "Newsgroup" nil
 					     (gnus-read-active-file-p))
 	       "")
 	   gnus-newsgroup-name))
@@ -1028,8 +1028,8 @@ If SILENT, don't prompt the user."
 			 gnus-last-posting-server)
 		    ;; Just use the last value.
 		    gnus-last-posting-server
-		  (completing-read
-		   "Posting method: " method-alist nil t
+		  (gnus-completing-read
+		   "Posting method" (mapcar 'car method-alist) t
 		   (cons (or gnus-last-posting-server "") 0))))
 	  method-alist))))
      ;; Override normal method.
@@ -1487,7 +1487,7 @@ If YANK is non-nil, include the original article."
 (defun gnus-summary-yank-message (buffer n)
   "Yank the current article into a composed message."
   (interactive
-   (list (completing-read "Buffer: " (mapcar 'list (message-buffers)) nil t)
+   (list (gnus-completing-read "Buffer" (message-buffers) t)
 	 current-prefix-arg))
   (gnus-summary-iterate n
     (let ((gnus-inhibit-treatment t))
diff --git a/lisp/gnus-registry.el b/lisp/gnus-registry.el
index a30847b..984890a 100644
--- a/lisp/gnus-registry.el
+++ b/lisp/gnus-registry.el
@@ -857,12 +857,11 @@ Uses `gnus-registry-marks' to find what shortcuts to install."
 
 (defun gnus-registry-read-mark ()
   "Read a mark name from the user with completion."
-  (let ((mark (gnus-completing-read-with-default
-	       (symbol-name gnus-registry-default-mark)
-	       "Label"
-	       (mapcar (lambda (x)	; completion list
-			 (cons (symbol-name (car-safe x)) (car-safe x)))
-		       gnus-registry-marks))))
+  (let ((mark (gnus-completing-read
+               "Label"
+               (mapcar 'symbol-name (mapcar 'car gnus-registry-marks))
+               nil nil nil
+	       (symbol-name gnus-registry-default-mark))))
     (when (stringp mark)
       (intern mark))))
 
diff --git a/lisp/gnus-score.el b/lisp/gnus-score.el
index 03ff30d..26c3ca3 100644
--- a/lisp/gnus-score.el
+++ b/lisp/gnus-score.el
@@ -680,14 +680,14 @@ file for the command instead of the current score file."
 	  (and gnus-extra-headers
 	       (equal (nth 1 entry) "extra")
 	       (intern			; need symbol
-		(gnus-completing-read-with-default
-		 (symbol-name (car gnus-extra-headers))	; default response
-		 "Score extra header"	; prompt
-		 (mapcar (lambda (x)	; completion list
-			   (cons (symbol-name x) x))
-			 gnus-extra-headers)
-		 nil			; no completion limit
-		 t))))			; require match
+                (let ((collection (mapcar 'symbol-name gnus-extra-headers)))
+                  (gnus-completing-read
+                   "Score extra header"  ; prompt
+                   collection            ; completion list
+                   t                     ; require match
+                   nil                   ; no history
+                   nil                   ; no initial-input
+                   (car collection)))))) ; default value
     ;; extra is now nil or a symbol.
 
     ;; We have all the data, so we enter this score.
@@ -913,10 +913,13 @@ MATCH is the string we are looking for.
 TYPE is the score type.
 SCORE is the score to add.
 EXTRA is the possible non-standard header."
-  (interactive (list (completing-read "Header: "
-				      gnus-header-index
-				      (lambda (x) (fboundp (nth 2 x)))
-				      t)
+  (interactive (list (gnus-completing-read "Header"
+                                           (mapcar
+                                            'car
+                                            (remove-if-not
+                                             (lambda (x) (fboundp (nth 2 x)))
+                                             gnus-header-index))
+                                           t)
 		     (read-string "Match: ")
 		     (if (y-or-n-p "Use regexp match? ") 'r 's)
 		     (string-to-number (read-string "Score: "))))
diff --git a/lisp/gnus-srvr.el b/lisp/gnus-srvr.el
index 11164a8..2b13f39 100644
--- a/lisp/gnus-srvr.el
+++ b/lisp/gnus-srvr.el
@@ -571,8 +571,9 @@ The following commands are available:
 
 (defun gnus-server-add-server (how where)
   (interactive
-   (list (intern (completing-read "Server method: "
-				  gnus-valid-select-methods nil t))
+   (list (intern (gnus-completing-read "Server method"
+                                       (mapcar 'car gnus-valid-select-methods)
+                                       t))
 	 (read-string "Server name: ")))
   (when (assq where gnus-server-alist)
     (error "Server with that name already defined"))
@@ -582,7 +583,7 @@ The following commands are available:
 (defun gnus-server-goto-server (server)
   "Jump to a server line."
   (interactive
-   (list (completing-read "Goto server: " gnus-server-alist nil t)))
+   (list (gnus-completing-read "Goto server" (mapcar 'car gnus-server-alist) t)))
   (let ((to (text-property-any (point-min) (point-max)
 			       'gnus-server (intern server))))
     (when to
diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el
index b8b17b3..59b9682 100644
--- a/lisp/gnus-sum.el
+++ b/lisp/gnus-sum.el
@@ -7999,10 +7999,9 @@ If FORCE, go to the article even if it isn't displayed.  If FORCE
 is a number, it is the line the article is to be displayed on."
   (interactive
    (list
-    (completing-read
-     "Article number or Message-ID: "
-     (mapcar (lambda (number) (list (int-to-string number)))
-	     gnus-newsgroup-limit))
+    (gnus-completing-read
+     "Article number or Message-ID"
+     (mapcar 'int-to-string gnus-newsgroup-limit))
     current-prefix-arg
     t))
   (prog1
@@ -8256,16 +8255,13 @@ articles that are younger than AGE days."
   (interactive
    (let ((header
 	  (intern
-	   (gnus-completing-read-with-default
-	    (symbol-name (car gnus-extra-headers))
+	   (gnus-completing-read
 	    (if current-prefix-arg
 		"Exclude extra header"
 	      "Limit extra header")
-	    (mapcar (lambda (x)
-		      (cons (symbol-name x) x))
-		    gnus-extra-headers)
-	    nil
-	    t))))
+	    (mapcar 'symbol-name gnus-extra-headers)
+	    t nil nil
+            (symbol-name (car gnus-extra-headers))))))
      (list header
 	   (read-string (format "%s header %s (regexp): "
 				(if current-prefix-arg "Exclude" "Limit to")
@@ -9234,14 +9230,14 @@ If HEADER is an empty string (or nil), the match is done on the entire
 article.  If BACKWARD (the prefix) is non-nil, search backward instead."
   (interactive
    (list (let ((completion-ignore-case t))
-	   (completing-read
-	    "Header name: "
-	    (mapcar (lambda (header) (list (format "%s" header)))
+	   (gnus-completing-read
+	    "Header name"
+	    (mapcar 'symbol-name
 		    (append
-		     '("Number" "Subject" "From" "Lines" "Date"
-		       "Message-ID" "Xref" "References" "Body")
+		     '(Number Subject From Lines Date
+		       Message-ID Xref References Body)
 		     gnus-extra-headers))
-	    nil 'require-match))
+	    'require-match))
 	 (read-string "Regexp: ")
 	 (read-key-sequence "Command: ")
 	 current-prefix-arg))
@@ -9937,9 +9933,9 @@ latter case, they will be copied into the relevant groups."
 				  (car (gnus-find-method-for-group
 					gnus-newsgroup-name)))))
 		(method
-		 (gnus-completing-read-with-default
-		  methname "Backend to use when respooling"
-		  methods nil t nil 'gnus-mail-method-history))
+		 (gnus-completing-read
+		  "Backend to use when respooling"
+		  methods t nil 'gnus-mail-method-history methname))
 		ms)
 	   (cond
 	    ((zerop (length (setq ms (gnus-servers-using-backend
@@ -9949,7 +9945,7 @@ latter case, they will be copied into the relevant groups."
 	     (car ms))
 	    (t
 	     (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
-	       (cdr (assoc (completing-read "Server name: " ms-alist nil t)
+	       (cdr (assoc (gnus-completing-read "Server name" ms-alist t)
 			   ms-alist))))))))
   (unless method
     (error "No method given for respooling"))
@@ -11921,29 +11917,20 @@ save those articles instead."
 		      (format "these %d articles" (length articles))
 		    "this article")))
 	 (to-newsgroup
-	  (let (active group)
-	    (when (or (null split-name) (= 1 (length split-name)))
-	      (setq active (gnus-make-hashtable (length gnus-active-hashtb)))
-	      (mapatoms (lambda (symbol)
-			  (setq group (symbol-name symbol))
-			  (when (string-match "[^\000-\177]" group)
-			    (setq group (gnus-group-decoded-name group)))
-			  (set (intern group active) group))
-			gnus-active-hashtb))
-	    (cond
-	     ((null split-name)
-	      (gnus-completing-read-with-default
-	       default prom active 'gnus-valid-move-group-p nil prefix
-	       'gnus-group-history))
-	     ((= 1 (length split-name))
-	      (gnus-completing-read-with-default
-	       (car split-name) prom active 'gnus-valid-move-group-p nil nil
-	       'gnus-group-history))
-	     (t
-	      (gnus-completing-read-with-default
-	       nil prom (mapcar 'list (nreverse split-name)) nil nil nil
-	       'gnus-group-history)))))
-	 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
+          (cond
+           ((null split-name)
+            (gnus-group-completing-read
+             prom
+             (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb)
+             nil prefix nil default))
+           ((= 1 (length split-name))
+            (gnus-group-completing-read
+             prom (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb)
+             nil prefix 'gnus-group-history (car split-name)))
+           (t
+            (gnus-completing-read
+             prom (nreverse split-name) nil nil 'gnus-group-history))))
+         (to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
 	 encoded)
     (when to-newsgroup
       (if (or (string= to-newsgroup "")
diff --git a/lisp/gnus-topic.el b/lisp/gnus-topic.el
index 7c71035..b600fac 100644
--- a/lisp/gnus-topic.el
+++ b/lisp/gnus-topic.el
@@ -161,9 +161,7 @@ See Info node `(gnus)Formatting Variables'."
 (defun gnus-topic-jump-to-topic (topic)
   "Go to TOPIC."
   (interactive
-   (list (completing-read "Go to topic: "
-			  (mapcar 'list (gnus-topic-list))
-			  nil t)))
+   (list (gnus-completing-read "Go to topic" (gnus-topic-list) t)))
   (let ((buffer-read-only nil))
     (dolist (topic (gnus-current-topics topic))
       (unless (gnus-topic-goto-topic topic)
@@ -1303,7 +1301,7 @@ When used interactively, PARENT will be the topic under point."
 If COPYP, copy the groups instead."
   (interactive
    (list current-prefix-arg
-	 (gnus-completing-read "Move to topic" gnus-topic-alist nil t
+	 (gnus-completing-read "Move to topic" (mapcar 'car gnus-topic-alist) t
 			       'gnus-topic-history)))
   (let ((use-marked (and (not n) (not (gnus-region-active-p))
 			 gnus-group-marked t))
@@ -1350,7 +1348,7 @@ If COPYP, copy the groups instead."
   "Copy the current group to a topic."
   (interactive
    (list current-prefix-arg
-	 (completing-read "Copy to topic: " gnus-topic-alist nil t)))
+	 (gnus-completing-read "Copy to topic" (mapcar 'car gnus-topic-alist) t)))
   (gnus-topic-move-group n topic t))
 
 (defun gnus-topic-kill-group (&optional n discard)
@@ -1443,7 +1441,8 @@ If PERMANENT, make it stay shown in subsequent sessions as well."
 	(gnus-topic-remove-topic t nil)
       (let ((topic
 	     (gnus-topic-find-topology
-	      (completing-read "Show topic: " gnus-topic-alist nil t))))
+	      (gnus-completing-read "Show topic"
+                                    (mapcar 'car gnus-topic-alist) t))))
 	(setcar (cddr (cadr topic)) nil)
 	(setcar (cdr (cadr topic)) 'visible)
 	(gnus-group-list-groups)))))
@@ -1491,7 +1490,8 @@ If NON-RECURSIVE (which is the prefix) is t, don't unmark its subtopics."
    (let (topic)
      (nreverse
       (list
-       (setq topic (completing-read "Move to topic: " gnus-topic-alist nil t))
+       (setq topic (gnus-completing-read "Move to topic"
+                                         (mapcar 'car gnus-topic-alist) t))
        (read-string (format "Move to %s (regexp): " topic))))))
   (gnus-group-mark-regexp regexp)
   (gnus-topic-move-group nil topic copyp))
@@ -1502,7 +1502,8 @@ If NON-RECURSIVE (which is the prefix) is t, don't unmark its subtopics."
    (let (topic)
      (nreverse
       (list
-       (setq topic (completing-read "Copy to topic: " gnus-topic-alist nil t))
+       (setq topic (gnus-completing-read "Copy to topic"
+                                         (mapcar 'car gnus-topic-alist) t))
        (read-string (format "Copy to %s (regexp): " topic))))))
   (gnus-topic-move-matching regexp topic t))
 
@@ -1723,8 +1724,9 @@ If REVERSE, sort in reverse order."
   "Sort topics in TOPIC alphabetically by topic name.
 If REVERSE, reverse the sorting order."
   (interactive
-   (list (completing-read "Sort topics in : " gnus-topic-alist nil t
-			  (gnus-current-topic))
+   (list (gnus-completing-read "Sort topics in"
+                               (mapcar 'car gnus-topic-alist) t
+                               (gnus-current-topic))
 	 current-prefix-arg))
   (let ((topic-topology (or (and topic (cdr (gnus-topic-find-topology topic)))
 			    gnus-topic-topology)))
@@ -1738,7 +1740,7 @@ If REVERSE, reverse the sorting order."
   (interactive
    (list
     (gnus-group-topic-name)
-    (completing-read "Move to topic: " gnus-topic-alist nil t)))
+    (gnus-completing-read "Move to topic" (mapcar 'car gnus-topic-alist) t)))
   (unless (and current to)
     (error "Can't find topic"))
   (let ((current-top (cdr (gnus-topic-find-topology current)))
diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el
index 5ebccc0..1c390c7 100644
--- a/lisp/gnus-util.el
+++ b/lisp/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,48 @@ 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)
+  (let ((iswitchb-make-buflist-hook
+         (lambda ()
+           (setq iswitchb-temp-buflist
+                 (let ((choices (append (list)
+                                        (when initial-input (list initial-input))
+                                        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)
+  (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)
diff --git a/lisp/gnus.el b/lisp/gnus.el
index dafaafc..c01cd62 100644
--- a/lisp/gnus.el
+++ b/lisp/gnus.el
@@ -4240,9 +4240,9 @@ Allow completion over sensible values."
 		  gnus-predefined-server-alist
 		  gnus-server-alist))
 	 (method
-	  (completing-read
-	   prompt servers
-	   nil t nil 'gnus-method-history)))
+	  (gnus-completing-read
+	   prompt (mapcar 'car servers)
+	   t nil 'gnus-method-history)))
     (cond
      ((equal method "")
       (setq method gnus-select-method))
diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el
index 9b756ed..7562e57 100644
--- a/lisp/mm-decode.el
+++ b/lisp/mm-decode.el
@@ -1323,11 +1323,11 @@ Use CMD as the process."
   "Display HANDLE using METHOD."
   (let* ((type (mm-handle-media-type handle))
 	 (methods
-	  (mapcar (lambda (i) (list (cdr (assoc 'viewer i))))
+	  (mapcar (lambda (i) (cdr (assoc 'viewer i)))
 		  (mailcap-mime-info type 'all)))
 	 (method (let ((minibuffer-local-completion-map
 			mm-viewer-completion-map))
-		   (completing-read "Viewer: " methods))))
+		   (gnus-completing-read "Viewer" methods))))
     (when (string= method "")
       (error "No method given"))
     (if (string-match "^[^% \t]+$" method)
diff --git a/lisp/mm-util.el b/lisp/mm-util.el
index 7f0d338..c408c61 100644
--- a/lisp/mm-util.el
+++ b/lisp/mm-util.el
@@ -68,11 +68,11 @@
       . ,(lambda (prompt)
 	   "Return a charset."
 	   (intern
-	    (completing-read
+	    (gnus-completing-read
 	     prompt
-	     (mapcar (lambda (e) (list (symbol-name (car e))))
+	     (mapcar (lambda (e) (symbol-name (car e)))
 		     mm-mime-mule-charset-alist)
-	     nil t))))
+	     t))))
      ;; `subst-char-in-string' is not available in XEmacs 21.4.
      (subst-char-in-string
       . ,(lambda (from to string &optional inplace)
@@ -281,8 +281,8 @@ to the contents of the accessible portion of the buffer."
 	'read-coding-system))
      (t (lambda (prompt &optional default-coding-system)
 	  "Prompt the user for a coding system."
-	  (completing-read
-	   prompt (mapcar (lambda (s) (list (symbol-name (car s))))
+	  (gnus-completing-read
+	   prompt (mapcar (lambda (s) (symbol-name (car s)))
 			  mm-mime-mule-charset-alist)))))))
 
 (defvar mm-coding-system-list nil)
@@ -316,8 +316,8 @@ the alias.  Else windows-NUMBER is used."
 			 (cp-supported-codepages)
 		       ;; Removed in Emacs 23 (unicode), so signal an error:
 		       (error "`codepage-setup' not present in this Emacs version"))))
-     (list (completing-read "Setup DOS Codepage: (default 437) " candidates
-			    nil t nil nil "437"))))
+     (list (gnus-completing-read "Setup DOS Codepage" candidates
+                                 t nil nil "437"))))
   (when alias
     (setq alias (if (stringp alias)
 		    (intern alias)
diff --git a/lisp/mm-view.el b/lisp/mm-view.el
index 1a2d940..566908c 100644
--- a/lisp/mm-view.el
+++ b/lisp/mm-view.el
@@ -31,6 +31,7 @@
 (require 'mm-decode)
 (require 'smime)
 
+(autoload 'gnus-completing-read "gnus-util")
 (autoload 'gnus-article-prepare-display "gnus-art")
 (autoload 'vcard-parse-string "vcard")
 (autoload 'vcard-format-string "vcard")
@@ -676,11 +677,9 @@
    (if (= (length smime-keys) 1)
        (cadar smime-keys)
      (smime-get-key-by-email
-      (completing-read
-       (concat "Decipher using key"
-	       (if smime-keys (concat "(default " (caar smime-keys) "): ")
-		 ": "))
-       smime-keys nil nil nil nil (car-safe (car-safe smime-keys))))))
+      (gnus-completing-read
+       "Decipher using key"
+       smime-keys nil nil nil (car-safe (car-safe smime-keys))))))
   (goto-char (point-min))
   (while (search-forward "\r\n" nil t)
     (replace-match "\n"))
diff --git a/lisp/mml-smime.el b/lisp/mml-smime.el
index a99538b..62e742f 100644
--- a/lisp/mml-smime.el
+++ b/lisp/mml-smime.el
@@ -161,10 +161,10 @@ Whether the passphrase is cached at all is controlled by
 					     "")))))
 		(and from (smime-get-key-by-email from)))
 	      (smime-get-key-by-email
-	       (completing-read "Sign this part with what signature? "
-				smime-keys nil nil
-				(and (listp (car-safe smime-keys))
-				     (caar smime-keys))))))))
+	       (gnus-completing-read "Sign this part with what signature"
+                                     smime-keys nil nil
+                                     (and (listp (car-safe smime-keys))
+                                          (caar smime-keys))))))))
 
 (defun mml-smime-get-file-cert ()
   (ignore-errors
@@ -213,15 +213,16 @@ Whether the passphrase is cached at all is controlled by
       (quit))
     result))
 
-(autoload 'gnus-completing-read-with-default "gnus-util")
+(autoload 'gnus-completing-read "gnus-util")
 
 (defun mml-smime-openssl-encrypt-query ()
   ;; todo: try dns/ldap automatically first, before prompting user
   (let (certs done)
     (while (not done)
-      (ecase (read (gnus-completing-read-with-default
-		    "ldap" "Fetch certificate from"
-		    '(("dns") ("ldap") ("file")) nil t))
+      (ecase (read (gnus-completing-read
+		    "Fetch certificate from"
+		    '(("dns") ("ldap") ("file")) t nil nil
+                    "ldap"))
 	(dns (setq certs (append certs
 				 (mml-smime-get-dns-cert))))
 	(ldap (setq certs (append certs
diff --git a/lisp/mml.el b/lisp/mml.el
index 15b1bb7..3cf0f37 100644
--- a/lisp/mml.el
+++ b/lisp/mml.el
@@ -40,6 +40,7 @@
 (autoload 'message-make-message-id "message")
 (declare-function gnus-setup-posting-charset "gnus-msg" (group))
 (autoload 'gnus-make-local-hook "gnus-util")
+(autoload 'gnus-completing-read "gnus-util")
 (autoload 'message-fetch-field "message")
 (autoload 'message-mark-active-p "message")
 (autoload 'message-info "message")
@@ -1188,9 +1189,10 @@ If not set, `default-directory' will be used."
 		      ;; looks like, and offer text/plain if it looks
 		      ;; like text/plain.
 		      "application/octet-stream"))
-	 (string (completing-read
-		  (format "Content type (default %s): " default)
-		  (mapcar 'list (mailcap-mime-types)))))
+	 (string (gnus-completing-read
+		  "Content type"
+		  (mailcap-mime-types)
+                  nil nil nil default)))
     (if (not (equal string ""))
 	string
       default)))
@@ -1204,10 +1206,10 @@ If not set, `default-directory' will be used."
 (defun mml-minibuffer-read-disposition (type &optional default filename)
   (unless default
     (setq default (mml-content-disposition type filename)))
-  (let ((disposition (completing-read
-		      (format "Disposition (default %s): " default)
-		      '(("attachment") ("inline") (""))
-		      nil t nil nil default)))
+  (let ((disposition (gnus-completing-read
+		      "Disposition"
+		      '("attachment" "inline")
+		      t nil nil default)))
     (if (not (equal disposition ""))
 	disposition
       default)))
@@ -1395,11 +1397,11 @@ TYPE is the MIME type to use."
 
 (defun mml-insert-multipart (&optional type)
   (interactive (if (message-in-body-p)
-		   (list (completing-read "Multipart type (default mixed): "
-					  '(("mixed") ("alternative")
-					    ("digest") ("parallel")
-					    ("signed") ("encrypted"))
-					  nil nil "mixed"))
+		   (list (gnus-completing-read "Multipart type"
+                                               '("mixed" "alternative"
+                                                 "digest" "parallel"
+                                                 "signed" "encrypted")
+                                               nil "mixed"))
 		 (error "Use this command in the message body")))
   (or type
       (setq type "mixed"))
diff --git a/lisp/nnir.el b/lisp/nnir.el
index db8b397..455a0fd 100644
--- a/lisp/nnir.el
+++ b/lisp/nnir.el
@@ -1588,7 +1588,7 @@ Tested with Namazu 2.0.6 on a GNU/Linux system."
   (let ((sym (car parmspec))
         (prompt (cdr parmspec)))
     (if (listp prompt)
-	(let* ((result (apply 'completing-read prompt))
+	(let* ((result (gnus-completing-read prompt nil))
 	       (mapping (or (assoc result nnir-imap-search-arguments)
 			    (assoc nil nnir-imap-search-arguments))))
 	  (cons sym (format (cdr mapping) result)))
diff --git a/lisp/nnmairix.el b/lisp/nnmairix.el
index bca549a..9672c04 100644
--- a/lisp/nnmairix.el
+++ b/lisp/nnmairix.el
@@ -848,8 +848,8 @@ called interactively, user will be asked for parameters."
 All necessary information will be queried from the user."
   (interactive)
   (let* ((name (read-string "Name of the mairix server: "))
-	(server (completing-read "Back end server (TAB for completion): "
-				 (nnmairix-get-valid-servers) nil 1))
+	(server (gnus-completing-read "Back end server"
+				 (nnmairix-get-valid-servers) t))
 	(mairix (read-string "Command to call mairix: " "mairix"))
 	(defaultgroup (read-string "Default search group: "))
 	(backend (symbol-name (car (gnus-server-to-method server))))
@@ -1165,7 +1165,7 @@ nnmairix server. Only marks from current session will be set."
 If SKIPDEFAULT is t, the default search group will not be
 updated.
 If UPDATEDB is t, database for SERVERNAME will be updated first."
-  (interactive (list (completing-read "Update groups on server: "
+  (interactive (list (gnus-completing-read "Update groups on server"
 				(nnmairix-get-nnmairix-servers))))
   (save-excursion
     (when (string-match ".*:\\(.*\\)" servername)
@@ -1302,7 +1302,7 @@ Otherwise, ask user for server."
 	  (while
 	      (equal '("")
 		  (setq nnmairix-last-server
-			(list (completing-read "Server: " openedserver nil 1
+			(list (gnus-completing-read "Server" openedserver t
 					       (or nnmairix-last-server
 						   "nnmairix:"))))))
 	  nnmairix-last-server)
@@ -1492,10 +1492,10 @@ group."
 	  (when (not found)
 	    (setq mairixserver
 		  (gnus-server-to-method
-		   (completing-read
-		    (format "Cannot determine which nnmairix server indexes %s. Please specify: "
+		   (gnus-completing-read
+		    (format "Cannot determine which nnmairix server indexes %s. Please specify"
 			    (gnus-method-to-server server))
-		    (nnmairix-get-nnmairix-servers) nil nil "nnmairix:")))
+		    (nnmairix-get-nnmairix-servers) nil "nnmairix:")))
 	    ;; Save result in parameter of default search group so that
 	    ;; we don't have to ask again
 	    (setq defaultgroup (gnus-group-prefixed-name
@@ -1643,9 +1643,9 @@ search in raw mode."
 	      (gnus-registry-add-group mid cur)))))
       (if (> (length allgroups) 1)
 	  (setq group
-		(completing-read
-		 "Message exists in more than one group. Choose: "
-		 allgroups nil t))
+		(gnus-completing-read
+		 "Message exists in more than one group. Choose"
+		 allgroups t))
 	(setq group (car allgroups))))
     (if group
 	;; show article in summary buffer
@@ -1748,9 +1748,9 @@ SERVER."
 	     (gnus-group-prefixed-name group (car cur))
 	     allgroups))))
       (if (> (length allgroups) 1)
-	  (setq group (completing-read
-		       "Group %s exists on more than one IMAP server. Choose: "
-		       allgroups nil t))
+	  (setq group (gnus-completing-read
+		       "Group %s exists on more than one IMAP server. Choose"
+		       allgroups t))
 	(setq group (car allgroups))))
     group))
 
diff --git a/lisp/nnrss.el b/lisp/nnrss.el
index 379fee2..8897b37 100644
--- a/lisp/nnrss.el
+++ b/lisp/nnrss.el
@@ -1058,9 +1058,9 @@ whether they are `offsite' or `onsite'."
 				    (cdr (assoc "feedid" listinfo)))))
 			   feedinfo)))
 	      (cdr (assoc
-		    (completing-read
-		     "Multiple feeds found.  Select one: "
-		     selection nil t) urllist)))))))))
+		    (gnus-completing-read
+		     "Multiple feeds found. Select one"
+		     selection t) urllist)))))))))
 
 (defun nnrss-rss-p (data)
   "Test if DATA is an RSS feed.
diff --git a/lisp/smime.el b/lisp/smime.el
index a266819..2492007 100644
--- a/lisp/smime.el
+++ b/lisp/smime.el
@@ -371,12 +371,9 @@ KEYFILE should contain a PEM encoded key and certificate."
 	     (if keyfile
 		 keyfile
 	       (smime-get-key-with-certs-by-email
-		(completing-read
-		 (concat "Sign using key"
-			 (if smime-keys
-			     (concat " (default " (caar smime-keys) "): ")
-			   ": "))
-		 smime-keys nil nil (car-safe (car-safe smime-keys))))))
+		(gnus-completing-read
+		 "Sign using key"
+		 smime-keys nil (car-safe (car-safe smime-keys))))))
       (error "Signing failed"))))
 
 (defun smime-encrypt-buffer (&optional certfiles buffer)
@@ -502,11 +499,9 @@ in the buffer specified by `smime-details-buffer'."
      (expand-file-name
       (or keyfile
 	  (smime-get-key-by-email
-	   (completing-read
-	    (concat "Decipher using key"
-		    (if smime-keys (concat " (default " (caar smime-keys) "): ")
-		      ": "))
-	    smime-keys nil nil (car-safe (car-safe smime-keys)))))))))
+	   (gnus-completing-read
+	    "Decipher using key"
+	    smime-keys nil (car-safe (car-safe smime-keys)))))))))
 
 ;; Various operations
 
@@ -660,6 +655,7 @@ A string or a list of strings is returned."
   (define-key smime-mode-map "f" 'smime-certificate-info))
 
 (autoload 'gnus-run-mode-hooks "gnus-util")
+(autoload 'gnus-completing-read "gnus-util")
 
 (defun smime-mode ()
   "Major mode for browsing, viewing and fetching certificates.
-- 
1.7.1


[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-28 15:35 [PATCH] Introduce gnus-completing-read Julien Danjou
                   ` (2 preceding siblings ...)
  2010-09-28 15:55 ` Dan Christensen
@ 2010-09-28 20:07 ` Ted Zlatanov
  2010-09-28 20:36   ` Julien Danjou
  2010-10-01 15:57 ` Matt Lundin
  4 siblings, 1 reply; 48+ messages in thread
From: Ted Zlatanov @ 2010-09-28 20:07 UTC (permalink / raw)
  To: ding

On Tue, 28 Sep 2010 17:35:53 +0200 Julien Danjou <julien@danjou.info> wrote: 

JD> As promised yesterday, here's my patch!

JD> It adds `gnus-completion-styles' which set `completion-styles' when calling
JD> `completing-read'.

JD> It adds `gnus-use-ido' which makes `gnus-completing-read' use
JD> `ido-completing-read' rather than `completing-read'

JD> It replaces (almost) all occurences of `completing-read' with
JD> `gnus-completing-read', so it works with ido too.

Thanks for the patch, I think it's very useful.  Are there any specific
completion styles and behavior (e.g. `gnus-use-ido') you'd recommend?  I
don't use ido so I don't know how it's useful.  Some documentation would
be helpful, even if minimal, for what your patch does in the manual.  I
think it should go in the Gnus news file, too, because it's a pretty
major change across Gnus.

The default gnus-completion-styles appends 'substring to whatever else
the user has if it's not present (the docstring should reflect that).
Should we add 'partial-completion as well?  Or 'initials?  There seem to
be many places where gnus-completing-read makes sense with a different
completion style from the normal one.

For example the "lower score" command now asks for a series of choices
one by one, which IMO could be better done with completing-read choices.
In that case, 'initials would work well to represent `L s s p' (lower
subject, substring, permanent) as the completion choice
"lower-subject-substring-permanent" that the user can input as `lssp'.

Ted




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-28 20:07 ` Ted Zlatanov
@ 2010-09-28 20:36   ` Julien Danjou
  2010-09-28 21:08     ` Ted Zlatanov
  0 siblings, 1 reply; 48+ messages in thread
From: Julien Danjou @ 2010-09-28 20:36 UTC (permalink / raw)
  To: Ted Zlatanov; +Cc: ding

[-- Attachment #1: Type: text/plain, Size: 1252 bytes --]

On Tue, Sep 28 2010, Ted Zlatanov wrote:

> Thanks for the patch, I think it's very useful.  Are there any specific
> completion styles and behavior (e.g. `gnus-use-ido') you'd recommend?  I
> don't use ido so I don't know how it's useful.  Some documentation would
> be helpful, even if minimal, for what your patch does in the manual.  I
> think it should go in the Gnus news file, too, because it's a pretty
> major change across Gnus.

I'll add that in the manual, for sure.
I use ido for everything, so I can recommend it, but I know people who
do not like it and prefer ibuffer-style shell. Florian Ragwitz patch
will add that too, so… :-)

> The default gnus-completion-styles appends 'substring to whatever else
> the user has if it's not present (the docstring should reflect that).

Good point.

> Should we add 'partial-completion as well?  Or 'initials?  There seem to
> be many places where gnus-completing-read makes sense with a different
> completion style from the normal one.

I'm not against it, but I've a little knowledge of completion-styles, I
just moved existing code in gnus-completing-read, so suggestions are
welcome!

-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-28 19:31     ` Florian Ragwitz
@ 2010-09-28 20:47       ` Julien Danjou
  2010-09-29 15:19         ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 48+ messages in thread
From: Julien Danjou @ 2010-09-28 20:47 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 638 bytes --]

On Tue, Sep 28 2010, Florian Ragwitz wrote:

> Here's a patch adding what I've been talking about on top of your
> patch. Note that gnus-icompleting-read ignores its HISTORY argument. I
> haven't quite figured out how to do that, assuming iswitchb supports
> some sort of history at all. However, it's already useful to me as is,
> as I can make use of all my iswitchb customisations while only missing
> out on a feature I don't particularly care about.

Fine, I've pushed the patch in my jd/gnus-completing-read branch,
waiting to be merged. :-)

-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-28 20:36   ` Julien Danjou
@ 2010-09-28 21:08     ` Ted Zlatanov
  0 siblings, 0 replies; 48+ messages in thread
From: Ted Zlatanov @ 2010-09-28 21:08 UTC (permalink / raw)
  To: ding

On Tue, 28 Sep 2010 22:36:43 +0200 Julien Danjou <julien@danjou.info> wrote: 

JD> On Tue, Sep 28 2010, Ted Zlatanov wrote:
>> Should we add 'partial-completion as well?  Or 'initials?  There seem to
>> be many places where gnus-completing-read makes sense with a different
>> completion style from the normal one.

JD> I'm not against it, but I've a little knowledge of completion-styles, I
JD> just moved existing code in gnus-completing-read, so suggestions are
JD> welcome!

OK, let's get this in first.  I'll look at the completion styles for
score commands eventually; to me that seems like the logical place for
the 'initials completion style.

JD> Fine, I've pushed the patch in my jd/gnus-completing-read branch,
JD> waiting to be merged. :-)

I'm OK with it to be merged.  If anyone objects we can revert it.

Ted




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-28 20:47       ` Julien Danjou
@ 2010-09-29 15:19         ` Lars Magne Ingebrigtsen
  2010-09-29 21:47           ` Lars Magne Ingebrigtsen
  2010-09-30  6:46           ` Reiner Steib
  0 siblings, 2 replies; 48+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-09-29 15:19 UTC (permalink / raw)
  To: ding

Julien Danjou <julien@danjou.info> writes:

> Fine, I've pushed the patch in my jd/gnus-completing-read branch,
> waiting to be merged. :-)

Looks good.  Please merge.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-29 15:19         ` Lars Magne Ingebrigtsen
@ 2010-09-29 21:47           ` Lars Magne Ingebrigtsen
  2010-09-30  8:05             ` Julien Danjou
  2010-09-30  6:46           ` Reiner Steib
  1 sibling, 1 reply; 48+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-09-29 21:47 UTC (permalink / raw)
  To: ding

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Looks good.  Please merge.

One comment -- you're using `remove-if-not', and that's a function from
cl-seq, which we're Not Allowed to use.  Could you rewrite without
calling that function?

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-29 15:19         ` Lars Magne Ingebrigtsen
  2010-09-29 21:47           ` Lars Magne Ingebrigtsen
@ 2010-09-30  6:46           ` Reiner Steib
  2010-09-30 10:23             ` Florian Ragwitz
  1 sibling, 1 reply; 48+ messages in thread
From: Reiner Steib @ 2010-09-30  6:46 UTC (permalink / raw)
  To: ding

On Wed, Sep 29 2010, Lars Magne Ingebrigtsen wrote:

> Julien Danjou <julien@danjou.info> writes:
>
>> Fine, I've pushed the patch in my jd/gnus-completing-read branch,
>> waiting to be merged. :-)
>
> Looks good.  Please merge.

We don't have papers from Florian Ragwitz, AFAICS.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-29 21:47           ` Lars Magne Ingebrigtsen
@ 2010-09-30  8:05             ` Julien Danjou
  2010-09-30  9:42               ` Robert Pluim
  0 siblings, 1 reply; 48+ messages in thread
From: Julien Danjou @ 2010-09-30  8:05 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 337 bytes --]

On Wed, Sep 29 2010, Lars Magne Ingebrigtsen wrote:

> One comment -- you're using `remove-if-not', and that's a function from
> cl-seq, which we're Not Allowed to use.  Could you rewrite without
> calling that function?

AAAAAAAHHHHHHHHHH.

Ok. :(

-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30  8:05             ` Julien Danjou
@ 2010-09-30  9:42               ` Robert Pluim
  2010-09-30  9:56                 ` Julien Danjou
  0 siblings, 1 reply; 48+ messages in thread
From: Robert Pluim @ 2010-09-30  9:42 UTC (permalink / raw)
  To: ding

Julien Danjou <julien@danjou.info> writes:

> On Wed, Sep 29 2010, Lars Magne Ingebrigtsen wrote:
>
>> One comment -- you're using `remove-if-not', and that's a function from
>> cl-seq, which we're Not Allowed to use.  Could you rewrite without
>> calling that function?

I'm getting the following when doing J-a (gnus-agent-add-group) in the
*Group* buffer.

Debugger entered--Lisp error: (wrong-type-argument char-or-string-p t)
  read-from-minibuffer("Add to category: " t #<keymap minibuffer-local-completion-map size 8 0x2f> nil nil nil nil)
  completing-read("Add to category: " ("default") nil nil t nil nil)
  gnus-std-completing-read("Add to category: " ("default") nil t nil nil)
  funcall(gnus-std-completing-read "Add to category: " ("default") nil t nil nil)
  (let ((completion-styles gnus-completion-styles)) (funcall gnus-completing-read-function (concat prompt ... ": ") collection require-match initial-input history def))
  gnus-completing-read("Add to category" ("default") nil t)
  (intern (gnus-completing-read "Add to category" (mapcar ... gnus-category-alist) nil t))
  (list (intern (gnus-completing-read "Add to category" ... nil t)) current-prefix-arg)
  call-interactively(gnus-agent-add-group)
  (dispatch-event "[internal]")

Eyeballing gnus-completing-read suggests the following (untested)

diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el
index 2f9bdd6..e736669 100644
--- a/lisp/gnus-util.el
+++ b/lisp/gnus-util.el
@@ -1633,7 +1633,7 @@ SPEC is a predicate specifier that contains stuff like `or', `and',
      (concat prompt (when def
                       (concat " (default " def ")"))
              ": ")
-     collection require-match initial-input history def)))
+     collection initial-input require-match history def)))
 
 (defun gnus-graphic-display-p ()
   (if (featurep 'xemacs)

Regards

Robert




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30  9:42               ` Robert Pluim
@ 2010-09-30  9:56                 ` Julien Danjou
  0 siblings, 0 replies; 48+ messages in thread
From: Julien Danjou @ 2010-09-30  9:56 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 238 bytes --]

On Thu, Sep 30 2010, Robert Pluim wrote:

> I'm getting the following when doing J-a (gnus-agent-add-group) in the
> *Group* buffer.

I've pushed a fix.

-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30  6:46           ` Reiner Steib
@ 2010-09-30 10:23             ` Florian Ragwitz
  2010-09-30 10:44               ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 48+ messages in thread
From: Florian Ragwitz @ 2010-09-30 10:23 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 552 bytes --]

Reiner Steib <reinersteib+gmane@imap.cc> writes:
> On Wed, Sep 29 2010, Lars Magne Ingebrigtsen wrote:
>
>> Julien Danjou <julien@danjou.info> writes:
>>
>>> Fine, I've pushed the patch in my jd/gnus-completing-read branch,
>>> waiting to be merged. :-)
>>
>> Looks good.  Please merge.
>
> We don't have papers from Florian Ragwitz, AFAICS.

That's right. You might want to roll back the changes I made atop of
Julien's before merging them, and also revert
fc8a05bb16b15558e896c1723684aa5e0b8d06c9 as well as
7dc2bb6839a47d8054c732b607e8affca0e9fc68.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 10:23             ` Florian Ragwitz
@ 2010-09-30 10:44               ` Lars Magne Ingebrigtsen
  2010-09-30 11:33                 ` Florian Ragwitz
  0 siblings, 1 reply; 48+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-09-30 10:44 UTC (permalink / raw)
  To: ding

Florian Ragwitz <rafl@debian.org> writes:

>> We don't have papers from Florian Ragwitz, AFAICS.
>
> That's right. You might want to roll back the changes I made atop of
> Julien's before merging them, and also revert
> fc8a05bb16b15558e896c1723684aa5e0b8d06c9 as well as
> 7dc2bb6839a47d8054c732b607e8affca0e9fc68.

Julien, could you roll back all the code from Florian?

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 10:44               ` Lars Magne Ingebrigtsen
@ 2010-09-30 11:33                 ` Florian Ragwitz
  2010-09-30 11:36                   ` Lars Magne Ingebrigtsen
  2010-09-30 12:13                   ` [PATCH] Introduce gnus-completing-read Štěpán Němec
  0 siblings, 2 replies; 48+ messages in thread
From: Florian Ragwitz @ 2010-09-30 11:33 UTC (permalink / raw)
  To: ding


[-- Attachment #1.1: Type: text/plain, Size: 468 bytes --]

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Florian Ragwitz <rafl@debian.org> writes:
>
>>> We don't have papers from Florian Ragwitz, AFAICS.
>>
>> That's right. You might want to roll back the changes I made atop of
>> Julien's before merging them, and also revert
>> fc8a05bb16b15558e896c1723684aa5e0b8d06c9 as well as
>> 7dc2bb6839a47d8054c732b607e8affca0e9fc68.
>
> Julien, could you roll back all the code from Florian?

Here's a patch to do just that:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: Revert changes by Florian Ragwitz --]
[-- Type: text/x-diff, Size: 2786 bytes --]

From 1d0a5d5ef8b28179b52211ebf93c2b3af27a3ebe Mon Sep 17 00:00:00 2001
From: Florian Ragwitz <rafl@debian.org>
Date: Thu, 30 Sep 2010 13:27:17 +0200
Subject: [PATCH] Revert changes by Florian Ragwitz

He didn't do the require paperwork.

This reverts the commits fc8a05bb16b15558e896c1723684aa5e0b8d06c9.

  "(sieve-manage-default-stream): Make default stream customizable."

and 7dc2bb6839a47d8054c732b607e8affca0e9fc68.

  "Decode URL entities to avoid broken links"

Conflicts:

	lisp/ChangeLog
---
 lisp/ChangeLog       |    9 +++++++++
 lisp/gnus-html.el    |    2 +-
 lisp/sieve-manage.el |    7 +------
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b936ea1..76d7745 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
+2010-09-30  Florian Ragwitz  <rafl@debian.org>
+
+	* sieve-manage.el (sieve-manage-default-stream): Revert
+	"(sieve-manage-default-stream): Make default stream customizable." due
+	to missing paperwork.
+
+	* gnus-html.el (gnus-html-wash-tags): Revert "Decode URL entities to
+	avoid handing broken links to browse-url" due to missing paperwork.
+
 2010-09-30  Julien Danjou  <julien@danjou.info>
 
 	* gnus-agent.el (gnus-agent-add-group): Fix call to
diff --git a/lisp/gnus-html.el b/lisp/gnus-html.el
index 4bac528..587c28e 100644
--- a/lisp/gnus-html.el
+++ b/lisp/gnus-html.el
@@ -286,7 +286,7 @@ Use ALT-TEXT for the image string."
 	  (setq url (match-string 1 parameters))
           (gnus-message 8 "gnus-html-wash-tags: fetching link URL %s" url)
 	  (gnus-article-add-button start end
-				   'browse-url (mm-url-decode-entities-string url)
+				   'browse-url url
 				   url)
 	  (let ((overlay (gnus-make-overlay start end)))
 	    (gnus-overlay-put overlay 'evaporate t)
diff --git a/lisp/sieve-manage.el b/lisp/sieve-manage.el
index 8749864..0f16444 100644
--- a/lisp/sieve-manage.el
+++ b/lisp/sieve-manage.el
@@ -162,12 +162,6 @@ for doing the actual authentication."
   :type 'integer
   :group 'sieve-manage)
 
-(defcustom sieve-manage-default-stream 'network
-  "Default stream type to use for `sieve-manage'.
-Must be a name of a stream in `sieve-manage-stream-alist'."
-  :type 'symbol
-  :group 'sieve-manage)
-
 ;; Internal variables:
 
 (defconst sieve-manage-local-variables '(sieve-manage-server
@@ -180,6 +174,7 @@ Must be a name of a stream in `sieve-manage-stream-alist'."
 					 sieve-manage-client-eol
 					 sieve-manage-server-eol
 					 sieve-manage-capability))
+(defconst sieve-manage-default-stream 'network)
 (defconst sieve-manage-coding-system-for-read 'binary)
 (defconst sieve-manage-coding-system-for-write 'binary)
 (defvar sieve-manage-stream nil)
-- 
1.7.1


[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 11:33                 ` Florian Ragwitz
@ 2010-09-30 11:36                   ` Lars Magne Ingebrigtsen
  2010-09-30 11:42                     ` Florian Ragwitz
  2010-09-30 12:13                   ` [PATCH] Introduce gnus-completing-read Štěpán Němec
  1 sibling, 1 reply; 48+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-09-30 11:36 UTC (permalink / raw)
  To: ding

Florian Ragwitz <rafl@debian.org> writes:

>> Julien, could you roll back all the code from Florian?
>
> Here's a patch to do just that:

Hm...  that's less than ten lines in total, so I think that should be
OK.  We only have to mark the change as (tiny change) in the ChangeLog.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 11:36                   ` Lars Magne Ingebrigtsen
@ 2010-09-30 11:42                     ` Florian Ragwitz
  2010-09-30 12:20                       ` Julien Danjou
  0 siblings, 1 reply; 48+ messages in thread
From: Florian Ragwitz @ 2010-09-30 11:42 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 712 bytes --]

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Florian Ragwitz <rafl@debian.org> writes:
>
>>> Julien, could you roll back all the code from Florian?
>>
>> Here's a patch to do just that:
>
> Hm...  that's less than ten lines in total, so I think that should be
> OK.  We only have to mark the change as (tiny change) in the
> ChangeLog.

Actually, there's also the change this thread was about. I didn't
realise it was merged already and forgot to include it in the
revert. Sorry about that.

Unfortunately, that change isn't as easy to revert as the other ones,
due to the changes that are already based upon it, so it requires some
manual merging. If necessary, I can submit a patch doing that tomorrow.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 11:33                 ` Florian Ragwitz
  2010-09-30 11:36                   ` Lars Magne Ingebrigtsen
@ 2010-09-30 12:13                   ` Štěpán Němec
  1 sibling, 0 replies; 48+ messages in thread
From: Štěpán Němec @ 2010-09-30 12:13 UTC (permalink / raw)
  To: ding

Florian Ragwitz <rafl@debian.org> writes:

> From 1d0a5d5ef8b28179b52211ebf93c2b3af27a3ebe Mon Sep 17 00:00:00 2001
> From: Florian Ragwitz <rafl@debian.org>
> Date: Thu, 30 Sep 2010 13:27:17 +0200
> Subject: [PATCH] Revert changes by Florian Ragwitz
>
> He didn't do the require paperwork.
>
> This reverts the commits fc8a05bb16b15558e896c1723684aa5e0b8d06c9.
>
>   "(sieve-manage-default-stream): Make default stream customizable."
>
> and 7dc2bb6839a47d8054c732b607e8affca0e9fc68.
>
>   "Decode URL entities to avoid broken links"
>
> Conflicts:
>
> 	lisp/ChangeLog
> ---
>  lisp/ChangeLog       |    9 +++++++++
>  lisp/gnus-html.el    |    2 +-
>  lisp/sieve-manage.el |    7 +------
>  3 files changed, 11 insertions(+), 7 deletions(-)

Actually, if it's only this much, you can just add `(tiny change)' to
the change log and be done with it.

Štěpán



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 11:42                     ` Florian Ragwitz
@ 2010-09-30 12:20                       ` Julien Danjou
  2010-09-30 12:54                         ` Florian Ragwitz
  0 siblings, 1 reply; 48+ messages in thread
From: Julien Danjou @ 2010-09-30 12:20 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 392 bytes --]

On Thu, Sep 30 2010, Florian Ragwitz wrote:

> Unfortunately, that change isn't as easy to revert as the other ones,
> due to the changes that are already based upon it, so it requires some
> manual merging. If necessary, I can submit a patch doing that
> tomorrow.

Florian, couldn't you sign the paper?

-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 12:20                       ` Julien Danjou
@ 2010-09-30 12:54                         ` Florian Ragwitz
  2010-09-30 13:29                           ` Julien Danjou
                                             ` (2 more replies)
  0 siblings, 3 replies; 48+ messages in thread
From: Florian Ragwitz @ 2010-09-30 12:54 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 998 bytes --]

Julien Danjou <julien@danjou.info> writes:

> On Thu, Sep 30 2010, Florian Ragwitz wrote:
>
>> Unfortunately, that change isn't as easy to revert as the other ones,
>> due to the changes that are already based upon it, so it requires some
>> manual merging. If necessary, I can submit a patch doing that
>> tomorrow.
>
> Florian, couldn't you sign the paper?

While I entirely don't mind copyright assignment, the forth and back via
snail mail isn't at all convenient for me, sorry.

While I knew copyright assignment was required for contributing to Emacs
itself as well as various other GNU projects, I didn't realise this was
also required for Gnus. I apologise for any inconvenience I might have
caused.

However, I do intend to properly clean up after myself and revert all my
changes, assuming a patch doing that could actually be applied without
me doing pesky paperwork first. I'd be quite happy to not submit a patch
reverting things if someone also declared 29395112 as a trivial change.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 12:54                         ` Florian Ragwitz
@ 2010-09-30 13:29                           ` Julien Danjou
  2010-09-30 16:33                           ` Lars Magne Ingebrigtsen
  2010-10-01  6:17                           ` Copyright assignments, policies, conventions (was: [PATCH] Introduce gnus-completing-read) Reiner Steib
  2 siblings, 0 replies; 48+ messages in thread
From: Julien Danjou @ 2010-09-30 13:29 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

On Thu, Sep 30 2010, Florian Ragwitz wrote:

> However, I do intend to properly clean up after myself and revert all my
> changes, assuming a patch doing that could actually be applied without
> me doing pesky paperwork first. I'd be quite happy to not submit a patch
> reverting things if someone also declared 29395112 as a trivial change.

Me neither. I do not see the point of reverting and then getting me
rewriting the same code… :)

-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 12:54                         ` Florian Ragwitz
  2010-09-30 13:29                           ` Julien Danjou
@ 2010-09-30 16:33                           ` Lars Magne Ingebrigtsen
  2010-09-30 16:48                             ` Ted Zlatanov
  2010-10-01  6:17                           ` Copyright assignments, policies, conventions (was: [PATCH] Introduce gnus-completing-read) Reiner Steib
  2 siblings, 1 reply; 48+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-09-30 16:33 UTC (permalink / raw)
  To: ding

Florian Ragwitz <rafl@debian.org> writes:

> However, I do intend to properly clean up after myself and revert all my
> changes, assuming a patch doing that could actually be applied without
> me doing pesky paperwork first. I'd be quite happy to not submit a patch
> reverting things if someone also declared 29395112 as a trivial change.

If there are more than ten lines of code, then it can't be counted as a
(tiny change), and we need to revert it.  If it is, could you create a
patch to revert those lines?

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 16:33                           ` Lars Magne Ingebrigtsen
@ 2010-09-30 16:48                             ` Ted Zlatanov
  2010-09-30 16:55                               ` Lars Magne Ingebrigtsen
  2010-09-30 17:06                               ` Florian Ragwitz
  0 siblings, 2 replies; 48+ messages in thread
From: Ted Zlatanov @ 2010-09-30 16:48 UTC (permalink / raw)
  To: ding

On Thu, 30 Sep 2010 18:33:44 +0200 Lars Magne Ingebrigtsen <larsi@gnus.org> wrote: 

LMI> Florian Ragwitz <rafl@debian.org> writes:
>> However, I do intend to properly clean up after myself and revert all my
>> changes, assuming a patch doing that could actually be applied without
>> me doing pesky paperwork first. I'd be quite happy to not submit a patch
>> reverting things if someone also declared 29395112 as a trivial change.

LMI> If there are more than ten lines of code, then it can't be counted as a
LMI> (tiny change), and we need to revert it.  If it is, could you create a
LMI> patch to revert those lines?

The biggest chunk of the patch are these three functions.  The two
wrappers are trivially rewritten.  `gnus-icompleting-read' can be
rewritten pretty easily; I think the main portion (the lambda) can be
rewritten as:

...
  (let ((iswitchb-make-buflist-hook
         (lambda ()
           (setq iswitchb-temp-buflist
                 (let ((choices (append
                                 (when initial-input (list initial-input))
                                 history collection))
                       filtered-choices)
                   (dolist (x choices)
                     (setq filtered-choices (adjoin x filtered-choices)))
                   (nreverse filtered-choices))))))
...

Which is inspired by the original patch but not a copy (Florian, can you
check for correctness?).  If that's reasonable I can rewrite more, as
much as needed to make the remainder trivial.

This did make me wish for a "collect unique x" option for the CL loop :)

Ted

(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)
  (let ((iswitchb-make-buflist-hook
         (lambda ()
           (setq iswitchb-temp-buflist
                 (let ((choices (append (list)
                                        (when initial-input (list initial-input))
                                        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)
  (ido-completing-read prompt collection nil require-match
                       initial-input history def))




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 16:48                             ` Ted Zlatanov
@ 2010-09-30 16:55                               ` Lars Magne Ingebrigtsen
  2010-09-30 17:13                                 ` Ted Zlatanov
  2010-09-30 17:06                               ` Florian Ragwitz
  1 sibling, 1 reply; 48+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-09-30 16:55 UTC (permalink / raw)
  To: ding

Ted Zlatanov <tzz@lifelogs.com> writes:

> This did make me wish for a "collect unique x" option for the CL loop :)

Yeah, that's be nice, but then you'd have to have a :key and :test
argument, too.  :-)

collect unique :key #'cadr :test #'equalp x

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 16:48                             ` Ted Zlatanov
  2010-09-30 16:55                               ` Lars Magne Ingebrigtsen
@ 2010-09-30 17:06                               ` Florian Ragwitz
  1 sibling, 0 replies; 48+ messages in thread
From: Florian Ragwitz @ 2010-09-30 17:06 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 1763 bytes --]

Ted Zlatanov <tzz@lifelogs.com> writes:

> On Thu, 30 Sep 2010 18:33:44 +0200 Lars Magne Ingebrigtsen <larsi@gnus.org> wrote:
>
> LMI> If there are more than ten lines of code, then it can't be counted as a
> LMI> (tiny change), and we need to revert it.  If it is, could you create a
> LMI> patch to revert those lines?
>
> The biggest chunk of the patch are these three functions.  The two
> wrappers are trivially rewritten.  `gnus-icompleting-read' can be
> rewritten pretty easily; I think the main portion (the lambda) can be
> rewritten as:
>
> ...
>   (let ((iswitchb-make-buflist-hook
>          (lambda ()
>            (setq iswitchb-temp-buflist
>                  (let ((choices (append
>                                  (when initial-input (list initial-input))
>                                  history collection))
>                        filtered-choices)
>                    (dolist (x choices)
>                      (setq filtered-choices (adjoin x filtered-choices)))
>                    (nreverse filtered-choices))))))
> ...
>
> Which is inspired by the original patch but not a copy (Florian, can you
> check for correctness?).  If that's reasonable I can rewrite more, as
> much as needed to make the remainder trivial.

This appears to be as correct as my initial version of it. However,
Julien made some follow-up changes to it, fixing a bug regarding
handling of history. Your version makes the same mistake I initially
did. Julien's fix needs to be adapted for the new code.

> This did make me wish for a "collect unique x" option for the CL loop
> :)

That'd be nice, but with cl, there's also `remove-duplicates'. Without
cl, the following is probably much more elegant than the original patch:

  (delq nil (delete-dups ...))

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 16:55                               ` Lars Magne Ingebrigtsen
@ 2010-09-30 17:13                                 ` Ted Zlatanov
  2010-09-30 17:22                                   ` Florian Ragwitz
  0 siblings, 1 reply; 48+ messages in thread
From: Ted Zlatanov @ 2010-09-30 17:13 UTC (permalink / raw)
  To: ding

On Thu, 30 Sep 2010 18:55:49 +0200 Lars Magne Ingebrigtsen <larsi@gnus.org> wrote: 

LMI> Ted Zlatanov <tzz@lifelogs.com> writes:
>> This did make me wish for a "collect unique x" option for the CL loop :)

LMI> Yeah, that's be nice, but then you'd have to have a :key and :test
LMI> argument, too.  :-)

LMI> collect unique :key #'cadr :test #'equalp x

Heh, yeah.  Oh well.

On Thu, 30 Sep 2010 19:06:08 +0200 Florian Ragwitz <rafl@debian.org> wrote: 

FR> This appears to be as correct as my initial version of it. However,
FR> Julien made some follow-up changes to it, fixing a bug regarding
FR> handling of history. Your version makes the same mistake I initially
FR> did. Julien's fix needs to be adapted for the new code.

I just looked at the rev ID you mentioned.  Argh.  Anyhow, the point was
that it's just a small rewrite to make your patch trivial.  Julien may
be the best person to do it to ensure it's not accidentally broken, but
I'll do it if he doesn't have the time.

I *think* that's within the spirit of the GNU project, especially since
you (Florian) are OK with the rewrite.

>> This did make me wish for a "collect unique x" option for the CL loop
>> :)

FR> That'd be nice, but with cl, there's also `remove-duplicates'. Without
FR> cl, the following is probably much more elegant than the original patch:

FR>   (delq nil (delete-dups ...))

Yeah, that is nicer, but I somehow always find the CL constructs
neater.

Ted




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 17:13                                 ` Ted Zlatanov
@ 2010-09-30 17:22                                   ` Florian Ragwitz
  2010-09-30 17:39                                     ` Lars Magne Ingebrigtsen
  2010-09-30 17:47                                     ` Ted Zlatanov
  0 siblings, 2 replies; 48+ messages in thread
From: Florian Ragwitz @ 2010-09-30 17:22 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 1082 bytes --]

Ted Zlatanov <tzz@lifelogs.com> writes:

> On Thu, 30 Sep 2010 19:06:08 +0200 Florian Ragwitz <rafl@debian.org> wrote:
>
> FR> This appears to be as correct as my initial version of it. However,
> FR> Julien made some follow-up changes to it, fixing a bug regarding
> FR> handling of history. Your version makes the same mistake I initially
> FR> did. Julien's fix needs to be adapted for the new code.
>
> I just looked at the rev ID you mentioned.  Argh.  Anyhow, the point was
> that it's just a small rewrite to make your patch trivial.  Julien may
> be the best person to do it to ensure it's not accidentally broken, but
> I'll do it if he doesn't have the time.
>
> I *think* that's within the spirit of the GNU project, especially since
> you (Florian) are OK with the rewrite.

Absolutely. I'd rather have another patch by someone else, achieving the
same thing as the original patch, than no patch at all.

(Well, actually I'd much rather have contributing be easy, fun, and
encouraging more contributions, but short of that, the above appears to
be the next best thing.)

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 17:22                                   ` Florian Ragwitz
@ 2010-09-30 17:39                                     ` Lars Magne Ingebrigtsen
  2010-09-30 17:41                                       ` Florian Ragwitz
  2010-09-30 17:47                                     ` Ted Zlatanov
  1 sibling, 1 reply; 48+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-09-30 17:39 UTC (permalink / raw)
  To: ding

Florian Ragwitz <rafl@debian.org> writes:

> (Well, actually I'd much rather have contributing be easy, fun, and
> encouraging more contributions, but short of that, the above appears to
> be the next best thing.)

I think the thing to do is to first have a patch that removes all your
code, and then we'll take it from there.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 17:39                                     ` Lars Magne Ingebrigtsen
@ 2010-09-30 17:41                                       ` Florian Ragwitz
  2010-09-30 17:49                                         ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 48+ messages in thread
From: Florian Ragwitz @ 2010-09-30 17:41 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 473 bytes --]

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Florian Ragwitz <rafl@debian.org> writes:
>
>> (Well, actually I'd much rather have contributing be easy, fun, and
>> encouraging more contributions, but short of that, the above appears
>> to be the next best thing.)
>
> I think the thing to do is to first have a patch that removes all your
> code, and then we'll take it from there.

If I made such a patch, which I'll be happy to do, will you be allowed
to apply it?

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 17:22                                   ` Florian Ragwitz
  2010-09-30 17:39                                     ` Lars Magne Ingebrigtsen
@ 2010-09-30 17:47                                     ` Ted Zlatanov
  2010-10-01  9:00                                       ` Julien Danjou
  1 sibling, 1 reply; 48+ messages in thread
From: Ted Zlatanov @ 2010-09-30 17:47 UTC (permalink / raw)
  To: ding

On Thu, 30 Sep 2010 19:22:42 +0200 Florian Ragwitz <rafl@debian.org> wrote: 

FR> Ted Zlatanov <tzz@lifelogs.com> writes:
>> On Thu, 30 Sep 2010 19:06:08 +0200 Florian Ragwitz <rafl@debian.org> wrote:
>> 
FR> This appears to be as correct as my initial version of it. However,
FR> Julien made some follow-up changes to it, fixing a bug regarding
FR> handling of history. Your version makes the same mistake I initially
FR> did. Julien's fix needs to be adapted for the new code.
>> 
>> I just looked at the rev ID you mentioned.  Argh.  Anyhow, the point was
>> that it's just a small rewrite to make your patch trivial.  Julien may
>> be the best person to do it to ensure it's not accidentally broken, but
>> I'll do it if he doesn't have the time.
>> 
>> I *think* that's within the spirit of the GNU project, especially since
>> you (Florian) are OK with the rewrite.

FR> Absolutely. I'd rather have another patch by someone else, achieving the
FR> same thing as the original patch, than no patch at all.

OK, I'll wait for Julien to tell me if he wants to do it himself.

FR> (Well, actually I'd much rather have contributing be easy, fun, and
FR> encouraging more contributions, but short of that, the above appears to
FR> be the next best thing.)

We try to please, here at the Gnus Towers :)

Ted




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 17:41                                       ` Florian Ragwitz
@ 2010-09-30 17:49                                         ` Lars Magne Ingebrigtsen
  2010-10-01  1:01                                           ` Florian Ragwitz
  0 siblings, 1 reply; 48+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-09-30 17:49 UTC (permalink / raw)
  To: ding

Florian Ragwitz <rafl@debian.org> writes:

> If I made such a patch, which I'll be happy to do, will you be allowed
> to apply it?

Yes.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 17:49                                         ` Lars Magne Ingebrigtsen
@ 2010-10-01  1:01                                           ` Florian Ragwitz
  2010-10-01  9:43                                             ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 48+ messages in thread
From: Florian Ragwitz @ 2010-10-01  1:01 UTC (permalink / raw)
  To: ding


[-- Attachment #1.1: Type: text/plain, Size: 214 bytes --]

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Florian Ragwitz <rafl@debian.org> writes:
>
>> If I made such a patch, which I'll be happy to do, will you be allowed
>> to apply it?
>
> Yes.  :-)

Here it is.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: Revert changes by Florian Ragwitz --]
[-- Type: text/x-diff, Size: 7777 bytes --]

From 4f911174b2956ee532502a6139cb0d450a3564ef Mon Sep 17 00:00:00 2001
From: Florian Ragwitz <rafl@debian.org>
Date: Fri, 1 Oct 2010 02:48:42 +0200
Subject: [PATCH] Revert changes by Florian Ragwitz

He didn't do the required paperwork.

This reverts the commits 7dc2bb6839a47d8054c732b607e8affca0e9fc68,

  "Decode URL entities to avoid broken links"

fc8a05bb16b15558e896c1723684aa5e0b8d06c9,

  "(sieve-manage-default-stream): Make default stream customizable."

defbfad6913b5077f97df1382534d5b48edbd5b8,

  "Add requires and fix history for iswitchb"

and 29395112826e19380dccb5270c7b5f3b471ecaa9.

  "Make completing-read function configurable"

Conflicts:

	lisp/ChangeLog
---
 lisp/ChangeLog       |   29 +++++++++++++++++++++++++
 lisp/gnus-html.el    |    2 +-
 lisp/gnus-util.el    |   58 ++++++++-----------------------------------------
 lisp/sieve-manage.el |    7 +-----
 4 files changed, 41 insertions(+), 55 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1772fff..a68ee07 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,32 @@
+2010-10-01  Florian Ragwitz  <rafl@debian.org>
+
+	* gnus-util.el (gnus-use-ido): Revert "Removed." due to missing
+	paperwork.
+	(gnus-std-completing-read): Revert "Add wrapper around
+	completing-read." due to missing paperwork.
+	(gnus-icompleting-read): Revert "Add wrapper around
+	ibuffer-read-buffer." due to missing paperwork.
+	(gnus-ido-completing-read): Revert "Add wrapper around
+	ido-completing-read." due to missing paperwork.
+	(gnus-completing-read-function): Revert "Add to chose from the above
+	completion functions or to provide a custom one." due to missing
+	paperwork.
+	(gnus-completing-read): Revert "Use the completing-read function
+	configured with gnus-completing-read-function." due to missing
+	paperwork.
+
+	* gnus-util.el (gnus-icompleting-read): Revert "Require iswitchb. Fix
+	history computing." which was depending on a patch with missing
+	paperwork.
+	(gnus-ido-completing-read): Revert "Require ido." which was depending
+	on a patch with missing paperwork.
+
+	* sieve-manage.el (sieve-manage-default-stream): Revert "Make default
+	stream customizable." due to missing paperwork.
+
+	* gnus-html.el (gnus-html-wash-tags): Revert "Decode URL entities to
+	avoid handing broken links to browse-url." due to missing paperwork.
+
 2010-09-30  Teodor Zlatanov  <tzz@lifelogs.com>
 
 	* gnus-registry.el (gnus-registry-install-nnregistry): New function to
diff --git a/lisp/gnus-html.el b/lisp/gnus-html.el
index 4bac528..587c28e 100644
--- a/lisp/gnus-html.el
+++ b/lisp/gnus-html.el
@@ -286,7 +286,7 @@ Use ALT-TEXT for the image string."
 	  (setq url (match-string 1 parameters))
           (gnus-message 8 "gnus-html-wash-tags: fetching link URL %s" url)
 	  (gnus-article-add-button start end
-				   'browse-url (mm-url-decode-entities-string url)
+				   'browse-url url
 				   url)
 	  (let ((overlay (gnus-make-overlay start end)))
 	    (gnus-overlay-put overlay 'evaporate t)
diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el
index 2f9bdd6..d188eba 100644
--- a/lisp/gnus-util.el
+++ b/lisp/gnus-util.el
@@ -44,18 +44,11 @@
     (defmacro with-no-warnings (&rest body)
       `(progn ,@body))))
 
-(defcustom gnus-completing-read-function
-  #'gnus-std-completing-read
-  "Function to do a completing read."
+(defcustom gnus-use-ido nil
+  "Whether to use `ido' for `completing-read'."
+  :version "24.1"
   :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)))
+  :type 'boolean)
 
 (defcustom gnus-completion-styles
   (if (and (boundp 'completion-styles-alist)
@@ -1590,50 +1583,19 @@ 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-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'."
+  "Call `completing-read' or `ido-completing-read'.
+Depends on `gnus-use-ido'."
   (let ((completion-styles gnus-completion-styles))
     (funcall
-     gnus-completing-read-function
+     (if gnus-use-ido
+         'ido-completing-read
+       'completing-read)
      (concat prompt (when def
                       (concat " (default " def ")"))
              ": ")
-     collection require-match initial-input history def)))
+     collection nil require-match initial-input history def)))
 
 (defun gnus-graphic-display-p ()
   (if (featurep 'xemacs)
diff --git a/lisp/sieve-manage.el b/lisp/sieve-manage.el
index 8749864..0f16444 100644
--- a/lisp/sieve-manage.el
+++ b/lisp/sieve-manage.el
@@ -162,12 +162,6 @@ for doing the actual authentication."
   :type 'integer
   :group 'sieve-manage)
 
-(defcustom sieve-manage-default-stream 'network
-  "Default stream type to use for `sieve-manage'.
-Must be a name of a stream in `sieve-manage-stream-alist'."
-  :type 'symbol
-  :group 'sieve-manage)
-
 ;; Internal variables:
 
 (defconst sieve-manage-local-variables '(sieve-manage-server
@@ -180,6 +174,7 @@ Must be a name of a stream in `sieve-manage-stream-alist'."
 					 sieve-manage-client-eol
 					 sieve-manage-server-eol
 					 sieve-manage-capability))
+(defconst sieve-manage-default-stream 'network)
 (defconst sieve-manage-coding-system-for-read 'binary)
 (defconst sieve-manage-coding-system-for-write 'binary)
 (defvar sieve-manage-stream nil)
-- 
1.7.1


[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Copyright assignments, policies, conventions (was: [PATCH] Introduce gnus-completing-read)
  2010-09-30 12:54                         ` Florian Ragwitz
  2010-09-30 13:29                           ` Julien Danjou
  2010-09-30 16:33                           ` Lars Magne Ingebrigtsen
@ 2010-10-01  6:17                           ` Reiner Steib
  2010-10-01 13:51                             ` Copyright assignments, policies, conventions Štěpán Němec
  2 siblings, 1 reply; 48+ messages in thread
From: Reiner Steib @ 2010-10-01  6:17 UTC (permalink / raw)
  To: ding

On Thu, Sep 30 2010, Florian Ragwitz wrote:

> Julien Danjou <julien@danjou.info> writes:
[...]
>> Florian, couldn't you sign the paper?
>
> While I entirely don't mind copyright assignment, the forth and back via
> snail mail isn't at all convenient for me, sorry.

You only need to send _one_ snail mail.

> While I knew copyright assignment was required for contributing to Emacs
> itself as well as various other GNU projects, I didn't realise this was
> also required for Gnus. 

As Gnus is part of Emacs, we have the same rules.

> I apologise for any inconvenience I might have caused.

Well, it was not your fault, IMHO.

Ted, Lars: Please make sure that committers are aware of the most
important policies and conventions for Emacs before giving write
access (etc/CONTRIBUTE and some files from admin/notes/ in the Emacs
repository come to my mind).

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-30 17:47                                     ` Ted Zlatanov
@ 2010-10-01  9:00                                       ` Julien Danjou
  0 siblings, 0 replies; 48+ messages in thread
From: Julien Danjou @ 2010-10-01  9:00 UTC (permalink / raw)
  To: Ted Zlatanov; +Cc: ding

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

On Thu, Sep 30 2010, Ted Zlatanov wrote:

> OK, I'll wait for Julien to tell me if he wants to do it himself.

If you have the patch ready, please go ahead.

Applyting the revert and the new patch has the same time would be great.
If you want I can do that at least, just send me both patches, I'll test
and push them altogether so nobody will notice the change.

-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-10-01  1:01                                           ` Florian Ragwitz
@ 2010-10-01  9:43                                             ` Lars Magne Ingebrigtsen
  2010-10-01 10:13                                               ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 48+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-10-01  9:43 UTC (permalink / raw)
  To: ding

Florian Ragwitz <rafl@debian.org> writes:

> Here it is.

Thanks.  I've now applied it, but I had to revert one of Katsumi's later
patches to get it to apply.  So I'll re-apply Katsumi's patch later today.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-10-01  9:43                                             ` Lars Magne Ingebrigtsen
@ 2010-10-01 10:13                                               ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 48+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-10-01 10:13 UTC (permalink / raw)
  To: ding

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Thanks.  I've now applied it, but I had to revert one of Katsumi's later
> patches to get it to apply.  So I'll re-apply Katsumi's patch later today.

I've now re-applied the things that were possibly relevant, so now
people can start working on the code again and fix anything that doesn't
work.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Copyright assignments, policies, conventions
  2010-10-01  6:17                           ` Copyright assignments, policies, conventions (was: [PATCH] Introduce gnus-completing-read) Reiner Steib
@ 2010-10-01 13:51                             ` Štěpán Němec
  0 siblings, 0 replies; 48+ messages in thread
From: Štěpán Němec @ 2010-10-01 13:51 UTC (permalink / raw)
  To: ding

Reiner Steib <reinersteib+gmane@imap.cc> writes:

> On Thu, Sep 30 2010, Florian Ragwitz wrote:
>
>> Julien Danjou <julien@danjou.info> writes:
> [...]
>>> Florian, couldn't you sign the paper?
>>
>> While I entirely don't mind copyright assignment, the forth and back via
>> snail mail isn't at all convenient for me, sorry.
>
> You only need to send _one_ snail mail.

But you're corresponsible for at least _two_ snail mails for every four
GNU projects[1] to which you happen to contribute what's
"copyright-significant" in FSF/GNU-speak, so Florian's description
("forth and back") is correct AFAIK.

Štěpán

[1] Most people are probably (unfortunately) OK with doing that for each
of them, but according to the FSF copyright clerk you're allowed to sign
for up to 4 projects at once.



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-09-28 15:35 [PATCH] Introduce gnus-completing-read Julien Danjou
                   ` (3 preceding siblings ...)
  2010-09-28 20:07 ` Ted Zlatanov
@ 2010-10-01 15:57 ` Matt Lundin
  2010-10-01 18:21   ` Lars Magne Ingebrigtsen
  4 siblings, 1 reply; 48+ messages in thread
From: Matt Lundin @ 2010-10-01 15:57 UTC (permalink / raw)
  To: ding

Julien Danjou <julien@danjou.info> writes:
>
> As promised yesterday, here's my patch!
>
> It adds `gnus-completion-styles' which set `completion-styles' when calling
> `completing-read'.

With these changes I find that gnus-group-jump-to-group no longer works
when jumping to a group that:

1) is on my primary select-method server
2) that is subscribed

Here is my primary select method:

  (setq gnus-select-method 
	'(nntp "news.gmane.org"))

When I try to jump to a group that is subscribed, say
gmane.emacs.gnus.general, I get the following error:

,----
| Debugger entered--Lisp error: (void-variable gmane\.emacs\.gnus\.general)
|   gnus-group-completing-read(nil nil nil nil)
|   (list (gnus-group-completing-read nil nil (gnus-read-active-file-p) (if current-prefix-arg (cdr (assq current-prefix-arg gnus-group-jump-to-group-prompt)) (or (and (stringp gnus-group-jump-to-group-prompt) gnus-group-jump-to-group-prompt) (let ((p (cdr ...))) (and (stringp p) p))))))
|   call-interactively(gnus-group-jump-to-group)
|   my-gnus-goto-topic-or-group()
|   call-interactively(my-gnus-goto-topic-or-group nil nil)
`----

This does not happen for groups on other servers. E.g.,...

M-x gnus-group-jump-to-group [RET] nnshimbun+nytimes:homepage

...takes me directly to that group.

Strangely, jumping to an unsubscribed/zombie group on the primary server
also works.

Thanks,
Matt




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-10-01 15:57 ` Matt Lundin
@ 2010-10-01 18:21   ` Lars Magne Ingebrigtsen
  2010-10-01 23:45     ` Matt Lundin
  0 siblings, 1 reply; 48+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-10-01 18:21 UTC (permalink / raw)
  To: ding

Matt Lundin <mdl@imapmail.org> writes:

> With these changes I find that gnus-group-jump-to-group no longer works
> when jumping to a group that:
>
> 1) is on my primary select-method server
> 2) that is subscribed

Ok; fixed and pushed.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-10-01 18:21   ` Lars Magne Ingebrigtsen
@ 2010-10-01 23:45     ` Matt Lundin
  2010-10-02  2:21       ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 48+ messages in thread
From: Matt Lundin @ 2010-10-01 23:45 UTC (permalink / raw)
  To: ding

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Matt Lundin <mdl@imapmail.org> writes:
>
>> With these changes I find that gnus-group-jump-to-group no longer works
>> when jumping to a group that:
>>
>> 1) is on my primary select-method server
>> 2) that is subscribed
>
> Ok; fixed and pushed.

Thanks. Jumping to a group works fine now. 

I've discovered another small bug in the new gnus-completing-read setup.

When trying to invoke gnus-topic-move-group, I get the following error:

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument stringp gnus-topic-history)
  ad-Orig-completing-read("Move to topic: " ("gadgets" "tex" "emacs" "orgmode" "computers" "news" "jobs" "productivity" "gnus" "politics" "diy" "arch" "ideas" "linux" "money" "blogs" "magazines" "data" "digital-humanities" "coding" "Gnus") nil t gnus-topic-history nil nil nil)
  completing-read("Move to topic: " ("gadgets" "tex" "emacs" "orgmode" "computers" "news" "jobs" "productivity" "gnus" "politics" "diy" "arch" "ideas" "linux" "money" "blogs" "magazines" "data" "digital-humanities" "coding" "Gnus") nil t gnus-topic-history nil nil)
  gnus-completing-read("Move to topic" ("gadgets" "tex" "emacs" "orgmode" "computers" "news" "jobs" "productivity" "gnus" "politics" "diy" "arch" "ideas" "linux" "money" "blogs" "magazines" "data" "digital-humanities" "coding" "Gnus") t gnus-topic-history)
  (list current-prefix-arg (gnus-completing-read "Move to topic" (mapcar ... gnus-topic-alist) t (quote gnus-topic-history)))
  call-interactively(gnus-topic-move-group nil nil)
--8<---------------cut here---------------end--------------->8---

A quick glance suggests that commit
a07fef39c45c3c3c77cafef422daca2460f34882 removed a few history-related
tests from gnus-completing-read.

Best,
Matt




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-10-01 23:45     ` Matt Lundin
@ 2010-10-02  2:21       ` Lars Magne Ingebrigtsen
  2010-10-02 17:48         ` Matt Lundin
  0 siblings, 1 reply; 48+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-10-02  2:21 UTC (permalink / raw)
  To: ding

Matt Lundin <mdl@imapmail.org> writes:

> Debugger entered--Lisp error: (wrong-type-argument stringp gnus-topic-history)

Ok; fixed.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] Introduce gnus-completing-read
  2010-10-02  2:21       ` Lars Magne Ingebrigtsen
@ 2010-10-02 17:48         ` Matt Lundin
  0 siblings, 0 replies; 48+ messages in thread
From: Matt Lundin @ 2010-10-02 17:48 UTC (permalink / raw)
  To: ding

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Matt Lundin <mdl@imapmail.org> writes:
>
>> Debugger entered--Lisp error: (wrong-type-argument stringp gnus-topic-history)
>
> Ok; fixed.

Thanks. This, too, works fine now.

Best,
Matt




^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2010-10-02 17:48 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-28 15:35 [PATCH] Introduce gnus-completing-read Julien Danjou
2010-09-28 15:49 ` Eric Abrahamsen
2010-09-28 15:55 ` Florian Ragwitz
2010-09-28 16:04   ` Julien Danjou
2010-09-28 19:31     ` Florian Ragwitz
2010-09-28 20:47       ` Julien Danjou
2010-09-29 15:19         ` Lars Magne Ingebrigtsen
2010-09-29 21:47           ` Lars Magne Ingebrigtsen
2010-09-30  8:05             ` Julien Danjou
2010-09-30  9:42               ` Robert Pluim
2010-09-30  9:56                 ` Julien Danjou
2010-09-30  6:46           ` Reiner Steib
2010-09-30 10:23             ` Florian Ragwitz
2010-09-30 10:44               ` Lars Magne Ingebrigtsen
2010-09-30 11:33                 ` Florian Ragwitz
2010-09-30 11:36                   ` Lars Magne Ingebrigtsen
2010-09-30 11:42                     ` Florian Ragwitz
2010-09-30 12:20                       ` Julien Danjou
2010-09-30 12:54                         ` Florian Ragwitz
2010-09-30 13:29                           ` Julien Danjou
2010-09-30 16:33                           ` Lars Magne Ingebrigtsen
2010-09-30 16:48                             ` Ted Zlatanov
2010-09-30 16:55                               ` Lars Magne Ingebrigtsen
2010-09-30 17:13                                 ` Ted Zlatanov
2010-09-30 17:22                                   ` Florian Ragwitz
2010-09-30 17:39                                     ` Lars Magne Ingebrigtsen
2010-09-30 17:41                                       ` Florian Ragwitz
2010-09-30 17:49                                         ` Lars Magne Ingebrigtsen
2010-10-01  1:01                                           ` Florian Ragwitz
2010-10-01  9:43                                             ` Lars Magne Ingebrigtsen
2010-10-01 10:13                                               ` Lars Magne Ingebrigtsen
2010-09-30 17:47                                     ` Ted Zlatanov
2010-10-01  9:00                                       ` Julien Danjou
2010-09-30 17:06                               ` Florian Ragwitz
2010-10-01  6:17                           ` Copyright assignments, policies, conventions (was: [PATCH] Introduce gnus-completing-read) Reiner Steib
2010-10-01 13:51                             ` Copyright assignments, policies, conventions Štěpán Němec
2010-09-30 12:13                   ` [PATCH] Introduce gnus-completing-read Štěpán Němec
2010-09-28 15:55 ` Dan Christensen
2010-09-28 16:00   ` Julien Danjou
2010-09-28 16:02     ` Julien Danjou
2010-09-28 20:07 ` Ted Zlatanov
2010-09-28 20:36   ` Julien Danjou
2010-09-28 21:08     ` Ted Zlatanov
2010-10-01 15:57 ` Matt Lundin
2010-10-01 18:21   ` Lars Magne Ingebrigtsen
2010-10-01 23:45     ` Matt Lundin
2010-10-02  2:21       ` Lars Magne Ingebrigtsen
2010-10-02 17:48         ` Matt Lundin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).