Go to the first, previous, next, last section, table of contents.

Controlling the Display

Since only part of a large buffer fits in the window, Emacs tries to show the part that is likely to be interesting. The display control commands allow you to specify which part of the text you want to see.

C-l
Clear screen and redisplay, scrolling the selected window to center point vertically within it (recenter).
C-v
Scroll forward (a windowful or a specified number of lines) (scroll-up).
NEXT
Likewise, scroll forward.
M-v
Scroll backward (scroll-down).
PRIOR
Likewise, scroll backward.
arg C-l
Scroll so point is on screen line arg (recenter).
C-x <
Scroll text in current window to the left (scroll-left).
C-x >
Scroll to the right (scroll-right).
C-x $
Make deeply indented lines invisible (set-selective-display).

The names of all scroll commands are based on the direction that the text moves in the window. Thus, the command to scrolling forward is called scroll-up, since the text moves up.

Scrolling

If a buffer contains text that is too large to fit entirely within a window that is displaying the buffer, Emacs shows a contiguous portion of the text. The portion shown always contains point.

Scrolling means moving text up or down in the window so that different parts of the text are visible. Scrolling forward means that text moves up, and new text appears at the bottom. Scrolling backward moves text down and new text appears at the top.

Scrolling happens automatically if you move point past the bottom or top of the window. You can also explicitly request scrolling with the commands in this section.

The most basic scrolling command is C-l (recenter) with no argument. It clears the entire screen and redisplays all windows. In addition, it scrolls the selected window so that point is halfway down from the top of the window.

The scrolling commands C-v and M-v let you move all the text in the window up or down a few lines. C-v (scroll-up) with an argument shows you that many more lines at the bottom of the window, moving the text and point up together as C-l might. C-v with a negative argument shows you more lines at the top of the window. M-v (scroll-down) is like C-v, but moves in the opposite direction. The function keys NEXT and PRIOR are equivalent to C-v and M-v.

To read the buffer a windowful at a time, use C-v with no argument. It takes the last two lines at the bottom of the window and puts them at the top, followed by nearly a whole windowful of lines not previously visible. If point was in the text scrolled off the top, it moves to the new top of the window. M-v with no argument moves backward with overlap similarly. The number of lines of overlap across a C-v or M-v is controlled by the variable next-screen-context-lines; by default, it is two.

Another way to do scrolling is with C-l with a numeric argument. C-l does not clear the screen when given an argument; it only scrolls the selected window. With a positive argument n, it repositions text to put point n lines down from the top. An argument of zero puts point on the very top line. Point does not move with respect to the text; rather, the text and point move rigidly on the screen. C-l with a negative argument puts point that many lines from the bottom of the window. For example, C-u - 1 C-l puts point on the bottom line, and C-u - 5 C-l puts it five lines from the bottom. Just C-u as argument, as in C-u C-l, scrolls point to the center of the screen.

The C-M-l command (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.

Scrolling happens automatically if point has moved out of the visible portion of the text when it is time to display. Usually the scrolling is done so as to put point vertically centered within the window. However, if the variable scroll-step has a nonzero value, an attempt is made to scroll the buffer by that many lines; if that is enough to bring point back into visibility, that is what is done.

Horizontal Scrolling

The text in a window can also be scrolled horizontally. This means that each line of text is shifted sideways in the window, and one or more characters at the beginning of each line are not displayed at all. When a window has been scrolled horizontally in this way, text lines are truncated rather than continued (see section Continuation Lines), with a `$' appearing in the first column when there is text truncated to the left, and in the last column when there is text truncated to the right.

The command C-x < (scroll-left) scrolls the selected window to the left by n columns with argument n. This moves part of the beginning of each line off the left edge of the window. With no argument, it scrolls by almost the full width of the window (two columns less, to be precise).

C-x > (scroll-right) scrolls similarly to the right. The window cannot be scrolled any farther to the right once it is displayed normally (with each line starting at the window's left margin); attempting to do so has no effect. This means that you don't have to calculate the argument precisely for C-x >; any sufficiently large argument will restore normally display.

Selective Display

Emacs has the ability to hide lines indented more than a certain number of columns (you specify how many columns). You can use this to get an overview of a part of a program.

To hide lines, type C-x $ (set-selective-display) with a numeric argument n. Then lines with at least n columns of indentation disappear from the screen. The only indication of their presence is that three dots (`...') appear at the end of each visible line that is followed by one or more invisible ones.

The commands C-n and C-p move across the invisible lines as if they were not there.

The invisible lines are still present in the buffer, and most editing commands see them as usual, so you may find point in the middle of invisible text. When this happens, the cursor appears at the end of the previous line, after the three dots. If point is at the end of the visible line, before the newline that ends it, the cursor appears before the three dots.

To make all lines visible again, type C-x $ with no argument.

European Character Set Display

Some European languages use accented letters and other special symbols. The ISO 8859 Latin-1 character set defines character codes for many European languages in the range 160 to 255.

Emacs can display those characters according to Latin-1, provided the terminal or font in use supports them. The M-x standard-display-european command toggles European character display mode. With a numeric argument, M-x standard-display-european enables European character display if and only if the argument is positive.

Some operating systems let you specify the language you are using by setting a locale. Emacs handles one common special case of this: if your locale name for character types contains the string `8859-1' or `88591', Emacs automatically enables European character display mode when it starts up.

Load the library iso-syntax to specify the correct syntactic properties and case conversion table for the Latin-1 character set.

If your keyboard can send character codes 128 and up to represent ISO Latin-1 characters, execute the following expression to enable Emacs to understand them:

(set-input-mode (car (current-input-mode))
                (nth 1 (current-input-mode))
                0)

Otherwise, you can load the library iso-transl to turn the key C-x 8 into a "compose character" prefix for entry of the extra ISO Latin-1 printing characters. C-x 8 is good for insertion (in the minibuffer as well as other buffers), for searching, and in any other context where a key sequence is allowed. The ALT modifier key, if you have one, serves the same purpose as C-x 8; use ALT together with an accent character to modify the following letter.

If you enter non-ASCII ISO Latin-1 characters often, you might find ISO Accents mode convenient. When this minor mode is enabled, the characters ``', `'', `"', `^', `/' and `~' modify the following letter by adding the corresponding diacritical mark to it, if possible. To enable or disable ISO Accents mode, use the command M-x iso-accents-mode. This command affects only the current buffer.

To enter one of those six special characters, type the character, followed by a space. Some of those characters have a corresponding "dead key" accent character in the ISO Latin-1 character set; to enter that character, type the corresponding ASCII character twice. For example, " enters the Latin-1 character acute-accent (character code 0264).

In addition to the accented letters, you can use these special sequences in ISO Accents mode to enter certain other ISO Latin-1 characters:

/A
`A' with ring.
~C
`C' with cedilla.
~D
`D' with stroke.
/E
`AE' ligature.
/a
`a' with ring.
~c
`c' with cedilla.
~d
`d' with stroke.
/e
`ae' ligature.
"s
German sharp `s'.
~<
Left guillemet.
~>
Right guillemet.

This feature is available whenever a key sequence is expected: for ordinary insertion, for searching, and for certain command arguments.

Optional Mode Line Features

To add the current line number of point to the mode line, enable Line Number mode with the command M-x line-number-mode. The line number appears before the buffer percentage pos, with the letter `L' to indicate what it is. See section Minor Modes, for more information about minor modes and about how to use this command.

If the buffer is very large (larger than the value of line-number-display-limit), then the line number doesn't appear. Emacs doesn't compute the line number when the buffer is large, because that would be too slow.

Emacs can optionally display the time and system load in all mode lines. To enable this feature, type M-x display-time. The information added to the mode line usually appears after the buffer name, before the mode names and their parentheses. It looks like this:

hh:mmpm l.ll

Here hh and mm are the hour and minute, followed always by `am' or `pm'. l.ll is the average number of running processes in the whole system recently. (Some fields may be missing if your operating system cannot support them.)

The word `Mail' appears after the load level if there is mail for you that you have not read yet.

Variables Controlling Display

This section contains information for customization only. Beginning users should skip it.

The variable mode-line-inverse-video controls whether the mode line is displayed in inverse video (assuming the terminal supports it); nil means don't do so. See section The Mode Line. If you specify the foreground color for the mode-line face, and mode-line-inverse-video is non-nil, then the default background color for that face is the usual foreground color. See section Using Multiple Typefaces.

If the variable inverse-video is non-nil, Emacs attempts to invert all the lines of the display from what they normally are.

If the variable visible-bell is non-nil, Emacs attempts to make the whole screen blink when it would normally make an audible bell sound. This variable has no effect if your terminal does not have a way to make the screen blink.

When you reenter Emacs after suspending, Emacs normally clears the screen and redraws the entire display. On some terminals with more than one page of memory, it is possible to arrange the termcap entry so that the `ti' and `te' strings (output to the terminal when Emacs is entered and exited, respectively) switch between pages of memory so as to use one page for Emacs and another page for other output. Then you might want to set the variable no-redraw-on-reenter non-nil; this tells Emacs to assume, when resumed, that the screen page it is using still contains what Emacs last wrote there.

The variable echo-keystrokes controls the echoing of multi-character keys; its value is the number of seconds of pause required to cause echoing to start, or zero meaning don't echo at all. See section The Echo Area.

If the variable ctl-arrow is nil, control characters in the buffer are displayed with octal escape sequences, all except newline and tab. Altering the value of ctl-arrow makes it local to the current buffer; until that time, the default value is in effect. The default is initially t. See section `Display Tables' in The Emacs Lisp Reference Manual.

Normally, a tab character in the buffer is displayed as whitespace which extends to the next display tab stop position, and display tab stops come at intervals equal to eight spaces. The number of spaces per tab is controlled by the variable tab-width, which is made local by changing it, just like ctl-arrow. Note that how the tab character in the buffer is displayed has nothing to do with the definition of TAB as a command. The variable tab-width must have an integer value between 1 and 1000, inclusive.

If you set the variable selective-display-ellipses to nil, the three dots do not appear at the end of a line that precedes invisible lines. Then there is no visible indication of the invisible lines. This variable too becomes local automatically when set.

If the variable truncate-lines is non-nil, then each line of text gets just one screen line for display; if the text line is too long, display shows only the part that fits. If truncate-lines is nil, then long text lines display as more than one screen line, enough to show the whole text of the line. See section Continuation Lines. Altering the value of truncate-lines makes it local to the current buffer; until that time, the default value is in effect. The default is initially nil.

If the variable truncate-partial-width-windows is non-nil, it forces truncation rather than continuation in any window less than the full width of the screen or frame, regardless of the value of truncate-lines. For information about side-by-side windows, see section Splitting Windows. See also section `Display' in The Emacs Lisp Reference Manual.

The variable baud-rate holds the the output speed of the terminal, as far as Emacs knows. Setting this variable does not change the speed of actual data transmission, but the value is used for calculations such as padding. It also affects decisions about whether to scroll part of the screen or redraw it instead--even when using a window system. (We designed it this way, despite the fact that a window system has no true "output speed", to give you a way to tune these decisions.)


Go to the first, previous, next, last section, table of contents.