;;; isearch.el --- incremental search minor mode
;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000,
-;; 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+;; 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu>
;; Maintainer: FSF
(defvar isearch-mode-map
(let* ((i 0)
(map (make-keymap)))
- (or (vectorp (nth 1 map))
- (char-table-p (nth 1 map))
+ (or (char-table-p (nth 1 map))
(error "The initialization of isearch-mode-map must be updated"))
;; 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))))
+ (set-char-table-range (nth 1 map) (cons #x100 (max-char))
+ 'isearch-printing-char)
;; Make function keys, etc, which aren't bound to a scrolling-function
;; exit the search.
(define-key map [t] 'isearch-other-control-char)
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 last killed text onto end of search string\
- and search for it.
+Type \\[isearch-yank-kill] to yank the last string of killed text.
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
(setq found t))
(setq quote-flag nil)))
(setq i (1+ i)))
- (not found)))
+ (not (or found
+ ;; Even if there's no uppercase char, we want to detect the use
+ ;; of [:upper:] or [:lower:] char-class, which indicates
+ ;; clearly that the user cares about case distinction.
+ (and regexp-flag (string-match "\\[:\\(upp\\|low\\)er:]" string)
+ (condition-case err
+ (progn
+ (string-match (substring string 0 (match-beginning 0))
+ "")
+ nil)
+ (invalid-regexp
+ (equal "Unmatched [ or [^" (cadr err)))))))))
;; Portability functions to support various Emacs versions.
(defvar isearch-lazy-highlight-window-end nil)
(defvar isearch-lazy-highlight-case-fold-search nil)
(defvar isearch-lazy-highlight-regexp nil)
+(defvar isearch-lazy-highlight-space-regexp nil)
(defun lazy-highlight-cleanup (&optional force)
"Stop lazy highlighting and remove extra highlighting from current buffer.
isearch-lazy-highlight-last-string isearch-string
isearch-lazy-highlight-case-fold-search isearch-case-fold-search
isearch-lazy-highlight-regexp isearch-regexp
- isearch-lazy-highlight-wrapped nil)
+ isearch-lazy-highlight-wrapped nil
+ isearch-lazy-highlight-space-regexp search-whitespace-regexp)
(unless (equal isearch-string "")
(setq isearch-lazy-highlight-timer
(run-with-idle-timer lazy-highlight-initial-delay nil
Attempt to do the search exactly the way the pending isearch would."
(let ((case-fold-search isearch-lazy-highlight-case-fold-search)
(isearch-regexp isearch-lazy-highlight-regexp)
- (search-spaces-regexp search-whitespace-regexp))
+ (search-spaces-regexp isearch-lazy-highlight-space-regexp))
(condition-case nil
(isearch-search-string
isearch-lazy-highlight-last-string