Function: follow-avoid-tail-recenter

follow-avoid-tail-recenter is a byte-compiled function defined in follow.el.gz.

Signature

(follow-avoid-tail-recenter &rest REST)

Documentation

Make sure windows displaying the end of a buffer aren't recentered.

This is done by reading and rewriting the start position of non-first windows in Follow mode.

Source Code

;; Defined in /usr/src/emacs/lisp/follow.el.gz
;;; Avoid tail recenter

;; This sets the window internal flag `force_start'. The effect is
;; that windows only displaying the tail aren't recentered.
;;
;; A window displaying only the tail, is a window whose window-start
;; position is equal to (point-max) of the buffer it displays.

(defun follow-avoid-tail-recenter (&rest _rest)
  "Make sure windows displaying the end of a buffer aren't recentered.
This is done by reading and rewriting the start position of
non-first windows in Follow mode."
  (let* ((orig-buffer (current-buffer))
	 (top (frame-first-window))
	 (win top)
	 who) ; list of (buffer . frame)
    ;; If the only window in the frame is a minibuffer
    ;; window, `next-window' will never find it again...
    (unless (window-minibuffer-p top)
      (while  ;; look, no body!
	  (let ((start (window-start win))
		(pair (cons (window-buffer win) (window-frame win))))
	    (set-buffer (window-buffer win))
	    (cond ((null (member pair who))
		   (setq who (cons pair who)))
		  ((and follow-mode (eq (point-max) start))
		   ;; Write the same window start back, but don't
		   ;; set the NOFORCE flag.
		   (set-window-start win start)))
	    (setq win (next-window win 'not t))
	    (not (eq win top))))  ;; Loop while this is true.
      (set-buffer orig-buffer))))