From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Brian Leung via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#43056: [PATCH] eshell/em-hist.el: Remove unnecessary check Date: Wed, 26 Aug 2020 07:29:03 +0200 (CEST) Message-ID: <527934444.146287.1598419743729@ichabod.co-bxl> Reply-To: Brian Leung , Brian Leung Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_146172_1068100156.1598419612919" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20991"; mail-complaints-to="usenet@ciao.gmane.io" To: 43056@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 26 09:35:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kApxf-0005Lu-G9 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 26 Aug 2020 09:35:11 +0200 Original-Received: from localhost ([::1]:56894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kApxe-0005v4-3Q for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 26 Aug 2020 03:35:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kApxX-0005ub-2u for bug-gnu-emacs@gnu.org; Wed, 26 Aug 2020 03:35:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53931) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kApxW-0000RW-Pr for bug-gnu-emacs@gnu.org; Wed, 26 Aug 2020 03:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kApxW-00082f-NY for bug-gnu-emacs@gnu.org; Wed, 26 Aug 2020 03:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Brian Leung Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Aug 2020 07:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43056 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.159842725930850 (code B ref -1); Wed, 26 Aug 2020 07:35:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Aug 2020 07:34:19 +0000 Original-Received: from localhost ([127.0.0.1]:37242 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kApwo-00081U-08 for submit@debbugs.gnu.org; Wed, 26 Aug 2020 03:34:19 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:37534) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAnzm-0004mn-2i for submit@debbugs.gnu.org; Wed, 26 Aug 2020 01:29:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAnzl-0006s4-Sf for bug-gnu-emacs@gnu.org; Wed, 26 Aug 2020 01:29:13 -0400 Original-Received: from wilbur.contactoffice.com ([212.3.242.68]:35894) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAnzj-0002Sg-Kc for bug-gnu-emacs@gnu.org; Wed, 26 Aug 2020 01:29:13 -0400 Original-Received: from ichabod.co-bxl (ichabod.co-bxl [10.2.0.36]) by wilbur.contactoffice.com (Postfix) with ESMTP id 315ED11A1 for ; Wed, 26 Aug 2020 07:29:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailfence.com; s=20160819-nLV10XS2; t=1598419747; bh=ZT1j9yl1CKEvEyHZpvi89yfPIAg6i52Q9KUZl5VHhTU=; h=Date:Subject:Reply-To:From:To:From; b=RQnYbqb4qU7B+NUf7QHlutMizhAyinqpry88DQ+9WCt6fLEkeuKsXfMc2E7mEadbZ ngI8y9PaKgyOMWBiv7BmVC4WiBX/dQPjHhYyQcYYY82Lvn3fClal8o1ennVYO1wA7o 5TwWj131bNBTbdjuN2yRa/ljastaoO4DnRTWM355OMMLsEYJ5hLCW1bgCucGNqeCrU 4D2PrdB0gFE4bmPipF2Ogqc8T4eBjRCQ+nTcJ0x9QVW+Yk3QGX70VtQGROAEdJTKAg P3VSZTSfHTZdPGWQWMXFMdbVIQ3J2+ZTjKAGI9DiJT00gIuP3UAexd/cvP8xUXmAiO 7Ol4Iu8xdyt1g== X-Priority: 3 X-Mailer: ContactOffice Mail X-ContactOffice-Account: com:225491745 Received-SPF: pass client-ip=212.3.242.68; envelope-from=leungbk@mailfence.com; helo=wilbur.contactoffice.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/26 01:29:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 26 Aug 2020 03:34:17 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:186400 Archived-At: ------=_Part_146172_1068100156.1598419612919 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable There's no need to check n here since we're always taking the mod. --=C2=A0 Sent with https://mailfence.com Secure and private email ------=_Part_146172_1068100156.1598419612919 Content-Type: text/x-diff; charset=us-ascii; name=0001-eshell-Remove-unnecessary-check-in-em-hist.patch Content-Transfer-Encoding: 7bit Content-Description: File Attachment: 0001-eshell-Remove-unnecessary-check-in-em-hist.patch Content-Disposition: attachment; filename=0001-eshell-Remove-unnecessary-check-in-em-hist.patch >From 7d4843ecc817036158e77a3819f1545604602543 Mon Sep 17 00:00:00 2001 From: Brian Leung Date: Tue, 25 Aug 2020 22:06:51 -0700 Subject: [PATCH] eshell: Remove unnecessary check in em-hist Both before and within the while loop, n is always between [0, len] inclusive. Copyright-paperwork-exempt: yes --- lisp/eshell/em-hist.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 267936583e..5cee1bad36 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -862,7 +862,7 @@ eshell-previous-matching-input-string-position (setq prev n n (mod (+ n motion) len)) ;; If we haven't reached a match, step some more. - (while (and (< n len) (not tried-each-ring-item) + (while (and (not tried-each-ring-item) (not (string-match regexp (eshell-get-history n)))) (setq n (mod (+ n motion) len) ;; If we have gone all the way around in this search. -- 2.28.0 ------=_Part_146172_1068100156.1598419612919--