Function: follow-mode

follow-mode is an autoloaded, interactive and byte-compiled function defined in follow.el.gz.

Signature

(follow-mode &optional ARG)

Documentation

Toggle Follow mode.

This is a minor mode. If called interactively, toggle the Follow mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate follow-mode(var)/follow-mode(fun).

The mode's hook is called both when the mode is enabled and when it is disabled.

Follow mode is a minor mode that combines windows into one tall virtual window. This is accomplished by two main techniques:

* The windows always displays adjacent sections of the buffer.
  This means that whenever one window is moved, all the
  others will follow. (Hence the name Follow mode.)

* Should point (cursor) end up outside a window, another
  window displaying that point is selected, if possible. This
  makes it possible to walk between windows using normal cursor
  movement commands.

Follow mode comes to its prime when used on a large screen and two or more side-by-side windows are used. The user can, with the help of Follow mode, use these full-height windows as though they were one. Imagine yourself editing a large function, or section of text, and being able to use 144 or 216 lines instead of the normal 72... (your mileage may vary).

To split one large window into two side-by-side windows, the commands C-x 3 (split-window-right) or M-x follow-delete-other-windows-and-split (follow-delete-other-windows-and-split) can be used.

Only windows displayed in the same frame follow each other.

This command runs the normal hook follow-mode-hook.

Keys specific to Follow mode:
                                      follow-scroll-bar-toolkit-scroll
<vertical-scroll-bar> <down-mouse-2> follow-scroll-bar-drag
<vertical-scroll-bar> <drag-mouse-1> follow-scroll-bar-scroll-up
<vertical-scroll-bar> <drag-mouse-3> follow-scroll-bar-scroll-down
C-c . 1 follow-delete-other-windows-and-split
C-c . < follow-first-window
C-c . > follow-last-window
C-c . C-b follow-switch-to-buffer-all
C-c . C-l follow-recenter
C-c . C-v follow-scroll-up
C-c . M-v follow-scroll-down
C-c . b follow-switch-to-buffer
C-c . n follow-next-window
C-c . p follow-previous-window
C-c . v follow-scroll-down
M-<mouse-7> follow-mwheel-scroll
M-> follow-end-of-buffer

Probably introduced at or before Emacs version 19.31.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/follow.el.gz
;;;###autoload
(define-minor-mode follow-mode
  "Toggle Follow mode.

Follow mode is a minor mode that combines windows into one tall
virtual window.  This is accomplished by two main techniques:

* The windows always displays adjacent sections of the buffer.
  This means that whenever one window is moved, all the
  others will follow.  (Hence the name Follow mode.)

* Should point (cursor) end up outside a window, another
  window displaying that point is selected, if possible.  This
  makes it possible to walk between windows using normal cursor
  movement commands.

Follow mode comes to its prime when used on a large screen and two or
more side-by-side windows are used.  The user can, with the help of
Follow mode, use these full-height windows as though they were one.
Imagine yourself editing a large function, or section of text, and
being able to use 144 or 216 lines instead of the normal 72... (your
mileage may vary).

To split one large window into two side-by-side windows, the commands
`\\[split-window-right]' or \
`\\[follow-delete-other-windows-and-split]' can be used.

Only windows displayed in the same frame follow each other.

This command runs the normal hook `follow-mode-hook'.

Keys specific to Follow mode:
\\{follow-mode-map}"
  :lighter follow-mode-line-text
  :keymap follow-mode-map
  (if follow-mode
      (progn
	(add-hook 'compilation-filter-hook 'follow-align-compilation-windows t t)
        (add-function :before pre-redisplay-function 'follow-pre-redisplay-function)
	(add-hook 'window-size-change-functions 'follow-window-size-change t)
        (add-hook 'after-change-functions 'follow-after-change nil t)
        (add-hook 'isearch-update-post-hook 'follow-post-command-hook nil t)
        (add-hook 'replace-update-post-hook 'follow-post-command-hook nil t)
        (add-hook 'ispell-update-post-hook 'follow-post-command-hook nil t)

        (when isearch-lazy-highlight
          (setq-local isearch-lazy-highlight 'all-windows))
        (when follow-hide-ghost-cursors
          (setq-local cursor-in-non-selected-windows nil))

        (setq window-group-start-function 'follow-window-start)
        (setq window-group-end-function 'follow-window-end)
        (setq set-window-group-start-function 'follow-set-window-start)
        (setq recenter-window-group-function 'follow-recenter)
        (setq pos-visible-in-window-group-p-function
              'follow-pos-visible-in-window-p)
        (setq selected-window-group-function 'follow-all-followers)
        (setq move-to-window-group-line-function 'follow-move-to-window-line))

    ;; Remove globally-installed hook functions only if there is no
    ;; other Follow mode buffer.
    (let ((buffers (buffer-list))
	  following)
      (while (and (not following) buffers)
	(setq following (buffer-local-value 'follow-mode (car buffers))
	      buffers (cdr buffers)))
      (unless following
        (remove-function pre-redisplay-function 'follow-pre-redisplay-function)
	(remove-hook 'window-size-change-functions 'follow-window-size-change)))

    (kill-local-variable 'move-to-window-group-line-function)
    (kill-local-variable 'selected-window-group-function)
    (kill-local-variable 'pos-visible-in-window-group-p-function)
    (kill-local-variable 'recenter-window-group-function)
    (kill-local-variable 'set-window-group-start-function)
    (kill-local-variable 'window-group-end-function)
    (kill-local-variable 'window-group-start-function)

    (kill-local-variable 'cursor-in-non-selected-windows)

    (remove-hook 'ispell-update-post-hook 'follow-post-command-hook t)
    (remove-hook 'replace-update-post-hook 'follow-post-command-hook t)
    (remove-hook 'isearch-update-post-hook 'follow-post-command-hook t)
    (remove-hook 'after-change-functions 'follow-after-change t)
    (remove-hook 'compilation-filter-hook 'follow-align-compilation-windows t)))