Function: isearch-update
isearch-update is a byte-compiled function defined in isearch.el.gz.
Signature
(isearch-update)
Documentation
This is called after every isearch command to update the display.
The second last thing it does is to run isearch-update-post-hook.
The last thing is to trigger a new round of lazy highlighting.
Probably introduced at or before Emacs version 24.1.
Source Code
;; Defined in /usr/src/emacs/lisp/isearch.el.gz
(defun isearch-update ()
"This is called after every isearch command to update the display.
The second last thing it does is to run `isearch-update-post-hook'.
The last thing is to trigger a new round of lazy highlighting."
(unless (eq (current-buffer) isearch--current-buffer)
(when (buffer-live-p isearch--current-buffer)
(with-current-buffer isearch--current-buffer
(setq cursor-sensor-inhibit (delq 'isearch cursor-sensor-inhibit))))
(setq isearch--current-buffer (current-buffer))
(make-local-variable 'cursor-sensor-inhibit)
;; Suspend things like cursor-intangible during Isearch so we can search
;; even within intangible text.
(push 'isearch cursor-sensor-inhibit))
(if (and (null unread-command-events)
(null executing-kbd-macro))
(progn
(if (not (input-pending-p))
(funcall (or isearch-message-function #'isearch-message)))
(if (and isearch-slow-terminal-mode
(not (or isearch-small-window
(pos-visible-in-window-group-p))))
(let ((found-point (point)))
(setq isearch-small-window t)
(move-to-window-line 0)
(let ((window-min-height 1))
(split-window nil (if (< search-slow-window-lines 0)
(1+ (- search-slow-window-lines))
(- (window-height)
(1+ search-slow-window-lines)))))
(if (< search-slow-window-lines 0)
(progn (vertical-motion (- 1 search-slow-window-lines))
(set-window-start (next-window) (point))
(set-window-hscroll (next-window)
(window-hscroll))
(set-window-hscroll (selected-window) 0))
(other-window 1))
(goto-char found-point))
;; Keep same hscrolling as at the start of the search when possible
(let ((current-scroll (window-hscroll))
visible-p)
(set-window-hscroll (selected-window) isearch-start-hscroll)
(setq visible-p (pos-visible-in-window-group-p nil nil t))
(if (or (not visible-p)
;; When point is not visible because of hscroll,
;; pos-visible-in-window-group-p returns non-nil, but
;; the X coordinate it returns is 1 pixel beyond
;; the last visible one.
(>= (car visible-p)
(* (window-max-chars-per-line) (frame-char-width)))
(< (car visible-p) 0))
(set-window-hscroll (selected-window) current-scroll))))
(if isearch-other-end
(if (< isearch-other-end (point)) ; isearch-forward?
(isearch-highlight isearch-other-end (point) isearch-match-data)
(isearch-highlight (point) isearch-other-end isearch-match-data))
(isearch-dehighlight))))
(setq ;; quit-flag nil not for isearch-mode
isearch-adjusted nil
isearch-yank-flag nil)
;; We must prevent the point moving to the end of composition when a
;; part of the composition has just been searched.
(setq disable-point-adjustment t)
(run-hooks 'isearch-update-post-hook)
(when isearch-lazy-highlight
(isearch-lazy-highlight-new-loop)))