;;; isearch.el --- incremental search minor mode
-;; Copyright (C) 1992-1997, 1999-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1997, 1999-2013 Free Software Foundation, Inc.
;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu>
;; Maintainer: FSF
(defvar isearch-message-function nil
"Function to call to display the search prompt.
-If nil, use `isearch-message'.")
+If nil, use function `isearch-message'.")
(defvar isearch-wrap-function nil
"Function to call to wrap the search when search is failed.
(defun isearch-fail-pos (&optional msg)
"Return position of first mismatch in search string, or nil if none.
-If MSG is non-nil, use `isearch-message', otherwise `isearch-string'."
+If MSG is non-nil, use variable `isearch-message', otherwise `isearch-string'."
(let ((cmds isearch-cmds)
(curr-msg (if msg isearch-message isearch-string))
succ-msg)
;; the user adds and removes characters in the search string
;; (or when using nonincremental word isearch)
(let ((lax (not (or isearch-nonincremental
+ (null (car isearch-cmds))
(eq (length isearch-string)
(length (isearch--state-string
(car isearch-cmds))))))))
(setq isearch-lazy-highlight-window (selected-window)
isearch-lazy-highlight-window-start (window-start)
isearch-lazy-highlight-window-end (window-end)
- isearch-lazy-highlight-start (point)
- isearch-lazy-highlight-end (point)
+ ;; Start lazy-highlighting at the beginning of the found
+ ;; match (`isearch-other-end'). If no match, use point.
+ ;; One of the next two variables (depending on search direction)
+ ;; is used to define the starting position of lazy-highlighting
+ ;; and also to remember the current position of point between
+ ;; calls of `isearch-lazy-highlight-update', and another variable
+ ;; is used to define where the wrapped search must stop.
+ isearch-lazy-highlight-start (or isearch-other-end (point))
+ isearch-lazy-highlight-end (or isearch-other-end (point))
isearch-lazy-highlight-wrapped nil
isearch-lazy-highlight-last-string isearch-string
isearch-lazy-highlight-case-fold-search isearch-case-fold-search
(overlay-put ov 'priority 1000)
(overlay-put ov 'face lazy-highlight-face)
(overlay-put ov 'window (selected-window))))
+ ;; Remember the current position of point for
+ ;; the next call of `isearch-lazy-highlight-update'
+ ;; when `lazy-highlight-max-at-a-time' is too small.
(if isearch-lazy-highlight-forward
(setq isearch-lazy-highlight-end (point))
(setq isearch-lazy-highlight-start (point)))))