(tibetan-pre-write-conversion): Cancel previous
[bpt/emacs.git] / lisp / isearch.el
index 007801b..aef204c 100644 (file)
@@ -140,7 +140,7 @@ apply to chars in regexps that are prefixed with `\\'.
 If this value is `not-yanks', yanked text is always downcased."
   :type '(choice (const :tag "off" nil)
                 (const not-yanks)
-                (sexp :tag "on" :format "%t\n" t))
+                (other :tag "on" t))
   :group 'isearch)
 
 (defcustom search-nonincremental-instead t
@@ -153,7 +153,9 @@ string, and RET terminates editing and does a nonincremental search."
 (defcustom search-whitespace-regexp "\\s-+"
   "*If non-nil, regular expression to match a sequence of whitespace chars.
 This applies to regular expression incremental search.
-You might want to use something like \"[ \\t\\r\\n]+\" instead."
+You might want to use something like \"[ \\t\\r\\n]+\" instead.
+In the Customization buffer, that is `[' followed by a space,
+a tab, a carriage return (control-M), a newline, and `]+'."
   :type 'regexp
   :group 'isearch)
 
@@ -229,13 +231,12 @@ Default value, nil, means edit the string instead."
       (or (vectorp (nth 1 map))
          (char-table-p (nth 1 map))
          (error "The initialization of isearch-mode-map must be updated"))
-      ;; Make Latin-1, Latin-2, Latin-3 and Latin-4 characters
-      ;; search for themselves.
-      (aset (nth 1 map) (make-char 'latin-iso8859-1) 'isearch-printing-char)
-      (aset (nth 1 map) (make-char 'latin-iso8859-2) 'isearch-printing-char)
-      (aset (nth 1 map) (make-char 'latin-iso8859-3) 'isearch-printing-char)
-      (aset (nth 1 map) (make-char 'latin-iso8859-4) 'isearch-printing-char)
-      (aset (nth 1 map) (make-char 'latin-iso8859-9) 'isearch-printing-char)
+      ;; Make all multibyte characters search for themselves.
+      (let ((l (generic-character-list))
+           (table (nth 1 map)))
+       (while l
+         (set-char-table-default table (car l) 'isearch-printing-char)
+         (setq l (cdr l))))
       ;; Make function keys, etc, exit the search.
       (define-key map [t] 'isearch-other-control-char)
       ;; Control chars, by default, end isearch mode transparently.
@@ -388,6 +389,13 @@ Default value, nil, means edit the string instead."
 ;; Accumulate here the overlays opened during searching.
 (defvar isearch-opened-overlays nil)
 
+;; The value of input-method-function when isearch is invoked.
+(defvar isearch-input-method-function nil)
+
+;; A flag to tell if input-method-function is locally bound when
+;; isearch is invoked.
+(defvar isearch-input-method-local-p nil)
+
 ;; Minor-mode-alist changes - kind of redundant with the
 ;; echo area, but if isearching in multiple windows, it can be useful.
 
@@ -425,7 +433,8 @@ Type \\[isearch-yank-word] to yank word from buffer onto end of search\
  string and search for it.
 Type \\[isearch-yank-line] to yank rest of line onto end of search string\
  and search for it.
-Type \\[isearch-yank-kill] to yank the last string of killed text.
+Type \\[isearch-yank-kill] to yank last killed text onto end of search string\
+ and search for it.
 Type \\[isearch-quote-char] to quote control character to search for it.
 \\[isearch-abort] while searching or when search has failed cancels input\
  back to what has
@@ -524,7 +533,17 @@ is treated as a regexp.  See \\[isearch-forward] for more info."
        isearch-opoint (point)
        search-ring-yank-pointer nil
        isearch-opened-overlays nil
+       isearch-input-method-function input-method-function
+       isearch-input-method-local-p (local-variable-p 'input-method-function)
        regexp-search-ring-yank-pointer nil)
+
+  ;; We must bypass input method while reading key.  When a user type
+  ;; printable character, appropriate input method is turned on in
+  ;; minibuffer to read multibyte charactes.
+  (or isearch-input-method-local-p
+      (make-local-variable 'input-method-function))
+  (setq input-method-function nil)
+
   (looking-at "")
   (setq isearch-window-configuration
        (if isearch-slow-terminal-mode (current-window-configuration) nil))
@@ -622,6 +641,10 @@ is treated as a regexp.  See \\[isearch-forward] for more info."
                  (message "Mark saved where search started"))))))
 
   (setq isearch-mode nil)
+  (if isearch-input-method-local-p
+      (setq input-method-function isearch-input-method-function)
+    (kill-local-variable 'input-method-function))
+
   (force-mode-line-update)
 
   (if (and (> (length isearch-string) 0) (not nopush))
@@ -1009,6 +1032,9 @@ To do that, evaluate these expressions:
     (if (and (not isearch-forward) (not isearch-adjusted)
             (condition-case ()
                 (let ((case-fold-search isearch-case-fold-search))
+                  (if (and (eq case-fold-search t) search-upper-case)
+                      (setq case-fold-search
+                            (isearch-no-upper-case-p isearch-string isearch-regexp)))
                   (looking-at (if isearch-regexp isearch-string
                                 (regexp-quote isearch-string))))
               (error nil))