2

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?

phils
  • 48,657
  • 3
  • 76
  • 115
Claudio
  • 410
  • 2
  • 11

1 Answers1

0

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)))
Claudio
  • 410
  • 2
  • 11