mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-10 00:00:39 -08:00
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.
This commit is contained in:
parent
a0ec382af2
commit
61c47336fe
6 changed files with 75 additions and 24 deletions
|
|
@ -1307,13 +1307,40 @@ This function saves the current buffer."
|
|||
(with-current-buffer gnus-group-buffer
|
||||
(eq major-mode 'gnus-group-mode))))
|
||||
|
||||
(defun gnus-remove-if (predicate list)
|
||||
"Return a copy of LIST with all items satisfying PREDICATE removed."
|
||||
(defun gnus-remove-if (predicate sequence &optional hash-table-p)
|
||||
"Return a copy of SEQUENCE with all items satisfying PREDICATE removed.
|
||||
SEQUENCE should be a list, a vector, or a string. Returns always a list.
|
||||
If HASH-TABLE-P is non-nil, regards SEQUENCE as a hash table."
|
||||
(let (out)
|
||||
(while list
|
||||
(unless (funcall predicate (car list))
|
||||
(push (car list) out))
|
||||
(setq list (cdr list)))
|
||||
(if hash-table-p
|
||||
(mapatoms (lambda (symbol)
|
||||
(unless (funcall predicate symbol)
|
||||
(push symbol out)))
|
||||
sequence)
|
||||
(unless (listp sequence)
|
||||
(setq sequence (append sequence nil)))
|
||||
(while sequence
|
||||
(unless (funcall predicate (car sequence))
|
||||
(push (car sequence) out))
|
||||
(setq sequence (cdr sequence))))
|
||||
(nreverse out)))
|
||||
|
||||
(defun gnus-remove-if-not (predicate sequence &optional hash-table-p)
|
||||
"Return a copy of SEQUENCE with all items not satisfying PREDICATE removed.
|
||||
SEQUENCE should be a list, a vector, or a string. Returns always a list.
|
||||
If HASH-TABLE-P is non-nil, regards SEQUENCE as a hash table."
|
||||
(let (out)
|
||||
(if hash-table-p
|
||||
(mapatoms (lambda (symbol)
|
||||
(when (funcall predicate symbol)
|
||||
(push symbol out)))
|
||||
sequence)
|
||||
(unless (listp sequence)
|
||||
(setq sequence (append sequence nil)))
|
||||
(while sequence
|
||||
(when (funcall predicate (car sequence))
|
||||
(push (car sequence) out))
|
||||
(setq sequence (cdr sequence))))
|
||||
(nreverse out)))
|
||||
|
||||
(if (fboundp 'assq-delete-all)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue