Function: follow-recenter

follow-recenter is an interactive and byte-compiled function defined in follow.el.gz.

Signature

(follow-recenter &optional ARG)

Documentation

Recenter the middle window around point.

Rearrange all other windows around the middle window.

With a positive argument, place the current line ARG lines from the top. With a negative argument, place it -ARG lines from the bottom.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/follow.el.gz
;;; Redraw

(defun follow-recenter (&optional arg)
  "Recenter the middle window around point.
Rearrange all other windows around the middle window.

With a positive argument, place the current line ARG lines
from the top.  With a negative argument, place it -ARG lines
from the bottom."
  (interactive "P")
  (if arg
      (let ((p (point))
	    (arg (prefix-numeric-value arg)))
	(if (>= arg 0)
	    ;; Recenter relative to the top.
	    (progn
	      (follow-first-window)
	      (goto-char p)
	      (recenter arg))
	  ;; Recenter relative to the bottom.
	  (follow-last-window)
	  (goto-char p)
	  (recenter arg)
	  ;; Otherwise, our post-command-hook will move the window
	  ;; right back.
	  (setq follow-internal-force-redisplay t)))
    ;; Recenter in the middle.
    (let* ((dest (point))
	   (windows (follow-all-followers))
	   (win (nth (/ (- (length windows) 1) 2) windows)))
      (select-window win)
      (let ((win-s (window-start)))
        (goto-char dest)
        (recenter)
        (when (< dest win-s)
          (setq follow-internal-force-redisplay t))))))