Function: isearch-lazy-highlight-buffer-update
isearch-lazy-highlight-buffer-update is a byte-compiled function
defined in isearch.el.gz.
Signature
(isearch-lazy-highlight-buffer-update)
Documentation
Update highlighting of other matches in the full buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/isearch.el.gz
(defun isearch-lazy-highlight-buffer-update ()
"Update highlighting of other matches in the full buffer."
(let ((max lazy-highlight-buffer-max-at-a-time)
(looping t)
nomore opoint window-start window-end)
(with-local-quit
(save-selected-window
(if (and (window-live-p isearch-lazy-highlight-window)
(not (memq (selected-window) isearch-lazy-highlight-window-group)))
(select-window isearch-lazy-highlight-window))
(setq opoint (point))
(setq window-start (window-group-start))
(setq window-end (window-group-end))
(save-excursion
(save-match-data
(goto-char (if isearch-lazy-highlight-forward
isearch-lazy-highlight-end
isearch-lazy-highlight-start))
(while looping
(let* ((bound (if isearch-lazy-highlight-forward
(or isearch-lazy-highlight-end-limit (point-max))
(or isearch-lazy-highlight-start-limit (point-min))))
(found (isearch-lazy-highlight-search
isearch-lazy-highlight-last-string
bound)))
(when max
(setq max (1- max))
(if (<= max 0)
(setq looping nil)))
(if found
(let ((mb (match-beginning 0))
(me (match-end 0)))
(if (= mb me) ;zero-length match
(if isearch-lazy-highlight-forward
(if (= mb (point-max))
(setq found nil)
(forward-char 1))
(if (= mb (point-min))
(setq found nil)
(forward-char -1)))
(when isearch-lazy-count
(setq isearch-lazy-count-total
(1+ (or isearch-lazy-count-total 0)))
(puthash (if isearch-lazy-highlight-forward me mb)
isearch-lazy-count-total
isearch-lazy-count-hash))
;; Don't highlight the match when this loop is used
;; only to count matches or when matches were already
;; highlighted within the current window boundaries
;; by isearch-lazy-highlight-update
(unless (or (not isearch-lazy-highlight-buffer)
(and (>= mb window-start) (<= me window-end)))
;; non-zero-length match
(isearch-lazy-highlight-match mb me)))
;; Remember the current position of point for
;; the next call of `isearch-lazy-highlight-update'
;; when `lazy-highlight-buffer-max-at-a-time' is too small.
(if isearch-lazy-highlight-forward
(setq isearch-lazy-highlight-end (point))
(setq isearch-lazy-highlight-start (point)))))
;; not found or zero-length match at the search bound
(if (not found)
(setq looping nil
nomore t))))
(if nomore
(when (and isearch-lazy-count isearch-mode (null isearch-message-function))
(unless isearch-lazy-count-total
(setq isearch-lazy-count-total 0))
(setq isearch-lazy-count-current
(gethash opoint isearch-lazy-count-hash 0))
(isearch-message))
(setq isearch-lazy-highlight-timer
(run-at-time lazy-highlight-interval nil
'isearch-lazy-highlight-buffer-update)))))))))