diff lisp/isearch-mode.el @ 318:afd57c14dfc8 r21-0b57

Import from CVS: tag r21-0b57
author cvs
date Mon, 13 Aug 2007 10:45:36 +0200
parents c5d627a313b1
children 19dcec799385
line wrap: on
line diff
--- a/lisp/isearch-mode.el	Mon Aug 13 10:44:47 2007 +0200
+++ b/lisp/isearch-mode.el	Mon Aug 13 10:45:36 2007 +0200
@@ -936,6 +936,20 @@
   (interactive)
   (isearch-yank (x-get-clipboard)))
 
+(defun isearch-fix-case ()
+  (if (and isearch-case-fold-search search-caps-disable-folding)
+      (setq isearch-case-fold-search (isearch-no-upper-case-p isearch-string)))
+  (setq isearch-mode (if case-fold-search
+                         (if isearch-case-fold-search
+                             " Isearch"  ;As God Intended Mode
+			   " ISeARch") ;Warn about evil case via StuDLYcAps.
+		       "Isearch"
+;		         (if isearch-case-fold-search
+;                            " isearch"    ;Presumably case-sensitive losers
+;                                          ;will notice this 1-char difference.
+;                            " Isearch")   ;Weenie mode.
+			 )))
+
 (defun isearch-search-and-update ()
   ;; Do the search and update the display.
   (if (and (not isearch-success)
@@ -951,12 +965,15 @@
     ;; long as the match does not extend past search origin.
     (if (and (not isearch-forward) (not isearch-adjusted)
 	     (condition-case ()
-		 (looking-at (if isearch-regexp isearch-string
-			       (regexp-quote isearch-string)))
+		 (progn
+		   (isearch-fix-case)
+		   (let ((case-fold-search isearch-case-fold-search))
+		     (looking-at (if isearch-regexp isearch-string
+				   (regexp-quote isearch-string)))))
 	       (error nil))
-	       (or isearch-yank-flag
-		   (<= (match-end 0) 
-		       (min isearch-opoint isearch-barrier))))
+	     (or isearch-yank-flag
+		 (<= (match-end 0) 
+		     (min isearch-opoint isearch-barrier))))
 	(setq isearch-success t 
 	      isearch-invalid-regexp nil
 	      isearch-other-end (match-end 0))
@@ -1460,12 +1477,9 @@
   (if (null isearch-highlight)
       nil
     ;; make sure isearch-extent is in the current buffer
-    (cond ((not (extentp isearch-extent))
-	   (isearch-make-extent begin end))
-	  ((not (eq (extent-object isearch-extent) (current-buffer)))
-	   (delete-extent isearch-extent)
-	   (isearch-make-extent begin end)))
-    (set-extent-endpoints isearch-extent begin end)))
+    (or (extentp isearch-extent)
+	(isearch-make-extent begin end))
+    (set-extent-endpoints isearch-extent begin end (current-buffer))))
 
 (defun isearch-dehighlight (totally)
   (if (and isearch-highlight isearch-extent)
@@ -1485,19 +1499,7 @@
 (defun isearch-search ()
   ;; Do the search with the current search string.
   (isearch-message nil t)
-  (if (and isearch-case-fold-search search-caps-disable-folding)
-      (setq isearch-case-fold-search (isearch-no-upper-case-p isearch-string)))
-
-  (setq isearch-mode (if case-fold-search
-                         (if isearch-case-fold-search
-                             " Isearch"  ;As God Intended Mode
-                             " ISeARch") ;Warn about evil case via StuDLYcAps.
-		         "Isearch"
-;		         (if isearch-case-fold-search
-;                            " isearch"    ;Presumably case-sensitive losers
-;                                          ;will notice this 1-char difference.
-;                            " Isearch")   ;Weenie mode.
-			 ))
+  (isearch-fix-case)
   (condition-case lossage
       (let ((inhibit-quit nil)
 	    (case-fold-search isearch-case-fold-search))