Function: isearch-string-out-of-window

isearch-string-out-of-window is a byte-compiled function defined in isearch.el.gz.

Signature

(isearch-string-out-of-window ISEARCH-POINT)

Documentation

Test whether the search string is currently outside of the window.

Return nil if it's completely visible, or if point is visible, together with as much of the search string as will fit; the symbol above if we need to scroll the text downwards; the symbol below, if upwards.

Source Code

;; Defined in /usr/src/emacs/lisp/isearch.el.gz
(defun isearch-string-out-of-window (isearch-point)
  "Test whether the search string is currently outside of the window.
Return nil if it's completely visible, or if point is visible,
together with as much of the search string as will fit; the symbol
`above' if we need to scroll the text downwards; the symbol `below',
if upwards."
  (let ((w-start (window-group-start))
        (w-end (window-group-end nil t))
        (w-L1 (save-excursion
                (save-selected-window (move-to-window-group-line 1) (point))))
        (w-L-1 (save-excursion
                 (save-selected-window (move-to-window-group-line -1) (point))))
        start end)                  ; start and end of search string in buffer
    (if isearch-forward
        (setq end isearch-point  start (or isearch-other-end isearch-point))
      (setq start isearch-point  end (or isearch-other-end isearch-point)))
    (cond ((or (and (>= start w-start) (<= end w-end))
               (if isearch-forward
                   (and (>= isearch-point w-L-1) (< isearch-point w-end)) ; point on Line -1
                 (and (>= isearch-point w-start) (< isearch-point w-L1)))) ; point on Line 0
           nil)
          ((and (< start w-start)
                (< isearch-point w-L-1))
           'above)
          (t 'below))))