emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 03ceee0: Refactor Gnus group name extraction in gro


From: Eric Abrahamsen
Subject: [Emacs-diffs] master 03ceee0: Refactor Gnus group name extraction in group completing read
Date: Mon, 1 Apr 2019 15:42:22 -0400 (EDT)

branch: master
commit 03ceee0e6403052f7367efe1159e3663402c8c1e
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Refactor Gnus group name extraction in group completing read
    
    * lisp/gnus/gnus-group.el (gnus-group-completing-read): Only do the
      unibyte check once; make sure it applies to hash table keys as
      well.
---
 lisp/gnus/gnus-group.el | 41 +++++++++++++++++------------------------
 1 file changed, 17 insertions(+), 24 deletions(-)

diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index bd24c3f..0be3854 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -2173,30 +2173,23 @@ Non-ASCII group names are allowed.  The arguments are 
the same as
 they are omitted.  Can handle COLLECTION as a list, hash table,
 or vector."
   (or collection (setq collection gnus-active-hashtb))
-  (let (choices group)
-    (cond ((listp collection)
-          (if (symbolp (car collection))
-              (dolist (symbol collection)
-                (setq group (symbol-name symbol))
-                (push (if (string-match "[^\000-\177]" group)
-                          (gnus-group-decoded-name group)
-                        group)
-                      choices))
-            (setq choices collection)))
-         ((vectorp collection)
-          (mapatoms (lambda (symbol)
-                      (setq group (symbol-name symbol))
-                      (push (if (string-match "[^\000-\177]" group)
-                                (gnus-group-decoded-name group)
-                              group)
-                            choices))
-                    collection))
-         ((hash-table-p collection)
-          (setq choices (hash-table-keys collection))))
-    (setq group (gnus-completing-read (or prompt "Group") (reverse choices)
-                                     require-match initial-input
-                                     (or hist 'gnus-group-history)
-                                     def))
+  (let* ((choices
+         (mapcar
+          (lambda (g)
+            (if (string-match "[^\000-\177]" g)
+                (gnus-group-decoded-name g)
+              g))
+          (cond ((listp collection)
+                 collection)
+                ((vectorp collection)
+                 (mapatoms #'symbol-name collection))
+                ((hash-table-p collection)
+                 (hash-table-keys collection)))))
+        (group
+         (gnus-completing-read (or prompt "Group") (reverse choices)
+                               require-match initial-input
+                               (or hist 'gnus-group-history)
+                               def)))
     (unless (cond ((and (listp collection)
                        (symbolp (car collection)))
                   (member group (mapcar 'symbol-name collection)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]