Obsolete gnus-remove-if and gnus-remove-if-not

Use seq-remove and seq-filter, respectively, instead.

* lisp/gnus/gnus-util.el: Remove functions and replace with
  define-obsolete-function-alias calls.
* lisp/gnus/gnus.el: Require seq here.
* lisp/gnus/gnus-art.el (gnus-mime-view-part-as-type):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event--get-attendee-names):
* lisp/gnus/gnus-score.el (gnus-summary-score-effect):
* lisp/gnus/gnus-sum.el (gnus-read-move-group-name):
* lisp/gnus/gnus-topic.el (gnus-group-prepare-topics):
* lisp/gnus/gnus-win.el (gnus-get-buffer-window):
* lisp/gnus/nnmail.el (nnmail-purge-split-history):
* lisp/gnus/nnmaildir.el (nnmaildir-request-scan):
* lisp/gnus/nnrss.el (nnrss-make-hash-index): Replace calls in all
  these locations.
This commit is contained in:
Eric Abrahamsen 2017-11-25 18:42:55 -08:00
parent 07bcc2a243
commit 786907238b
11 changed files with 32 additions and 57 deletions

View file

@ -5219,7 +5219,7 @@ available media-types."
(gnus-completing-read
"View as MIME type"
(if pred
(gnus-remove-if-not pred (mailcap-mime-types))
(seq-filter pred (mailcap-mime-types))
(mailcap-mime-types))
nil nil nil
(car default)))))

View file

@ -169,7 +169,7 @@
(defun gnus-icalendar-event--get-attendee-names (ical)
(let* ((event (car (icalendar--all-events ical)))
(attendee-props (gnus-remove-if-not
(attendee-props (seq-filter
(lambda (p) (eq (car p) 'ATTENDEE))
(caddr event))))
@ -180,7 +180,7 @@
(or (plist-get (cadr prop) 'CN)
(replace-regexp-in-string "^.*MAILTO:" "" (caddr prop))))
(attendees-by-type (type)
(gnus-remove-if-not
(seq-filter
(lambda (p) (string= (attendee-role p) type))
attendee-props))
(attendee-names-by-type

View file

@ -921,7 +921,7 @@ EXTRA is the possible non-standard header."
(interactive (list (gnus-completing-read "Header"
(mapcar
'car
(gnus-remove-if-not
(seq-filter
(lambda (x) (fboundp (nth 2 x)))
gnus-header-index))
t)

View file

@ -12270,21 +12270,27 @@ save those articles instead."
(if (> (length articles) 1)
(format "these %d articles" (length articles))
"this article")))
valid-names
(to-newsgroup
(cond
((null split-name)
(gnus-group-completing-read
prom
(gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t)
nil prefix nil default))
((= 1 (length split-name))
(gnus-group-completing-read
prom
(gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t)
nil prefix 'gnus-group-history (car split-name)))
(t
(gnus-completing-read
prom (nreverse split-name) nil nil 'gnus-group-history))))
(progn
(mapatoms (lambda (g)
(when (gnus-valid-move-group-p g)
(push g valid-names)))
gnus-active-hashtb)
(cond
((null split-name)
(gnus-group-completing-read
prom
valid-names
nil prefix nil default))
((= 1 (length split-name))
(gnus-group-completing-read
prom
valid-names
nil prefix 'gnus-group-history (car split-name)))
(t
(gnus-completing-read
prom (nreverse split-name) nil nil 'gnus-group-history)))))
(to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
encoded)
(when to-newsgroup

View file

@ -460,7 +460,7 @@ If LOWEST is non-nil, list all newsgroups of level LOWEST or higher."
(unless gnus-killed-hashtb
(gnus-make-hashtable-from-killed))
(gnus-group-prepare-flat-list-dead
(gnus-remove-if (lambda (group)
(seq-remove (lambda (group)
(or (gnus-group-entry group)
(gnus-gethash group gnus-killed-hashtb)))
not-in-list)

View file

@ -1117,41 +1117,9 @@ ARG is passed to the first function."
(with-current-buffer gnus-group-buffer
(eq major-mode 'gnus-group-mode))))
(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)
(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)))
(define-obsolete-function-alias 'gnus-remove-if 'seq-remove "27.1")
(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)))
(define-obsolete-function-alias 'gnus-remove-if-not 'seq-filter "27.1")
(defun gnus-grep-in-list (word list)
"Find if a WORD matches any regular expression in the given LIST."

View file

@ -513,7 +513,7 @@ should have point."
(memq frame '(t 0 visible)))
(car
(let ((frames (frames-on-display-list)))
(gnus-remove-if (lambda (win) (not (memq (window-frame win)
(seq-remove (lambda (win) (not (memq (window-frame win)
frames)))
(get-buffer-window-list buffer nil frame)))))
(t

View file

@ -33,6 +33,7 @@
(require 'wid-edit)
(require 'mm-util)
(require 'nnheader)
(require 'seq)
;; These are defined afterwards with gnus-define-group-parameter
(defvar gnus-ham-process-destinations)

View file

@ -2034,7 +2034,7 @@ If TIME is nil, then return the cutoff time for oldness instead."
"Remove all instances of GROUP from `nnmail-split-history'."
(let ((history nnmail-split-history))
(while history
(setcar history (gnus-remove-if (lambda (e) (string= (car e) group))
(setcar history (seq-remove (lambda (e) (string= (car e) group))
(car history)))
(pop history))
(setq nnmail-split-history (delq nil nnmail-split-history))))

View file

@ -915,7 +915,7 @@ This variable is set by `nnmaildir-request-article'.")
(setq dirs (funcall srv-ls srv-dir nil "\\`[^.]" 'nosort)
dirs (if (zerop (length target-prefix))
dirs
(gnus-remove-if
(seq-remove
(lambda (dir)
(and (>= (length dir) (length target-prefix))
(string= (substring dir 0

View file

@ -625,7 +625,7 @@ which RSS 2.0 allows."
;;; Snarf functions
(defun nnrss-make-hash-index (item)
(gnus-message 9 "nnrss: Making hash index of %s" (gnus-prin1-to-string item))
(setq item (gnus-remove-if
(setq item (seq-remove
(lambda (field)
(when (listp field)
(memq (car field) nnrss-ignore-article-fields)))