Function: follow-select-if-end-visible

follow-select-if-end-visible is a byte-compiled function defined in follow.el.gz.

Signature

(follow-select-if-end-visible WIN-START-END)

Documentation

Select and return a window, if end is visible in it.

Source Code

;; Defined in /usr/src/emacs/lisp/follow.el.gz
;; Lets select a window showing the end. Make sure we only select it if
;; it wasn't just moved here.  (I.e. M-> shall not unconditionally place
;; point in the selected window.)
;;
;; (Compatibility kludge: in Emacs `window-end' is equal to `point-max';
;; in XEmacs, it is equal to `point-max + 1'.  Should I really bother
;; checking `window-end' now when I check `end-of-buffer' explicitly?)

(defun follow-select-if-end-visible (win-start-end)
  "Select and return a window, if end is visible in it."
  (let ((win nil))
    (while (and (not win) win-start-end)
      ;; Don't select a window that was just moved. This makes it
      ;; possible to later select the last window after a `end-of-buffer'
      ;; command.
      (if (and (eq (point-max) (nth 2 (car win-start-end)))
	       (nth 3 (car win-start-end))
	       ;; `window-end' might return nil.
	       (let ((end (window-end (car (car win-start-end)))))
		 (and end
		      (eq (point-max) (min (point-max) end)))))
	  (progn
	    (setq win (car (car win-start-end)))
	    (select-window win)))
      (setq win-start-end (cdr win-start-end)))
    win))