Commit e27004c5 authored by Eric Abrahamsen's avatar Eric Abrahamsen

Obsolete gnus-copy-sequence and gnus-last-element

(Bug#28856, Bug#28867)

* lisp/gnus/gnus-range.el: Leave gnus-last-element in place, but
  obsolete it and point to car of last. Remove gnus-copy-sequence and
  define as an obsolete alias for copy-tree.
  (gnus-remove-from-range):
* lisp/gnus/gnus-cache.el (gnus-cache-generate-active):
* lisp/gnus/gnus-sum.el (gnus-summary-insert-articles,
  gnus-select-newsgroup, gnus-summary-read-group-1,
  gnus-select-newsgroup, gnus-update-marks,
  gnus-summary-insert-articles, gnus-summary-insert-new-articles):
  Replace calls in these locations.
* lisp/gnus/gnus-agent.el (gnus-agent-catchup,
  gnus-agent-summary-fetch-series, gnus-category-copy):
* lisp/gnus/gnus-cus.el (gnus-group-customize):
* lisp/gnus/gnus-group.el (gnus-group-edit-group-done,
  gnus-group-make-useful-group):
* lisp/gnus/gnus-score.el (gnus-score-adaptive):
* lisp/gnus/gnus-srvr.el (gnus-server-copy-server): Replace calls in
  these locations.
parent d1000fb4
......@@ -1108,7 +1108,7 @@ downloadable."
gnus-newsgroup-cached)
(setq articles (gnus-sorted-ndifference
(gnus-sorted-ndifference
(gnus-copy-sequence articles)
(copy-tree articles)
gnus-newsgroup-downloadable)
gnus-newsgroup-cached)))
......@@ -1123,7 +1123,7 @@ downloadable."
(when gnus-newsgroup-processable
(setq gnus-newsgroup-downloadable
(let* ((dl gnus-newsgroup-downloadable)
(processable (sort (gnus-copy-sequence gnus-newsgroup-processable) '<))
(processable (sort (copy-tree gnus-newsgroup-processable) '<))
(gnus-newsgroup-downloadable processable))
(gnus-agent-summary-fetch-group)
......@@ -2833,7 +2833,7 @@ The following commands are available:
"Copy the current category."
(interactive (list (gnus-category-name) (intern (read-string "New name: "))))
(let ((info (assq category gnus-category-alist)))
(push (let ((newcat (gnus-copy-sequence info)))
(push (let ((newcat (copy-tree info)))
(setf (gnus-agent-cat-name newcat) to)
(setf (gnus-agent-cat-groups newcat) nil)
newcat)
......
......@@ -735,7 +735,7 @@ If LOW, update the lower bound instead."
;; `gnus-cache-unified-group-names' needless.
(gnus-sethash (or (cdr (assoc group gnus-cache-unified-group-names))
group)
(cons (car nums) (gnus-last-element nums))
(cons (car nums) (car (last nums)))
gnus-cache-active-hashtb))
;; Go through all the other files.
(dolist (file alphs)
......
......@@ -406,7 +406,7 @@ category."))
;; every duplicate ends up being displayed. So, rather than
;; display them, remove them from the list.
(let ((tmp (setq values (gnus-copy-sequence values)))
(let ((tmp (setq values (copy-tree values)))
elem)
(while (cdr tmp)
(while (setq elem (assq (caar tmp) (cdr tmp)))
......
......@@ -3000,7 +3000,7 @@ and NEW-NAME will be prompted for."
;; Set the info.
(if (not (and info new-group))
(gnus-group-set-info form (or new-group group) part)
(setq info (gnus-copy-sequence info))
(setq info (copy-tree info))
(setcar info new-group)
(unless (gnus-server-equal method "native")
(unless (nthcdr 3 info)
......@@ -3023,7 +3023,7 @@ and NEW-NAME will be prompted for."
;; Don't use `caddr' here since macros within the `interactive'
;; form won't be expanded.
(car (cddr entry)))))
(setq method (gnus-copy-sequence method))
(setq method (copy-tree method))
(let (entry)
(while (setq entry (memq (assq 'eval method) method))
(setcar entry (eval (cadar entry)))))
......
......@@ -38,17 +38,9 @@ If RANGE is a single range, return (RANGE). Otherwise, return RANGE."
(while (cdr list)
(setq list (cdr list)))
(car list))
(make-obsolete 'gnus-last-element "use `car' of `last' instead." "27.1")
(defun gnus-copy-sequence (list)
"Do a complete, total copy of a list."
(let (out)
(while (consp list)
(if (consp (car list))
(push (gnus-copy-sequence (pop list)) out)
(push (pop list) out)))
(if list
(nconc (nreverse out) list)
(nreverse out))))
(define-obsolete-function-alias 'gnus-copy-sequence 'copy-tree "27.1")
(defun gnus-set-difference (list1 list2)
"Return a list of elements of LIST1 that do not appear in LIST2."
......@@ -455,7 +447,7 @@ modified."
(if (or (null range1) (null range2))
range1
(let (out r1 r2 r1_min r1_max r2_min r2_max
(range2 (gnus-copy-sequence range2)))
(range2 (copy-tree range2)))
(setq range1 (if (listp (cdr range1)) range1 (list range1))
range2 (sort (if (listp (cdr range2)) range2 (list range2))
(lambda (e1 e2)
......
......@@ -2318,7 +2318,7 @@ score in `gnus-newsgroup-scored' by SCORE."
(when (or (not (listp gnus-newsgroup-adaptive))
(memq 'line gnus-newsgroup-adaptive))
(save-excursion
(let* ((malist (gnus-copy-sequence gnus-adaptive-score-alist))
(let* ((malist (copy-tree gnus-adaptive-score-alist))
(alist malist)
(date (current-time-string))
(data gnus-newsgroup-data)
......
......@@ -609,7 +609,7 @@ The following commands are available:
(error "%s already exists" to))
(unless (gnus-server-to-method from)
(error "%s: no such server" from))
(let ((to-entry (cons from (gnus-copy-sequence
(let ((to-entry (cons from (copy-tree
(gnus-server-to-method from)))))
(setcar to-entry to)
(setcar (nthcdr 2 to-entry) to)
......
......@@ -3992,7 +3992,7 @@ If SELECT-ARTICLES, only select those articles from GROUP."
(spam-initialize))
;; Save the active value in effect when the group was entered.
(setq gnus-newsgroup-active
(gnus-copy-sequence
(copy-tree
(gnus-active gnus-newsgroup-name)))
(setq gnus-newsgroup-highest (cdr gnus-newsgroup-active))
;; You can change the summary buffer in some way with this hook.
......@@ -5737,7 +5737,7 @@ If SELECT-ARTICLES, only select those articles from GROUP."
(mail-header-number (car gnus-newsgroup-headers))
gnus-newsgroup-end
(mail-header-number
(gnus-last-element gnus-newsgroup-headers))))
(car (last gnus-newsgroup-headers)))))
;; GROUP is successfully selected.
(or gnus-newsgroup-headers t)))))
......@@ -6076,12 +6076,12 @@ If SELECT-ARTICLES, only select those articles from GROUP."
(del
(gnus-list-range-intersection
gnus-newsgroup-articles
(gnus-remove-from-range (gnus-copy-sequence old) list)))
(gnus-remove-from-range (copy-tree old) list)))
(add
(gnus-list-range-intersection
gnus-newsgroup-articles
(gnus-remove-from-range
(gnus-copy-sequence list) old))))
(copy-tree list) old))))
(when add
(push (list add 'add (list (cdr type))) delta-marks))
(when del
......@@ -12915,7 +12915,7 @@ returned."
(mail-header-number (car gnus-newsgroup-headers))
gnus-newsgroup-end
(mail-header-number
(gnus-last-element gnus-newsgroup-headers))))
(car (last gnus-newsgroup-headers)))))
(when gnus-use-scoring
(gnus-possibly-score-headers))))
......@@ -13002,7 +13002,7 @@ If ALL is a number, fetch this number of articles."
i new)
(unless new-active
(error "Couldn't fetch new data"))
(setq gnus-newsgroup-active (gnus-copy-sequence new-active))
(setq gnus-newsgroup-active (copy-tree new-active))
(setq i (cdr gnus-newsgroup-active)
gnus-newsgroup-highest i)
(while (> i old-high)
......
......@@ -2769,7 +2769,6 @@ gnus-registry.el will populate this if it's loaded.")
gnus-check-reasonable-setup)
("gnus-dup" gnus-dup-suppress-articles gnus-dup-unsuppress-article
gnus-dup-enter-articles)
("gnus-range" gnus-copy-sequence)
("gnus-eform" gnus-edit-form)
("gnus-logic" gnus-score-advanced)
("gnus-undo" gnus-undo-mode gnus-undo-register)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment