If I enable follow-mode in Emacs the behavior of this mode is that the point/cursor leaves the active window if there is another window showing already the text the active window should scroll to. But I want to use it with three windows, editing only in this one in the middle and having the left and right ones showing the preceding and following text.

How can I modify the 'follow.el' code to make the follow-mode to scroll the other windows, but with a point/cursor always staying in the current active window?

1 Answer 1


How to modify follow.el elisp script to keep the point/cursor in the active window?

Your question is assuming that to achieve the desired functionality it is necessary to change the code for the follow-mode in the "follow.el" elisp script, but this assumption is wrong, because it is not necessary.

You can achieve the requested functionality by combining the follow-mode with centered scrolling.

Try it out without installation of any package by adding for example to your .emacs initialization file the following two lines enabling smooth centered scrolling line by line using the arrow keys:

(global-set-key (kbd "<down>") (lambda (&optional ARG TRY-VSCROLL) (interactive "^p\nP") (next-line     ARG TRY-VSCROLL) (recenter)))
(global-set-key (kbd "<up>")   (lambda (&optional ARG TRY-VSCROLL) (interactive "^p\nP") (previous-line ARG TRY-VSCROLL) (recenter)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.