;;; isearch.el --- incremental search minor mode
-;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000,
-;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001,
+;; 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+;; Free Software Foundation, Inc.
;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu>
;; Maintainer: FSF
"Function to save a function restoring the mode-specific Isearch state
to the search status stack.")
-(defvar isearch-filter-predicate 'isearch-filter-invisible
+(defvar isearch-filter-predicate 'isearch-filter-visible
"Predicate that filters the search hits that would normally be available.
Search hits that dissatisfy the predicate are skipped. The function
has two arguments: the positions of start and end of text matched by
"Face for lazy highlighting of matches other than the current one."
:group 'lazy-highlight
:group 'basic-faces)
-(put 'isearch-lazy-highlight-face 'face-alias 'lazy-highlight)
+(define-obsolete-face-alias 'isearch-lazy-highlight-face 'lazy-highlight "22.1")
(defvar lazy-highlight-face 'lazy-highlight)
(define-obsolete-variable-alias 'isearch-lazy-highlight-face
'lazy-highlight-face
(eval-when-compile (require 'help-macro))
(make-help-screen isearch-help-for-help-internal
- "Type a help option: [bkm] or ?"
+ (purecopy "Type a help option: [bkm] or ?")
"You have typed %THIS-KEY%, the help character. Type a Help option:
\(Type \\<help-map>\\[help-quit] to exit the Help command.)
(defvar isearch-just-started nil)
(defvar isearch-start-hscroll 0) ; hscroll when starting the search.
-; case-fold-search while searching.
-; either nil, t, or 'yes. 'yes means the same as t except that mixed
-; case in the search string is ignored.
+;; case-fold-search while searching.
+;; either nil, t, or 'yes. 'yes means the same as t except that mixed
+;; case in the search string is ignored.
(defvar isearch-case-fold-search nil)
(defvar isearch-last-case-fold-search nil)
;; ;; First terminate isearch-mode.
;; (isearch-done)
;; (isearch-clean-overlays)
-;; (handle-switch-frame (car (cdr last-command-char))))
+;; (handle-switch-frame (car (cdr last-command-event))))
\f
;; The search status structure and stack.
(interactive "p")
(if (eobp)
(insert
- (save-excursion
- (set-buffer (cadr (buffer-list)))
+ (with-current-buffer (cadr (buffer-list))
(buffer-substring-no-properties
(point) (progn (forward-char arg) (point)))))
(forward-char arg)))
(windowp window)
(or (> (minibuffer-depth) 0)
(not (window-minibuffer-p window))))
- (save-excursion
- (set-buffer (window-buffer window))
+ (with-current-buffer (window-buffer window)
(isearch-done)
(isearch-clean-overlays))
(isearch-done)
(defun isearch-printing-char ()
"Add this ordinary printing character to the search string and search."
(interactive)
- (let ((char last-command-char))
+ (let ((char last-command-event))
(if (= char ?\S-\ )
(setq char ?\s))
(if current-input-method
(let* ((func (isearch-search-fun))
(pos1 (save-excursion (funcall func string bound noerror)))
pos2)
- (when (and (char-table-p translation-table-for-input)
- (multibyte-string-p string)
- ;; Minor optimization.
- (string-match-p "[^[:ascii:]]" string))
+ (when (and
+ ;; Avoid "obsolete" warnings for translation-table-for-input.
+ (with-no-warnings
+ (char-table-p translation-table-for-input))
+ (multibyte-string-p string)
+ ;; Minor optimization.
+ (string-match-p "[^[:ascii:]]" string))
(let ((translated
(apply 'string
(mapcar (lambda (c)
- (or (aref translation-table-for-input c) c))
+ (or
+ ;; Avoid "obsolete" warnings for
+ ;; translation-table-for-input.
+ (with-no-warnings
+ (aref translation-table-for-input c))
+ c))
string)))
match-data)
(when translated
(isearch-no-upper-case-p isearch-string isearch-regexp)))
(condition-case lossage
(let ((inhibit-point-motion-hooks
- (and (eq isearch-filter-predicate 'isearch-filter-invisible)
+ (and (eq isearch-filter-predicate 'isearch-filter-visible)
search-invisible))
(inhibit-quit nil)
(case-fold-search isearch-case-fold-search)
nil)
(setq isearch-hidden t)))))))
-(defun isearch-filter-invisible (beg end)
- "Default predicate to filter out invisible text.
-It filters search hits to those that are visible (at least partially),
-unless invisible text too can be searched."
+(defun isearch-filter-visible (beg end)
+ "Test whether the current search hit is visible at least partially.
+Return non-nil if the text from BEG to END is visible to Isearch as
+determined by `isearch-range-invisible' unless invisible text can be
+searched too when `search-invisible' is t."
(or (eq search-invisible t)
(not (isearch-range-invisible beg end))))
(defun isearch-text-char-description (c)
(cond
- ((< c ?\s) (format "^%c" (+ c 64)))
- ((= c ?\^?) "^?")
+ ((< c ?\s) (propertize (format "^%c" (+ c 64)) 'face 'escape-glyph))
+ ((= c ?\^?) (propertize "^?" 'face 'escape-glyph))
(t (char-to-string c))))
;; General function to unread characters or events.