Next: Vertical Scrolling, Previous: Window Start, Up: Windows
Textual scrolling means moving the text up or down through a
window. It works by changing the value of the window's display-start
location. It may also change the value of window-point to keep
point on the screen.
Textual scrolling was formerly called “vertical scrolling,” but we changed its name to distinguish it from the new vertical fractional scrolling feature (see Vertical Scrolling).
In the commands scroll-up and scroll-down, the directions
“up” and “down” refer to the motion of the text in the buffer at which
you are looking through the window. Imagine that the text is
written on a long roll of paper and that the scrolling commands move the
paper up and down. Thus, if you are looking at text in the middle of a
buffer and repeatedly call scroll-down, you will eventually see
the beginning of the buffer.
Some people have urged that the opposite convention be used: they imagine that the window moves over text that remains in place. Then “down” commands would take you to the end of the buffer. This view is more consistent with the actual relationship between windows and the text in the buffer, but it is less like what the user sees. The position of a window on the terminal does not move, and short scrolling commands clearly move the text up or down on the screen. We have chosen names that fit the user's point of view.
The textual scrolling functions (aside from
scroll-other-window) have unpredictable results if the current
buffer is different from the buffer that is displayed in the selected
window. See Current Buffer.
If the window contains a row which is taller than the height of the
window (for example in the presence of a large image), the scroll
functions will adjust the window vscroll to scroll the partially
visible row. To disable this feature, Lisp code may bind the variable
`auto-window-vscroll' to nil (see Vertical Scrolling).
This function scrolls the text in the selected window upward count lines. If count is negative, scrolling is actually downward.
If count is
nil(or omitted), then the length of scroll isnext-screen-context-lineslines less than the usable height of the window (not counting its mode line).
scroll-upreturnsnil, unless it gets an error because it can't scroll any further.
This function scrolls the text in the selected window downward count lines. If count is negative, scrolling is actually upward.
If count is omitted or
nil, then the length of the scroll isnext-screen-context-lineslines less than the usable height of the window (not counting its mode line).
scroll-downreturnsnil, unless it gets an error because it can't scroll any further.
This function scrolls the text in another window upward count lines. Negative values of count, or
nil, are handled as inscroll-up.You can specify which buffer to scroll by setting the variable
other-window-scroll-bufferto a buffer. If that buffer isn't already displayed,scroll-other-windowdisplays it in some window.When the selected window is the minibuffer, the next window is normally the one at the top left corner. You can specify a different window to scroll, when the minibuffer is selected, by setting the variable
minibuffer-scroll-window. This variable has no effect when any other window is selected. When it is non-niland the minibuffer is selected, it takes precedence overother-window-scroll-buffer. See Definition of minibuffer-scroll-window.When the minibuffer is active, it is the next window if the selected window is the one at the bottom right corner. In this case,
scroll-other-windowattempts to scroll the minibuffer. If the minibuffer contains just one line, it has nowhere to scroll to, so the line reappears after the echo area momentarily displays the message `Beginning of buffer'.
If this variable is non-
nil, it tellsscroll-other-windowwhich buffer to scroll.
This option specifies the size of the scroll margin—a minimum number of lines between point and the top or bottom of a window. Whenever point gets within this many lines of the top or bottom of the window, redisplay scrolls the text automatically (if possible) to move point out of the margin, closer to the center of the window.
This variable controls how scrolling is done automatically when point moves off the screen (or into the scroll margin). If the value is a positive integer n, then redisplay scrolls the text up to n lines in either direction, if that will bring point back into proper view. This action is called conservative scrolling. Otherwise, scrolling happens in the usual way, under the control of other variables such as
scroll-up-aggressivelyandscroll-down-aggressively.The default value is zero, which means that conservative scrolling never happens.
The value of this variable should be either
nilor a fraction f between 0 and 1. If it is a fraction, that specifies where on the screen to put point when scrolling down. More precisely, when a window scrolls down because point is above the window start, the new start position is chosen to put point f part of the window height from the top. The larger f, the more aggressive the scrolling.A value of
nilis equivalent to .5, since its effect is to center point. This variable automatically becomes buffer-local when set in any fashion.
Likewise, for scrolling up. The value, f, specifies how far point should be placed from the bottom of the window; thus, as with
scroll-up-aggressively, a larger value scrolls more aggressively.
This variable is an older variant of
scroll-conservatively. The difference is that it if its value is n, that permits scrolling only by precisely n lines, not a smaller number. This feature does not work withscroll-margin. The default value is zero.
If this option is
t, scrolling which would move the current point position out of the window chooses the new position of point so that the vertical position of the cursor is unchanged, if possible.If it is non-
niland nott, then the scrolling functions always preserve the vertical position of point, if possible.
The value of this variable is the number of lines of continuity to retain when scrolling by full screens. For example,
scroll-upwith an argument ofnilscrolls so that this many lines at the bottom of the window appear instead at the top. The default value is2.
This function scrolls the text in the selected window so that point is displayed at a specified vertical position within the window. It does not “move point” with respect to the text.
If count is a nonnegative number, that puts the line containing point count lines down from the top of the window. If count is a negative number, then it counts upward from the bottom of the window, so that −1 stands for the last usable line in the window. If count is a non-
nillist, then it stands for the line in the middle of the window.If count is
nil,recenterputs the line containing point in the middle of the window, then clears and redisplays the entire selected frame.When
recenteris called interactively, count is the raw prefix argument. Thus, typing C-u as the prefix sets the count to a non-nillist, while typing C-u 4 sets count to 4, which positions the current line four lines from the top.With an argument of zero,
recenterpositions the current line at the top of the window. This action is so handy that some people make a separate key binding to do this. For example,(defun line-to-top-of-window () "Scroll current line to top of window. Replaces three keystroke sequence C-u 0 C-l." (interactive) (recenter 0)) (global-set-key [kp-multiply] 'line-to-top-of-window)