diff lisp/gnus/gnus-group.el @ 110779:9d935b7bf464

Eliminate `remove-if-not' that is a cl function. gnus-util.el (gnus-remove-if): Allow hash table. gnus-util.el (gnus-remove-if-not): New function. gnus-art.el (gnus-mime-view-part-as-type): Replace remove-if-not with gnus-remove-if-not. gnus-score.el (gnus-summary-score-effect): Replace remove-if-not with gnus-remove-if-not. gnus-sum.el (gnus-read-move-group-name): Replace remove-if-not with gnus-remove-if-not. gnus-group.el (gnus-group-completing-read): Regard collection as a hash table if it is not a list.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Wed, 06 Oct 2010 01:09:32 +0000
parents 895607aec71e
children 1d132c3c1987
line wrap: on
line diff
--- a/lisp/gnus/gnus-group.el	Tue Oct 05 23:42:01 2010 +0000
+++ b/lisp/gnus/gnus-group.el	Wed Oct 06 01:09:32 2010 +0000
@@ -2163,23 +2163,33 @@
 	(goto-char start)))))
 
 (defun gnus-group-completing-read (&optional prompt collection
-                                             require-match initial-input hist def)
+					     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* ((collection (or collection (or gnus-active-hashtb [0])))
-	 (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 collection)))
-         (group
-          (gnus-completing-read (or prompt "Group") choices
-                                require-match initial-input
-                                (or hist 'gnus-group-history)
-                                def)))
+respectively if they are omitted.  Regards COLLECTION as a hash table
+if it is not a list."
+  (or collection (setq collection gnus-active-hashtb))
+  (let (choices group)
+    (if (listp collection)
+	(dolist (symbol collection)
+	  (setq group (symbol-name symbol))
+	  (push (if (string-match "[^\000-\177]" group)
+		    (gnus-group-decoded-name group)
+		  group)
+		choices))
+      (mapatoms (lambda (symbol)
+		  (setq group (symbol-name symbol))
+		  (push (if (string-match "[^\000-\177]" group)
+			    (gnus-group-decoded-name group)
+			  group)
+			choices))
+		collection))
+    (setq group (gnus-completing-read (or prompt "Group") (nreverse choices)
+				      require-match initial-input
+				      (or hist 'gnus-group-history)
+				      def))
     (if (symbol-value (intern-soft group collection))
 	group
       (mm-encode-coding-string group (gnus-group-name-charset nil group)))))