Function: follow-pos-visible-in-window-p

follow-pos-visible-in-window-p is a byte-compiled function defined in follow.el.gz.

Signature

(follow-pos-visible-in-window-p &optional POS WINDOW PARTIALLY)

Documentation

Return non-nil if position POS is currently on the frame in one of the windows in the Follow Mode group which includes WINDOW.

WINDOW must be a live window and defaults to the selected one.

Return nil if that position is scrolled vertically out of view. If a character is only partially visible, nil is returned, unless the optional argument PARTIALLY is non-nil. If POS is only out of view because of horizontal scrolling, return non-nil. If POS is t, it specifies the position of the last visible glyph in WINDOW. POS defaults to point in WINDOW; WINDOW defaults to the selected window.

If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, the return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]), where X and Y are the pixel coordinates relative to the top left corner of the actual window containing it. The remaining elements are omitted if the character after POS is fully visible; otherwise, RTOP and RBOT are the number of pixels off-window at the top and bottom of the screen line ("row") containing POS, ROWH is the visible height of that row, and VPOS is the row number (zero-based).

Source Code

;; Defined in /usr/src/emacs/lisp/follow.el.gz
(defun follow-pos-visible-in-window-p (&optional pos window partially)
  "Return non-nil if position POS is currently on the frame in one of
the windows in the Follow Mode group which includes WINDOW.

WINDOW must be a live window and defaults to the selected one.

Return nil if that position is scrolled vertically out of view.  If a
character is only partially visible, nil is returned, unless the
optional argument PARTIALLY is non-nil.  If POS is only out of view
because of horizontal scrolling, return non-nil.  If POS is t, it
specifies the position of the last visible glyph in WINDOW.  POS
defaults to point in WINDOW; WINDOW defaults to the selected window.

If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil,
the return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]),
where X and Y are the pixel coordinates relative to the top left corner
of the actual window containing it.  The remaining elements are
omitted if the character after POS is fully visible; otherwise, RTOP
and RBOT are the number of pixels off-window at the top and bottom of
the screen line (\"row\") containing POS, ROWH is the visible height
of that row, and VPOS is the row number \(zero-based)."
  (let* ((windows (follow-all-followers window)))
    (when follow-start-end-invalid
      (follow-redisplay windows (car windows)))
    (let* ((cache (follow-windows-start-end windows))
           (last-elt (car (last cache)))
           our-pos pertinent-elt)
      (setq pertinent-elt
            (if (eq pos t)
                last-elt
              (setq our-pos (or pos (point)))
              (catch 'element
                (while cache
                  (when (< our-pos (nth 2 (car cache)))
                    (throw 'element (car cache)))
                  (setq cache (cdr cache)))
                last-elt)))
      (pos-visible-in-window-p our-pos (car pertinent-elt) partially))))