Function: vcursor-find-window
vcursor-find-window is a byte-compiled function defined in
vcursor.el.gz.
Signature
(vcursor-find-window &optional NOT-THIS NEW-WIN THIS-FRAME)
Documentation
Return a suitable window for displaying the virtual cursor.
This is the first window in cyclic order where the vcursor is visible.
With optional NOT-THIS non-nil never return the current window.
With NEW-WIN non-nil, display the virtual cursor buffer in another
window if the virtual cursor is not currently visible (note, however,
that this function never changes window-point).
With THIS-FRAME non-nil, don't search other frames for a new window
(though if the vcursor is already off-frame then its current window is
always considered, and the value of pop-up-frames is always respected).
Returns nil if the virtual cursor is not visible anywhere suitable.
Set vcursor-window to the returned value as a side effect.
Source Code
;; Defined in /usr/src/emacs/lisp/vcursor.el.gz
(defun vcursor-find-window (&optional not-this new-win this-frame)
"Return a suitable window for displaying the virtual cursor.
This is the first window in cyclic order where the vcursor is visible.
With optional NOT-THIS non-nil never return the current window.
With NEW-WIN non-nil, display the virtual cursor buffer in another
window if the virtual cursor is not currently visible \(note, however,
that this function never changes `window-point').
With THIS-FRAME non-nil, don't search other frames for a new window
\(though if the vcursor is already off-frame then its current window is
always considered, and the value of `pop-up-frames' is always respected).
Returns nil if the virtual cursor is not visible anywhere suitable.
Set `vcursor-window' to the returned value as a side effect."
;; The order of priorities (respecting NOT-THIS) is (1)
;; vcursor-window if the virtual cursor is visible there (2) any
;; window displaying the virtual cursor (3) vcursor-window provided
;; it is still displaying the buffer containing the virtual cursor and
;; is not selected (4) any unselected window displaying the vcursor
;; buffer (5) with NEW-WIN, a window selected by display-buffer (so
;; the variables pop-up-windows and pop-up-frames are significant)
;; (6) nil.
(let ((thiswin (selected-window)) winok winbuf)
(save-excursion
(vcursor-locate)
(or (and (window-live-p vcursor-window)
(eq (current-buffer) (window-buffer vcursor-window))
(not (and not-this (eq thiswin vcursor-window))))
(setq vcursor-window nil))
(or (and vcursor-window ; choice 1
(pos-visible-in-window-p (point) vcursor-window))
(progn
(walk-windows
(lambda (win)
(and (not winok)
(eq (current-buffer) (window-buffer win))
(not (and not-this (eq thiswin win)))
(cond
((pos-visible-in-window-p (point) win) (setq winok win))
((eq thiswin win))
((not winbuf) (setq winbuf win)))))
nil (not this-frame))
(setq vcursor-window
(cond
(winok) ; choice 2
((and vcursor-window ; choice 3
(not (eq thiswin vcursor-window)))
vcursor-window)
(winbuf) ; choice 4
(new-win (display-buffer (current-buffer) t)) ; choice 5
(t nil))))))) ; default (choice 6)
vcursor-window
)