unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43056: [PATCH] eshell/em-hist.el: Remove unnecessary check
@ 2020-08-26  5:29 Brian Leung via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-08-26 10:01 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Leung via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-08-26  5:29 UTC (permalink / raw)
  To: 43056

[-- Attachment #1: Type: text/plain, Size: 133 bytes --]

There's no need to check n here since we're always taking the mod.

-- 
Sent with https://mailfence.com
Secure and private email

[-- Attachment #2: File Attachment: 0001-eshell-Remove-unnecessary-check-in-em-hist.patch --]
[-- Type: text/x-diff, Size: 1005 bytes --]

From 7d4843ecc817036158e77a3819f1545604602543 Mon Sep 17 00:00:00 2001
From: Brian Leung <leungbk@mailfence.com>
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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#43056: [PATCH] eshell/em-hist.el: Remove unnecessary check
  2020-08-26  5:29 bug#43056: [PATCH] eshell/em-hist.el: Remove unnecessary check Brian Leung via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-08-26 10:01 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-26 10:01 UTC (permalink / raw)
  To: Brian Leung; +Cc: 43056

Brian Leung <leungbk@mailfence.com> writes:

> There's no need to check n here since we're always taking the mod.

[...]

> -      (while (and (< n len) (not tried-each-ring-item)
> +      (while (and (not tried-each-ring-item)

Thanks; applied to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-26 10:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-26  5:29 bug#43056: [PATCH] eshell/em-hist.el: Remove unnecessary check Brian Leung via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-26 10:01 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).