>From c4262a8d84d1b9db708edffb05944d5f77f29844 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Sun, 15 Oct 2017 12:53:02 -0700 Subject: [PATCH] Replace gnus-copy-sequence with copy-tree Use built-in equivalents where possible. * lisp/gnus/gnus-range.el: Delete gnus-copy-sequence. (gnus-remove-from-range) * 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) * lisp/gnus/gnus-sum.el (gnus-summary-read-group-1, gnus-update-marks, gnus-summary-insert-new-articles): Replace with copy-tree in all these locations. --- lisp/gnus/gnus-agent.el | 6 +++--- lisp/gnus/gnus-cus.el | 2 +- lisp/gnus/gnus-group.el | 4 ++-- lisp/gnus/gnus-range.el | 13 +------------ lisp/gnus/gnus-score.el | 2 +- lisp/gnus/gnus-srvr.el | 2 +- lisp/gnus/gnus-sum.el | 8 ++++---- lisp/gnus/gnus.el | 1 - 8 files changed, 13 insertions(+), 25 deletions(-) diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index daf578180f..f2dfe07c4c 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el @@ -1108,7 +1108,7 @@ gnus-agent-catchup 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 @@ gnus-agent-summary-fetch-series (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 @@ gnus-category-copy "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) diff --git a/lisp/gnus/gnus-cus.el b/lisp/gnus/gnus-cus.el index 600b33f226..c22c9c1d5a 100644 --- a/lisp/gnus/gnus-cus.el +++ b/lisp/gnus/gnus-cus.el @@ -406,7 +406,7 @@ gnus-group-customize ;; 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))) diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 985efe6272..04f8244b63 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -2993,7 +2993,7 @@ gnus-group-edit-group-done ;; 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) @@ -3016,7 +3016,7 @@ gnus-group-make-useful-group ;; 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))))) diff --git a/lisp/gnus/gnus-range.el b/lisp/gnus/gnus-range.el index b30b2e9099..cc094b7862 100644 --- a/lisp/gnus/gnus-range.el +++ b/lisp/gnus/gnus-range.el @@ -39,17 +39,6 @@ gnus-last-element (setq list (cdr list))) (car list)) -(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)))) - (defun gnus-set-difference (list1 list2) "Return a list of elements of LIST1 that do not appear in LIST2." (let ((hash2 (make-hash-table :test 'eq)) @@ -455,7 +444,7 @@ gnus-remove-from-range (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) diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el index 976ac9f7f3..d1f065748c 100644 --- a/lisp/gnus/gnus-score.el +++ b/lisp/gnus/gnus-score.el @@ -2318,7 +2318,7 @@ gnus-score-adaptive (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) diff --git a/lisp/gnus/gnus-srvr.el b/lisp/gnus/gnus-srvr.el index 82056cf165..67702d6028 100644 --- a/lisp/gnus/gnus-srvr.el +++ b/lisp/gnus/gnus-srvr.el @@ -608,7 +608,7 @@ gnus-server-copy-server (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) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 48571096cc..763cb31578 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -3992,7 +3992,7 @@ gnus-summary-read-group-1 (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. @@ -6076,12 +6076,12 @@ gnus-update-marks (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 @@ -13002,7 +13002,7 @@ gnus-summary-insert-new-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) diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index 8c0846be9f..c27c57fb95 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -2902,7 +2902,6 @@ gnus-other-frame-object 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) -- 2.14.2