From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#28867: Replace gnus-copy-sequence with copy-tree Date: Mon, 16 Oct 2017 09:58:16 -0700 Message-ID: <87k1zvxc5z.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1508173287 22153 195.159.176.226 (16 Oct 2017 17:01:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 16 Oct 2017 17:01:27 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: 28867@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 16 19:01:21 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e48lT-0004YY-9k for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Oct 2017 19:01:19 +0200 Original-Received: from localhost ([::1]:34166 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e48lX-0007Ce-QW for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Oct 2017 13:01:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e48kL-0006PN-Jb for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2017 13:00:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e48kG-0007ir-Nc for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2017 13:00:09 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35439) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e48kG-0007iY-IG for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2017 13:00:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e48kE-0006Ba-18; Mon, 16 Oct 2017 13:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Mon, 16 Oct 2017 17:00:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 28867 X-GNU-PR-Package: emacs,gnus X-GNU-PR-Keywords: X-Debbugs-Original-To: submit@debbugs.gnu.org (The Gnus Bugfixing Girls + Boys) Original-Received: via spool by submit@debbugs.gnu.org id=B.150817319123733 (code B ref -1); Mon, 16 Oct 2017 17:00:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Oct 2017 16:59:51 +0000 Original-Received: from localhost ([127.0.0.1]:44119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e48k3-0006Ai-Fy for submit@debbugs.gnu.org; Mon, 16 Oct 2017 12:59:51 -0400 Original-Received: from mail.ericabrahamsen.net ([50.56.99.223]:57883) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e48k2-0006AZ-5E for submit@debbugs.gnu.org; Mon, 16 Oct 2017 12:59:50 -0400 Original-Received: from localhost (71-212-71-66.tukw.qwest.net [71.212.71.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 4E038BF7F3 for ; Mon, 16 Oct 2017 16:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ericabrahamsen.net; s=mail; t=1508173189; bh=lCvXlUWsTiG3WOa5Xv9Fi67LO0t6YyLK76qeSiP7JKM=; h=From:To:Subject:Date:From; b=iPjT3GGfqRw5JuZdCBemrPkeCPqgMq7YE9AEm5/xEuEIZXxqsy4vUev496cZe88HI yL4hK1EqFq0SGuHxBTGColMW28dgcq9lKyphVZlJag03dl+TXBMW5+yf4zmjnzF7QW wSNlFPbhrf8lNO648uHFO645n1YxAJh7tH6vAUag= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:138540 Archived-At: --=-=-= Content-Type: text/plain As with my previous report, this is part of a push to use core functions rather than Gnus-specific implementations (so long as the behavior is the same). `copy-tree' does everything `gnus-copy-sequence' does. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Replace-gnus-copy-sequence-with-copy-tree.patch >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 --=-=-=--