diff lisp/isearch-mode.el @ 272:c5d627a313b1 r21-0b34

Import from CVS: tag r21-0b34
author cvs
date Mon, 13 Aug 2007 10:28:48 +0200
parents 157b30c96d03
children afd57c14dfc8
line wrap: on
line diff
--- a/lisp/isearch-mode.el	Mon Aug 13 10:27:41 2007 +0200
+++ b/lisp/isearch-mode.el	Mon Aug 13 10:28:48 2007 +0200
@@ -283,6 +283,7 @@
 (defvar isearch-other-end nil)	; Start (end) of match if forward (backward).
 (defvar isearch-wrapped nil)	; Searching restarted from the top (bottom).
 (defvar isearch-barrier 0)
+(defvar isearch-just-started nil)
 (defvar isearch-buffer nil)	; the buffer we've frobbed the keymap of
 
 (defvar isearch-case-fold-search nil)
@@ -453,6 +454,7 @@
 					     (* 4 search-slow-window-lines)))
 	  isearch-other-end nil
 	  isearch-small-window nil
+	  isearch-just-started t
 
 	  isearch-opoint (point)
 	  isearch-window-configuration (current-window-configuration)
@@ -802,22 +804,24 @@
     (setq isearch-forward (not isearch-forward)))
 
   (setq isearch-barrier (point)) ; For subsequent \| if regexp.
-  (setq isearch-success t)
-  (or (equal isearch-string "")
+  (if (equal isearch-string "")
+      (setq isearch-success t)
+    (if (and (equal (match-end 0) (match-beginning 0))
+	     isearch-success
+	     (not isearch-just-started))
 	;; If repeating a search that found
 	;; an empty string, ensure we advance.
-	(if (equal (match-end 0) (match-beginning 0))
-	    (if (if isearch-forward (eobp) (bobp))
-		;; nowhere to advance to, so fail (and wrap next time)
-		(progn
-		  (setq isearch-success nil)
-		  (and executing-kbd-macro
-		       (not defining-kbd-macro)
-		       (isearch-done))
-		  (ding nil 'isearch-failed))
-	      (forward-char (if isearch-forward 1 -1))
-	      (isearch-search))
-	  (isearch-search)))
+	(if (if isearch-forward (eobp) (bobp))
+	    ;; nowhere to advance to, so fail (and wrap next time)
+	    (progn
+	      (setq isearch-success nil)
+	      (and executing-kbd-macro
+		   (not defining-kbd-macro)
+		   (isearch-done))
+	      (ding nil 'isearch-failed))
+	  (forward-char (if isearch-forward 1 -1))
+	  (isearch-search))
+      (isearch-search)))
   (isearch-push-state)
   (isearch-update))
 
@@ -1509,6 +1513,7 @@
 		     (t
 		      (if isearch-forward 'search-forward 'search-backward)))
 	       isearch-string nil t))
+	(setq isearch-just-started nil)
 	(if isearch-success
 	    (setq isearch-other-end
 		  (if isearch-forward (match-beginning 0) (match-end 0)))))