Next: , Previous: , Up: Display   [Contents][Index]

14.2 Recentering


Scroll the selected window so the current line is the center-most text line; on subsequent consecutive invocations, make the current line the top line, the bottom line, and so on in cyclic order. Possibly redisplay the screen too (recenter-top-bottom).

M-x recenter

Scroll the selected window so the current line is the center-most text line. Possibly redisplay the screen too.


Scroll heuristically to bring useful information onto the screen (reposition-window).

The C-l (recenter-top-bottom) command recenters the selected window, scrolling it so that the current screen line is exactly in the center of the window, or as close to the center as possible.

Typing C-l twice in a row (C-l C-l) scrolls the window so that point is on the topmost screen line. Typing a third C-l scrolls the window so that point is on the bottom-most screen line. Each successive C-l cycles through these three positions.

You can change the cycling order by customizing the list variable recenter-positions. Each list element should be the symbol top, middle, or bottom, or a number; an integer means to move the line to the specified screen line, while a floating-point number between 0.0 and 1.0 specifies a percentage of the screen space from the top of the window. The default, (middle top bottom), is the cycling order described above. Furthermore, if you change the variable scroll-margin to a non-zero value n, C-l always leaves at least n screen lines between point and the top or bottom of the window (see Auto Scrolling).

You can also give C-l a prefix argument. A plain prefix argument, C-u C-l, simply recenters point. A positive argument n puts point n lines down from the top of the window. An argument of zero puts point on the topmost line. A negative argument -n puts point n lines from the bottom of the window. When given an argument, C-l does not clear the screen or cycle through different screen positions.

If the variable recenter-redisplay has a non-nil value, each invocation of C-l also clears and redisplays the screen; the special value tty (the default) says to do this on text-terminal frames only. Redisplaying is useful in case the screen becomes garbled for any reason (see Screen Garbled).

The more primitive command M-x recenter behaves like recenter-top-bottom, but does not cycle among screen positions.

C-M-l (reposition-window) scrolls the current window heuristically in a way designed to get useful information onto the screen. For example, in a Lisp file, this command tries to get the entire current defun onto the screen if possible.

Next: , Previous: , Up: Display   [Contents][Index]