diff options
| author | Eric Abrahamsen | 2019-03-31 09:18:43 -0700 |
|---|---|---|
| committer | Eric Abrahamsen | 2019-04-01 12:41:36 -0700 |
| commit | 03ceee0e6403052f7367efe1159e3663402c8c1e (patch) | |
| tree | 4af5737e867f01646fa008486e9506d28fc3dac6 | |
| parent | 74b63d27a629db96b73a83f205d8a256911abc1c (diff) | |
| download | emacs-03ceee0e6403052f7367efe1159e3663402c8c1e.tar.gz emacs-03ceee0e6403052f7367efe1159e3663402c8c1e.zip | |
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.
| -rw-r--r-- | lisp/gnus/gnus-group.el | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index bd24c3f8dab..0be38541745 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 | |||
| 2173 | they are omitted. Can handle COLLECTION as a list, hash table, | 2173 | they are omitted. Can handle COLLECTION as a list, hash table, |
| 2174 | or vector." | 2174 | or vector." |
| 2175 | (or collection (setq collection gnus-active-hashtb)) | 2175 | (or collection (setq collection gnus-active-hashtb)) |
| 2176 | (let (choices group) | 2176 | (let* ((choices |
| 2177 | (cond ((listp collection) | 2177 | (mapcar |
| 2178 | (if (symbolp (car collection)) | 2178 | (lambda (g) |
| 2179 | (dolist (symbol collection) | 2179 | (if (string-match "[^\000-\177]" g) |
| 2180 | (setq group (symbol-name symbol)) | 2180 | (gnus-group-decoded-name g) |
| 2181 | (push (if (string-match "[^\000-\177]" group) | 2181 | g)) |
| 2182 | (gnus-group-decoded-name group) | 2182 | (cond ((listp collection) |
| 2183 | group) | 2183 | collection) |
| 2184 | choices)) | 2184 | ((vectorp collection) |
| 2185 | (setq choices collection))) | 2185 | (mapatoms #'symbol-name collection)) |
| 2186 | ((vectorp collection) | 2186 | ((hash-table-p collection) |
| 2187 | (mapatoms (lambda (symbol) | 2187 | (hash-table-keys collection))))) |
| 2188 | (setq group (symbol-name symbol)) | 2188 | (group |
| 2189 | (push (if (string-match "[^\000-\177]" group) | 2189 | (gnus-completing-read (or prompt "Group") (reverse choices) |
| 2190 | (gnus-group-decoded-name group) | 2190 | require-match initial-input |
| 2191 | group) | 2191 | (or hist 'gnus-group-history) |
| 2192 | choices)) | 2192 | def))) |
| 2193 | collection)) | ||
| 2194 | ((hash-table-p collection) | ||
| 2195 | (setq choices (hash-table-keys collection)))) | ||
| 2196 | (setq group (gnus-completing-read (or prompt "Group") (reverse choices) | ||
| 2197 | require-match initial-input | ||
| 2198 | (or hist 'gnus-group-history) | ||
| 2199 | def)) | ||
| 2200 | (unless (cond ((and (listp collection) | 2193 | (unless (cond ((and (listp collection) |
| 2201 | (symbolp (car collection))) | 2194 | (symbolp (car collection))) |
| 2202 | (member group (mapcar 'symbol-name collection))) | 2195 | (member group (mapcar 'symbol-name collection))) |