diff options
| -rw-r--r-- | lisp/gnus/ChangeLog | 13 | ||||
| -rw-r--r-- | lisp/gnus/gnus-art.el | 2 | ||||
| -rw-r--r-- | lisp/gnus/gnus-group.el | 38 | ||||
| -rw-r--r-- | lisp/gnus/gnus-score.el | 2 | ||||
| -rw-r--r-- | lisp/gnus/gnus-sum.el | 5 | ||||
| -rw-r--r-- | lisp/gnus/gnus-util.el | 39 |
6 files changed, 75 insertions, 24 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index ed6c541c4f0..cb9924415b9 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2010-10-06 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 2 | |||
| 3 | * gnus-util.el (gnus-remove-if): Allow hash table. | ||
| 4 | (gnus-remove-if-not): New function. | ||
| 5 | |||
| 6 | * gnus-art.el (gnus-mime-view-part-as-type) | ||
| 7 | * gnus-score.el (gnus-summary-score-effect) | ||
| 8 | * gnus-sum.el (gnus-read-move-group-name): | ||
| 9 | Replace remove-if-not with gnus-remove-if-not. | ||
| 10 | |||
| 11 | * gnus-group.el (gnus-group-completing-read): | ||
| 12 | Regard collection as a hash table if it is not a list. | ||
| 13 | |||
| 1 | 2010-10-05 Lars Magne Ingebrigtsen <larsi@gnus.org> | 14 | 2010-10-05 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 15 | ||
| 3 | * shr.el (shr-render-td): Allow blank/missing <TD>s. | 16 | * shr.el (shr-render-td): Allow blank/missing <TD>s. |
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index d7dcf901713..40f80f14bb1 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el | |||
| @@ -5139,7 +5139,7 @@ available media-types." | |||
| 5139 | (let ((default (gnus-mime-view-part-as-type-internal))) | 5139 | (let ((default (gnus-mime-view-part-as-type-internal))) |
| 5140 | (gnus-completing-read | 5140 | (gnus-completing-read |
| 5141 | "View as MIME type" | 5141 | "View as MIME type" |
| 5142 | (remove-if-not pred (mailcap-mime-types)) | 5142 | (gnus-remove-if-not pred (mailcap-mime-types)) |
| 5143 | nil nil nil | 5143 | nil nil nil |
| 5144 | (car default))))) | 5144 | (car default))))) |
| 5145 | (gnus-article-check-buffer) | 5145 | (gnus-article-check-buffer) |
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index a700b5ee8cf..1833c604893 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el | |||
| @@ -2163,23 +2163,33 @@ be permanent." | |||
| 2163 | (goto-char start))))) | 2163 | (goto-char start))))) |
| 2164 | 2164 | ||
| 2165 | (defun gnus-group-completing-read (&optional prompt collection | 2165 | (defun gnus-group-completing-read (&optional prompt collection |
| 2166 | require-match initial-input hist def) | 2166 | require-match initial-input hist |
| 2167 | def) | ||
| 2167 | "Read a group name with completion. Non-ASCII group names are allowed. | 2168 | "Read a group name with completion. Non-ASCII group names are allowed. |
| 2168 | The arguments are the same as `completing-read' except that COLLECTION | 2169 | The arguments are the same as `completing-read' except that COLLECTION |
| 2169 | and HIST default to `gnus-active-hashtb' and `gnus-group-history' | 2170 | and HIST default to `gnus-active-hashtb' and `gnus-group-history' |
| 2170 | respectively if they are omitted." | 2171 | respectively if they are omitted. Regards COLLECTION as a hash table |
| 2171 | (let* ((collection (or collection (or gnus-active-hashtb [0]))) | 2172 | if it is not a list." |
| 2172 | (choices (mapcar (lambda (symbol) | 2173 | (or collection (setq collection gnus-active-hashtb)) |
| 2173 | (let ((group (symbol-name symbol))) | 2174 | (let (choices group) |
| 2174 | (if (string-match "[^\000-\177]" group) | 2175 | (if (listp collection) |
| 2175 | (gnus-group-decoded-name group) | 2176 | (dolist (symbol collection) |
| 2176 | group))) | 2177 | (setq group (symbol-name symbol)) |
| 2177 | (remove-if-not 'symbolp collection))) | 2178 | (push (if (string-match "[^\000-\177]" group) |
| 2178 | (group | 2179 | (gnus-group-decoded-name group) |
| 2179 | (gnus-completing-read (or prompt "Group") choices | 2180 | group) |
| 2180 | require-match initial-input | 2181 | choices)) |
| 2181 | (or hist 'gnus-group-history) | 2182 | (mapatoms (lambda (symbol) |
| 2182 | def))) | 2183 | (setq group (symbol-name symbol)) |
| 2184 | (push (if (string-match "[^\000-\177]" group) | ||
| 2185 | (gnus-group-decoded-name group) | ||
| 2186 | group) | ||
| 2187 | choices)) | ||
| 2188 | collection)) | ||
| 2189 | (setq group (gnus-completing-read (or prompt "Group") (nreverse choices) | ||
| 2190 | require-match initial-input | ||
| 2191 | (or hist 'gnus-group-history) | ||
| 2192 | def)) | ||
| 2183 | (if (symbol-value (intern-soft group collection)) | 2193 | (if (symbol-value (intern-soft group collection)) |
| 2184 | group | 2194 | group |
| 2185 | (mm-encode-coding-string group (gnus-group-name-charset nil group))))) | 2195 | (mm-encode-coding-string group (gnus-group-name-charset nil group))))) |
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el index 26c3ca34e7b..a9c666e246e 100644 --- a/lisp/gnus/gnus-score.el +++ b/lisp/gnus/gnus-score.el | |||
| @@ -916,7 +916,7 @@ EXTRA is the possible non-standard header." | |||
| 916 | (interactive (list (gnus-completing-read "Header" | 916 | (interactive (list (gnus-completing-read "Header" |
| 917 | (mapcar | 917 | (mapcar |
| 918 | 'car | 918 | 'car |
| 919 | (remove-if-not | 919 | (gnus-remove-if-not |
| 920 | (lambda (x) (fboundp (nth 2 x))) | 920 | (lambda (x) (fboundp (nth 2 x))) |
| 921 | gnus-header-index)) | 921 | gnus-header-index)) |
| 922 | t) | 922 | t) |
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 484837f7ff9..dc6882ac086 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el | |||
| @@ -11926,11 +11926,12 @@ save those articles instead." | |||
| 11926 | ((null split-name) | 11926 | ((null split-name) |
| 11927 | (gnus-group-completing-read | 11927 | (gnus-group-completing-read |
| 11928 | prom | 11928 | prom |
| 11929 | (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb) | 11929 | (gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t) |
| 11930 | nil prefix nil default)) | 11930 | nil prefix nil default)) |
| 11931 | ((= 1 (length split-name)) | 11931 | ((= 1 (length split-name)) |
| 11932 | (gnus-group-completing-read | 11932 | (gnus-group-completing-read |
| 11933 | prom (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb) | 11933 | prom |
| 11934 | (gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t) | ||
| 11934 | nil prefix 'gnus-group-history (car split-name))) | 11935 | nil prefix 'gnus-group-history (car split-name))) |
| 11935 | (t | 11936 | (t |
| 11936 | (gnus-completing-read | 11937 | (gnus-completing-read |
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 5fda600348c..b3f73d71fd5 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el | |||
| @@ -1307,13 +1307,40 @@ This function saves the current buffer." | |||
| 1307 | (with-current-buffer gnus-group-buffer | 1307 | (with-current-buffer gnus-group-buffer |
| 1308 | (eq major-mode 'gnus-group-mode)))) | 1308 | (eq major-mode 'gnus-group-mode)))) |
| 1309 | 1309 | ||
| 1310 | (defun gnus-remove-if (predicate list) | 1310 | (defun gnus-remove-if (predicate sequence &optional hash-table-p) |
| 1311 | "Return a copy of LIST with all items satisfying PREDICATE removed." | 1311 | "Return a copy of SEQUENCE with all items satisfying PREDICATE removed. |
| 1312 | SEQUENCE should be a list, a vector, or a string. Returns always a list. | ||
| 1313 | If HASH-TABLE-P is non-nil, regards SEQUENCE as a hash table." | ||
| 1312 | (let (out) | 1314 | (let (out) |
| 1313 | (while list | 1315 | (if hash-table-p |
| 1314 | (unless (funcall predicate (car list)) | 1316 | (mapatoms (lambda (symbol) |
| 1315 | (push (car list) out)) | 1317 | (unless (funcall predicate symbol) |
| 1316 | (setq list (cdr list))) | 1318 | (push symbol out))) |
| 1319 | sequence) | ||
| 1320 | (unless (listp sequence) | ||
| 1321 | (setq sequence (append sequence nil))) | ||
| 1322 | (while sequence | ||
| 1323 | (unless (funcall predicate (car sequence)) | ||
| 1324 | (push (car sequence) out)) | ||
| 1325 | (setq sequence (cdr sequence)))) | ||
| 1326 | (nreverse out))) | ||
| 1327 | |||
| 1328 | (defun gnus-remove-if-not (predicate sequence &optional hash-table-p) | ||
| 1329 | "Return a copy of SEQUENCE with all items not satisfying PREDICATE removed. | ||
| 1330 | SEQUENCE should be a list, a vector, or a string. Returns always a list. | ||
| 1331 | If HASH-TABLE-P is non-nil, regards SEQUENCE as a hash table." | ||
| 1332 | (let (out) | ||
| 1333 | (if hash-table-p | ||
| 1334 | (mapatoms (lambda (symbol) | ||
| 1335 | (when (funcall predicate symbol) | ||
| 1336 | (push symbol out))) | ||
| 1337 | sequence) | ||
| 1338 | (unless (listp sequence) | ||
| 1339 | (setq sequence (append sequence nil))) | ||
| 1340 | (while sequence | ||
| 1341 | (when (funcall predicate (car sequence)) | ||
| 1342 | (push (car sequence) out)) | ||
| 1343 | (setq sequence (cdr sequence)))) | ||
| 1317 | (nreverse out))) | 1344 | (nreverse out))) |
| 1318 | 1345 | ||
| 1319 | (if (fboundp 'assq-delete-all) | 1346 | (if (fboundp 'assq-delete-all) |