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#28856: Replace gnus-last-element with car->last Date: Sun, 15 Oct 2017 21:07:42 -0700 Message-ID: <87efq3ka5t.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1508127025 11552 195.159.176.226 (16 Oct 2017 04:10:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 16 Oct 2017 04:10:25 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) To: 28856@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 16 06:10:20 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 1e3wjB-0000qn-Nm for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Oct 2017 06:10:10 +0200 Original-Received: from localhost ([::1]:59247 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3wjI-0004uB-Oc for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Oct 2017 00:10:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3wj8-0004tj-9q for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2017 00:10:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e3wj5-0004bv-4h for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2017 00:10:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33597) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e3wj4-0004bn-V5 for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2017 00:10:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e3wj4-0002Yz-7K; Mon, 16 Oct 2017 00:10: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 04:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 28856 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.15081269569788 (code B ref -1); Mon, 16 Oct 2017 04:10:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Oct 2017 04:09:16 +0000 Original-Received: from localhost ([127.0.0.1]:42276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e3wiK-0002Xo-DN for submit@debbugs.gnu.org; Mon, 16 Oct 2017 00:09:16 -0400 Original-Received: from mail.ericabrahamsen.net ([50.56.99.223]:51723) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e3wiJ-0002Xh-LR for submit@debbugs.gnu.org; Mon, 16 Oct 2017 00:09:15 -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 D33DABF820 for ; Mon, 16 Oct 2017 04:09:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ericabrahamsen.net; s=mail; t=1508126955; bh=R560q/QY+NnoRR0nTeqeD6iwfcSVRUtrQvBKulixSBk=; h=From:To:Subject:Date:From; b=bRI+fj9GXscPjSgzTJUAb9NXoi5yDRGvf/UXM2tdrxt+xWYE6yh9STGL6lsggTtCU uippnqX838prF8EHN0R9OVVBx2EoD51pXpfOhfAMp803amIn3dwR/dZFy6JLWGjaiJ xfaXwvJgwSUwR6moLu1BnuMJlz+sQM/hYpB8nsck= 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:138496 Archived-At: --=-=-= Content-Type: text/plain (car (last LIST)) does just what (gnus-last-element LIST) does, and is considerably more efficient. I think this is fairly uncontroversial, but will let it hang out a bit first in case anyone sees something I don't. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Remove-gnus-last-element.patch >From 63251a3248569df0fde85f52e3ce1f605e0c3b3a Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Tue, 9 May 2017 18:48:00 +0800 Subject: [PATCH] Remove gnus-last-element * lisp/gnus/gnus-range.el: Now better expressed as (car (last LIST)). * lisp/gnus/gnus-cache.el (gnus-cache-generate-active): * lisp/gnus/gnus-sum.el (gnus-select-newsgroup, gnus-summary-insert-articles): Replace calls. --- lisp/gnus/gnus-cache.el | 2 +- lisp/gnus/gnus-range.el | 6 ------ lisp/gnus/gnus-sum.el | 4 ++-- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lisp/gnus/gnus-cache.el b/lisp/gnus/gnus-cache.el index 12c8903d02..801728d2f2 100644 --- a/lisp/gnus/gnus-cache.el +++ b/lisp/gnus/gnus-cache.el @@ -735,7 +735,7 @@ gnus-cache-generate-active ;; `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) diff --git a/lisp/gnus/gnus-range.el b/lisp/gnus/gnus-range.el index b30b2e9099..3c84f9d69a 100644 --- a/lisp/gnus/gnus-range.el +++ b/lisp/gnus/gnus-range.el @@ -33,12 +33,6 @@ gnus-range-normalize If RANGE is a single range, return (RANGE). Otherwise, return RANGE." (if (listp (cdr-safe range)) range (list range))) -(defun gnus-last-element (list) - "Return last element of LIST." - (while (cdr list) - (setq list (cdr list))) - (car list)) - (defun gnus-copy-sequence (list) "Do a complete, total copy of a list." (let (out) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 48571096cc..22160e4142 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -5737,7 +5737,7 @@ gnus-select-newsgroup (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))))) @@ -12915,7 +12915,7 @@ gnus-summary-insert-articles (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)))) -- 2.14.2 --=-=-=--