Always stay at the bottom of the window?

Paul Y. Peng ypeng at
Wed Jul 26 21:31:24 CEST 2000

This is an Emacs, not an ESS question. However, I believe that
gurus of ESS may know the answer as well.

How can I have the last line of the output always at the bottom of
the window, rather than somewhere in the middle as the default?  Or
in other words, how can I always have the cursor at the bottom of
the window, just as the way in a xterm window?

I posted this question in comp.emacs and got the following solution
from John Wiegley <johnw at>:

> You can do it with this code added to your .emacs:
>   (defun always-scroll-to-bottom (window display-start)
>     (if (and window (window-live-p window))
>         (save-selected-window
>         (select-window window)
>         (save-restriction
>           (widen)
>           (save-excursion
>             (if (eobp)
>                 (recenter -1)))))))
>   (add-hook 'window-scroll-functions 'always-scroll-to-bottom)

This code works only in Emacs started with one window. Whenever I
use C-x 2 to divide the current window into two, Emacs crashes (I
tested it in Eamcs 20.3.1 on Linux and Emacs 20.4.1 on Win98).
Any clues on what causes the problem?

Sorry for this off topic.
ess-help mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: ess-help-request at

More information about the ESS-help mailing list