ErgoEmacsEmacsLispBlogEmacsLispBuy Tutorial
Web Hosting by 1&1

18.2 Automatic Scrolling

Emacs performs automatic scrolling when point moves out of the visible portion of the text.

Normally, this centers point vertically within the window. However, if you set scroll-conservatively to a small number n, then if you move point just a little off the screen (less than n lines), Emacs scrolls the text just far enough to bring point back on screen. By default, scroll-conservatively is 0.

When the window does scroll by a longer distance, you can control how aggressively it scrolls by setting the variables scroll-up-aggressively and scroll-down-aggressively. The value of scroll-up-aggressively should be either nil, or a fraction f between 0 and 1. A fraction specifies where on the screen to put point when scrolling upward: when a window scrolls up because point is above the window start, the new start position is chosen to put point f parts of the window height from the top. Thus, larger f means more aggressive scrolling. The default value, nil, is equivalent to 0.5.

Likewise, scroll-down-aggressively is used for scrolling down. The value specifies how far point should be placed from the bottom of the window; thus, as with scroll-up-aggressively, a larger value is more aggressive.

The variable scroll-margin restricts how close point can come to the top or bottom of a window. Its value is a number of screen lines; if point comes within that many lines of the top or bottom of the window, Emacs performs automatic scrolling. By default, scroll-margin is 0.

blog comments powered by Disqus