# HG changeset patch # User Richard M. Stallman # Date 757532596 0 # Node ID c002b55b9cac9c6cf94d7853ff2b5e6d0fefd394 # Parent c96b98efb5b4e81d6b2d608004c56f9056beee49 (isearch-repeat): If we matched a null string and there's no place to advance to, fail instead. diff -r c96b98efb5b4 -r c002b55b9cac lisp/isearch.el --- a/lisp/isearch.el Sat Jan 01 18:01:49 1994 +0000 +++ b/lisp/isearch.el Sun Jan 02 17:43:16 1994 +0000 @@ -4,7 +4,7 @@ ;; Author: Daniel LaLiberte -;; |$Date: 1993/12/24 03:30:11 $|$Revision: 1.57 $ +;; |$Date: 1993/12/25 00:50:10 $|$Revision: 1.58 $ ;; This file is part of GNU Emacs. @@ -838,14 +838,21 @@ (setq isearch-forward (not isearch-forward))) (setq isearch-barrier (point)) ; For subsequent \| if regexp. - (setq isearch-success t) - (or (equal isearch-string "") - (progn + + (if (equal isearch-string "") + (setq isearch-success t) + (if (and isearch-success (equal (match-end 0) (match-beginning 0))) ;; If repeating a search that found ;; an empty string, ensure we advance. - (if (equal (match-end 0) (match-beginning 0)) - (forward-char (if isearch-forward 1 -1))) - (isearch-search))) + (if (if isearch-forward (eobp) (bobp)) + ;; If there's nowhere to advance to, fail (and wrap next time). + (progn + (setq isearch-success nil) + (ding)) + (forward-char (if isearch-forward 1 -1)) + (isearch-search)) + (isearch-search))) + (isearch-push-state) (isearch-update))