("slovak"): Delete translations of "q", "Q", "=q", "+q", "=Q", and "+Q".
[bpt/emacs.git] / man / display.texi
CommitLineData
802b0ea7 1@c This is part of the Emacs manual.
b8f3a9e3
GM
2@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997, 2000, 2001
3@c Free Software Foundation, Inc.
6bf7aab6
DL
4@c See file emacs.texi for copying conditions.
5@node Display, Search, Registers, Top
6@chapter Controlling the Display
7
8 Since only part of a large buffer fits in the window, Emacs tries to
9show a part that is likely to be interesting. Display-control commands
10allow you to specify which part of the text you want to see, and how to
11display it.
12
13@menu
b8f3a9e3
GM
14* Faces:: How to change the display style using faces.
15* Font Lock:: Minor mode for syntactic highlighting using faces.
16* Highlight Changes:: Using colors to show where you changed the buffer.
17* Highlight Interactively:: Tell Emacs what text to highlight.
18* Trailing Whitespace:: Showing possibly-spurious trailing whitespace.
6bf7aab6
DL
19* Scrolling:: Moving text up and down in a window.
20* Horizontal Scrolling:: Moving text left and right in a window.
21* Follow Mode:: Follow mode lets two windows scroll as one.
22* Selective Display:: Hiding lines with lots of indentation.
23* Optional Mode Line:: Optional mode line display features.
24* Text Display:: How text characters are normally displayed.
e598186c 25* Display Custom:: Information on variables for customizing display.
099bfef9 26* Cursor Display:: Features for displaying the cursor.
6bf7aab6
DL
27@end menu
28
b8f3a9e3
GM
29@node Faces
30@section Using Multiple Typefaces
31@cindex faces
32
33 When using Emacs with a window system, you can set up multiple
34styles of displaying characters. Some of the aspects of style that
35you can control are the type font, the foreground color, the
36background color, and whether or not to underline text, and in which
37color.
38
6bb2ed9b
EZ
39 Features which rely on text in multiple faces (such as Font Lock mode)
40will also work on non-windowed terminals that can display more than one
41face, whether by colors or underlining and emboldening. This includes
42the console on GNU/Linux, an @code{xterm} which supports colors, the
43MS-DOS display (@pxref{MS-DOS}), and the MS-Windows version invoked with
44the @option{-nw} option. Emacs determines automatically whether the
45terminal has this capability.
b8f3a9e3
GM
46
47 The way you control display style is by defining named @dfn{faces}.
48Each face can specify various attributes, like the type font's height,
49weight and slant, foreground and background color, and underlining,
50but it does not have to specify all of them. By specifying the face
51or faces to use for a given part of the text in the buffer, you
52control how that text appears.
53
54 The style of display used for a given character in the text is
55determined by combining several faces. Any aspect of the display
56style that isn't specified by overlays or text properties comes from a
57default face which inherits its settings from the frame itself.
58
59 Enriched mode, the mode for editing formatted text, includes several
60commands and menus for specifying faces. @xref{Format Faces}, for how
61to specify the font for text in the buffer. @xref{Format Colors}, for
62how to specify the foreground and background color.
63
64 To alter the appearance of a face, use the customization buffer.
65@xref{Face Customization}. You can also use X resources to specify
66attributes of particular faces (@pxref{Resources X}).
67
68@cindex face colors, setting
69@findex set-face-foreground
70@findex set-face-background
71 Alternatively, you can change the foreground and background colors
72of a specific face with @kbd{M-x set-face-foreground} and @kbd{M-x
73set-face-background}. These commands prompt in the minibuffer for a
74face name and a color name, with completion, and then set that face to
75use the specified color.
76
77@findex list-faces-display
78 To see what faces are currently defined, and what they look like, type
79@kbd{M-x list-faces-display}. It's possible for a given face to look
80different in different frames; this command shows the appearance in the
81frame in which you type it. Here's a list of the standardly defined
82faces:
83
84@table @code
85@item default
86This face is used for ordinary text that doesn't specify any other face.
87@item mode-line
88This face is used for mode lines. By default, it's drawn with shadows
89for a ``raised'' effect on window systems, and drawn as the inverse of
90the default face on non-windowed terminals. @xref{Display Custom}.
91@item header-line
92Similar to @code{mode-line} for a window's header line. Most modes
93don't use the header line, but the Info mode does.
94@item highlight
95This face is used for highlighting portions of text, in various modes.
96For example, mouse-sensitive text is highlighted using this face.
97@item isearch
98This face is used for highlighting Isearch matches.
99@item isearch-lazy-highlight-face
100This face is used for lazy highlighting of Isearch matches other than
101the current one.
102@item region
103This face is used for displaying a selected region (when Transient Mark
104mode is enabled---see below).
105@item secondary-selection
106This face is used for displaying a secondary X selection (@pxref{Secondary
107Selection}).
108@item bold
109This face uses a bold variant of the default font, if it has one.
110@item italic
111This face uses an italic variant of the default font, if it has one.
112@item bold-italic
113This face uses a bold italic variant of the default font, if it has one.
114@item underline
115This face underlines text.
116@item fixed-pitch
117The basic fixed-pitch face.
118@item fringe
119@cindex fringe
120The face for the fringes to the left and right of windows on graphic
121displays. (The fringes are the narrow portions of the Emacs frame
122between the text area and the frame's border.)
123@item scroll-bar
124This face determines the visual appearance of the scroll bar.
125@item border
126This face determines the color of the frame border.
127@item cursor
128This face determines the color of the cursor.
129@item mouse
130This face determines the color of the mouse pointer.
131@item tool-bar
132This is the basic tool-bar face. No text appears in the tool bar, but the
133colors of this face affect the appearance of tool bar icons.
134@item tooltip
135This face is used for tooltips.
136@item menu
137This face determines the colors and font of Emacs's menus. Setting the
138font of LessTif/Motif menus is currently not supported; attempts to set
139the font are ignored in this case.
140@item trailing-whitespace
141The face for highlighting trailing whitespace when
142@code{show-trailing-whitespace} is non-nil.
143@item variable-pitch
144The basic variable-pitch face.
145@end table
146
147@cindex @code{region} face
148 When Transient Mark mode is enabled, the text of the region is
149highlighted when the mark is active. This uses the face named
150@code{region}; you can control the style of highlighting by changing the
151style of this face (@pxref{Face Customization}). @xref{Transient Mark},
152for more information about Transient Mark mode and activation and
153deactivation of the mark.
154
155 One easy way to use faces is to turn on Font Lock mode. This minor
156mode, which is always local to a particular buffer, arranges to
157choose faces according to the syntax of the text you are editing. It
158can recognize comments and strings in most languages; in several
159languages, it can also recognize and properly highlight various other
160important constructs. @xref{Font Lock}, for more information about
161Font Lock mode and syntactic highlighting.
162
163 You can print out the buffer with the highlighting that appears
164on your screen using the command @code{ps-print-buffer-with-faces}.
165@xref{PostScript}.
166
167@node Font Lock
168@section Font Lock mode
169@cindex Font Lock mode
170@cindex mode, Font Lock
171@cindex syntax highlighting and coloring
172
173 Font Lock mode is a minor mode, always local to a particular
174buffer, which highlights (or ``fontifies'') using various faces
175according to the syntax of the text you are editing. It can
176recognize comments and strings in most languages; in several
177languages, it can also recognize and properly highlight various other
178important constructs---for example, names of functions being defined
179or reserved keywords.
180
181@findex font-lock-mode
182@findex turn-on-font-lock
183 The command @kbd{M-x font-lock-mode} turns Font Lock mode on or off
184according to the argument, and toggles the mode when it has no argument.
185The function @code{turn-on-font-lock} unconditionally enables Font Lock
186mode. This is useful in mode-hook functions. For example, to enable
187Font Lock mode whenever you edit a C file, you can do this:
188
189@example
190(add-hook 'c-mode-hook 'turn-on-font-lock)
191@end example
192
193@findex global-font-lock-mode
194@vindex global-font-lock-mode
195 To turn on Font Lock mode automatically in all modes which support
196it, customize the user option @code{global-font-lock-mode} or use the
197function @code{global-font-lock-mode} in your @file{.emacs} file, like
198this:
199
200@example
201(global-font-lock-mode 1)
202@end example
203
204 Font Lock mode uses several specifically named faces to do its job,
205including @code{font-lock-string-face}, @code{font-lock-comment-face},
206and others. The easiest way to find them all is to use completion
207on the face name in @code{set-face-foreground}.
208
209 To change the colors or the fonts used by Font Lock mode to fontify
210different parts of text, just change these faces. There are
211two ways to do it:
212
213@itemize @bullet
214@item
215Invoke @kbd{M-x set-face-foreground} or @kbd{M-x set-face-background}
216to change the colors of a particular face used by Font Lock.
217@xref{Faces}. The command @kbd{M-x list-faces-display} displays all
218the faces currently known to Emacs, including those used by Font Lock.
219
220@item
221Customize the faces interactively with @kbd{M-x customize-face}, as
222described in @ref{Face Customization}.
223@end itemize
224
225 To get the full benefit of Font Lock mode, you need to choose a
226default font which has bold, italic, and bold-italic variants; or else
227you need to have a color or gray-scale screen.
228
229@vindex font-lock-maximum-decoration
230 The variable @code{font-lock-maximum-decoration} specifies the
231preferred level of fontification, for modes that provide multiple
232levels. Level 1 is the least amount of fontification; some modes
233support levels as high as 3. The normal default is ``as high as
234possible.'' You can specify an integer, which applies to all modes, or
235you can specify different numbers for particular major modes; for
236example, to use level 1 for C/C++ modes, and the default level
237otherwise, use this:
238
239@example
240(setq font-lock-maximum-decoration
241 '((c-mode . 1) (c++-mode . 1)))
242@end example
243
244@vindex font-lock-maximum-size
245 Fontification can be too slow for large buffers, so you can suppress
246it. The variable @code{font-lock-maximum-size} specifies a buffer size,
247beyond which buffer fontification is suppressed.
248
249@c @w is used below to prevent a bad page-break.
250@vindex font-lock-beginning-of-syntax-function
251 Comment and string fontification (or ``syntactic'' fontification)
252relies on analysis of the syntactic structure of the buffer text. For
253the purposes of speed, some modes including C mode and Lisp mode rely on
254a special convention: an open-parenthesis in the leftmost column always
255defines the @w{beginning} of a defun, and is thus always outside any string
256or comment. (@xref{Defuns}.) If you don't follow this convention,
257then Font Lock mode can misfontify the text after an open-parenthesis in
258the leftmost column that is inside a string or comment.
259
6bb2ed9b 260@cindex slow display during scrolling
b8f3a9e3
GM
261 The variable @code{font-lock-beginning-of-syntax-function} (always
262buffer-local) specifies how Font Lock mode can find a position
263guaranteed to be outside any comment or string. In modes which use the
264leftmost column parenthesis convention, the default value of the variable
265is @code{beginning-of-defun}---that tells Font Lock mode to use the
266convention. If you set this variable to @code{nil}, Font Lock no longer
267relies on the convention. This avoids incorrect results, but the price
268is that, in some cases, fontification for a changed text must rescan
6bb2ed9b
EZ
269buffer text from the beginning of the buffer. This can considerably
270slow down redisplay while scrolling, particularly if you are close to
271the end of a large buffer.
b8f3a9e3
GM
272
273@findex font-lock-add-keywords
274 Font Lock highlighting patterns already exist for many modes, but you
275may want to fontify additional patterns. You can use the function
276@code{font-lock-add-keywords}, to add your own highlighting patterns for
277a particular mode. For example, to highlight @samp{FIXME:} words in C
278comments, use this:
279
280@example
281(font-lock-add-keywords
282 'c-mode
283 '(("\\<\\(FIXME\\):" 1 font-lock-warning-face t)))
284@end example
285
286@node Highlight Changes
287@section Highlight Changes Mode
288
289@findex highlight-changes-mode
290 Use @kbd{M-x highlight-changes-mode} to enable a minor mode
291that uses faces (colors, typically) to indicate which parts of
292the buffer were changed most recently.
293
294@node Highlight Interactively
295@section Interactive Highlighting by Matching
296@cindex highlighting by matching
297@cindex interactive highlighting
298
299 It is sometimes useful to highlight the strings that match a certain
300regular expression. For example, you might wish to see all the
301references to a certain variable in a program source file, or highlight
302certain parts in a voluminous output of some program, or make certain
303cliches stand out in an article.
304
305@findex hi-lock-mode
306 Use the @kbd{M-x hi-lock-mode} command to turn on a minor mode that
307allows you to specify regular expressions of the text to be
308highlighted. Hi-lock mode works like Font Lock (@pxref{Font Lock}),
309except that it lets you specify explicitly what parts of text to
310highlight. You control Hi-lock mode with these commands:
311
312@table @kbd
313@item C-x w h @var{regexp} @key{RET} @var{face} @key{RET}
314@kindex C-x w h
315@findex highlight-regexp
316Highlight text that matches
317@var{regexp} using face @var{face} (@code{highlight-regexp}).
318By using this command more than once, you can highlight various
319parts of the text in different ways.
320
321@item C-x w r @var{regexp} @key{RET}
322@kindex C-x w r
323@findex unhighlight-regexp
324Unhighlight @var{regexp} (@code{unhighlight-regexp}). You must enter
325one of the regular expressions currently specified for highlighting.
326(You can use completion, or a menu, to enter one of them
327conveniently.)
328
329@item C-x w l @var{regexp} @key{RET} @var{face} @key{RET}
330@kindex C-x w l
331@findex highlight-lines-matching-regexp
332@cindex lines, highlighting
333@cindex highlighting lines of text
334Highlight lines containing a match for @var{regexp}, using face
335@var{face} (@code{highlight-lines-matching-regexp}).
336
337@item C-x w b
338@kindex C-x w b
339@findex hi-lock-write-interactive-patterns
340Insert all the current highlighting regexp/face pairs into the buffer
341at point, with comment delimiters to prevent them from changing your
342program. This key binding runs the
343@code{hi-lock-write-interactive-patterns} command.
344
345These patterns will be read the next time you visit the file while
346Hi-lock mode is enabled, or whenever you use the @kbd{M-x
347hi-lock-find-patterns} command.
348
349@item C-x w i
350@kindex C-x w i
351@findex hi-lock-find-patterns
352@vindex hi-lock-exclude-modes
353Re-read regexp/face pairs in the current buffer
354(@code{hi-lock-write-interactive-patterns}). The list of pairs is
355found no matter where in the buffer it may be.
356
357This command does nothing if the major mode is a member of the list
358@code{hi-lock-exclude-modes}.
359@end table
360
361@node Trailing Whitespace
362@section Trailing Whitespace
363
364@cindex trailing whitespace
365@cindex whitespace, trailing
366@vindex show-trailing-whitespace
367 It is easy to leave unnecessary spaces at the end of a line without
368realizing it. In most cases, this @dfn{trailing whitespace} has no
369effect, but there are special circumstances where it matters.
370
371 You can make trailing whitespace visible on the screen by setting
372the variable @code{show-trailing-whitespace} to @code{t}. Then Emacs
373displays trailing whitespace in the face @code{trailing-whitespace}.
374
375 Trailing whitespace is defined as spaces or tabs at the end of a
376line. But trailing whitespace is not displayed specially if point is
377at the end of the line containing the whitespace. (Doing that looks
378ugly while you are typing in new text, and the location of point is
379enough in that case to show you that the spaces are present.)
380
381@vindex indicate-empty-lines
382@vindex default-indicate-empty-lines
383@cindex empty lines
384 Emacs can indicate empty lines at the end of the buffer with a
385special bitmap on the left fringe of the window. To enable this
386feature, set the buffer-local variable @code{indicate-empty-lines} to
387a non-@code{nil} value. The default value of this variable is
388controlled by the variable @code{default-indicate-empty-lines};
389by setting that variable, you can enable or disable this feature
390for all new buffers.
391
6bf7aab6
DL
392@node Scrolling
393@section Scrolling
394
395 If a buffer contains text that is too large to fit entirely within a
396window that is displaying the buffer, Emacs shows a contiguous portion of
397the text. The portion shown always contains point.
398
399@cindex scrolling
400 @dfn{Scrolling} means moving text up or down in the window so that
401different parts of the text are visible. Scrolling forward means that text
402moves up, and new text appears at the bottom. Scrolling backward moves
403text down and new text appears at the top.
404
405 Scrolling happens automatically if you move point past the bottom or top
406of the window. You can also explicitly request scrolling with the commands
407in this section.
408
409@table @kbd
410@item C-l
411Clear screen and redisplay, scrolling the selected window to center
412point vertically within it (@code{recenter}).
413@item C-v
414Scroll forward (a windowful or a specified number of lines) (@code{scroll-up}).
415@item @key{NEXT}
416Likewise, scroll forward.
417@item M-v
418Scroll backward (@code{scroll-down}).
419@item @key{PRIOR}
420Likewise, scroll backward.
421@item @var{arg} C-l
422Scroll so point is on line @var{arg} (@code{recenter}).
423@item C-M-l
424Scroll heuristically to bring useful information onto the screen
425(@code{reposition-window}).
426@end table
427
428@kindex C-l
429@findex recenter
430 The most basic scrolling command is @kbd{C-l} (@code{recenter}) with
431no argument. It clears the entire screen and redisplays all windows.
432In addition, it scrolls the selected window so that point is halfway
433down from the top of the window.
434
435@kindex C-v
436@kindex M-v
437@kindex NEXT
438@kindex PRIOR
439@findex scroll-up
440@findex scroll-down
441 The scrolling commands @kbd{C-v} and @kbd{M-v} let you move all the text
442in the window up or down a few lines. @kbd{C-v} (@code{scroll-up}) with an
443argument shows you that many more lines at the bottom of the window, moving
444the text and point up together as @kbd{C-l} might. @kbd{C-v} with a
445negative argument shows you more lines at the top of the window.
446@kbd{M-v} (@code{scroll-down}) is like @kbd{C-v}, but moves in the
447opposite direction. The function keys @key{NEXT} and @key{PRIOR} are
448equivalent to @kbd{C-v} and @kbd{M-v}.
449
450 The names of scroll commands are based on the direction that the text
451moves in the window. Thus, the command to scroll forward is called
452@code{scroll-up} because it moves the text upward on the screen.
453
454@vindex next-screen-context-lines
455 To read the buffer a windowful at a time, use @kbd{C-v} with no argument.
456It takes the last two lines at the bottom of the window and puts them at
457the top, followed by nearly a whole windowful of lines not previously
458visible. If point was in the text scrolled off the top, it moves to the
459new top of the window. @kbd{M-v} with no argument moves backward with
460overlap similarly. The number of lines of overlap across a @kbd{C-v} or
461@kbd{M-v} is controlled by the variable @code{next-screen-context-lines}; by
462default, it is 2.
463
464@vindex scroll-preserve-screen-position
465 Some users like the full-screen scroll commands to keep point at the
466same screen line. To enable this behavior, set the variable
467@code{scroll-preserve-screen-position} to a non-@code{nil} value. This
468mode is convenient for browsing through a file by scrolling by
469screenfuls; if you come back to the screen where you started, point goes
470back to the line where it started. However, this mode is inconvenient
471when you move to the next screen in order to move point to the text
472there.
473
474 Another way to do scrolling is with @kbd{C-l} with a numeric argument.
475@kbd{C-l} does not clear the screen when given an argument; it only scrolls
476the selected window. With a positive argument @var{n}, it repositions text
477to put point @var{n} lines down from the top. An argument of zero puts
478point on the very top line. Point does not move with respect to the text;
479rather, the text and point move rigidly on the screen. @kbd{C-l} with a
480negative argument puts point that many lines from the bottom of the window.
481For example, @kbd{C-u - 1 C-l} puts point on the bottom line, and @kbd{C-u
482- 5 C-l} puts it five lines from the bottom. Just @kbd{C-u} as argument,
483as in @kbd{C-u C-l}, scrolls point to the center of the selected window.
484
485@kindex C-M-l
486@findex reposition-window
487 The @kbd{C-M-l} command (@code{reposition-window}) scrolls the current
488window heuristically in a way designed to get useful information onto
489the screen. For example, in a Lisp file, this command tries to get the
490entire current defun onto the screen if possible.
491
492@vindex scroll-conservatively
493 Scrolling happens automatically if point has moved out of the visible
494portion of the text when it is time to display. Normally, automatic
495scrolling centers point vertically within the window. However, if you
496set @code{scroll-conservatively} to a small number @var{n}, then if you
497move point just a little off the screen---less than @var{n} lines---then
498Emacs scrolls the text just far enough to bring point back on screen.
499By default, @code{scroll-conservatively} is 0.
500
6dd5e8cc
EZ
501@cindex aggressive scrolling
502@vindex scroll-up-aggressively
503@vindex scroll-down-aggressively
e598186c
RS
504 When the window does scroll by a longer distance, you can control
505how aggressively it scrolls, by setting the variables
506@code{scroll-up-aggressively} and @code{scroll-down-aggressively}.
507The value of @code{scroll-up-aggressively} should be either
508@code{nil}, or a fraction @var{f} between 0 and 1. A fraction
509specifies where on the screen to put point when scrolling upward.
510More precisely, when a window scrolls up because point is above the
511window start, the new start position is chosen to put point @var{f}
512part of the window height from the top. The larger @var{f}, the more
513aggressive the scrolling.
514
515 @code{nil}, which is the default, scrolls to put point at the center.
516So it is equivalent to .5.
517
518 Likewise, @code{scroll-down-aggressively} is used for scrolling
519down. The value, @var{f}, specifies how far point should be placed
520from the bottom of the window; thus, as with
521@code{scroll-up-aggressively}, a larger value is more aggressive.
6dd5e8cc 522
6bf7aab6
DL
523@vindex scroll-margin
524 The variable @code{scroll-margin} restricts how close point can come
525to the top or bottom of a window. Its value is a number of screen
526lines; if point comes within that many lines of the top or bottom of the
527window, Emacs recenters the window. By default, @code{scroll-margin} is
5280.
529
530@node Horizontal Scrolling
531@section Horizontal Scrolling
532@cindex horizontal scrolling
533
534 @dfn{Horizontal scrolling} means shifting all the lines sideways
e598186c
RS
535within a window---so that some of the text near the left margin is not
536displayed at all. Emacs does this automatically, in any window that
537uses line truncation rather than continuation: whenever point moves
538off the left or right edge of the screen, Emacs scrolls the buffer
539horizontally to make point visible.
540
541 When a window has been scrolled horizontally, text lines are truncated
542rather than continued (@pxref{Continuation Lines}), with a @samp{$}
543appearing in the first column when there is text truncated to the left,
544and in the last column when there is text truncated to the right.
545
546 You can use these commands to do explicit horizontal scrolling.
6bf7aab6
DL
547
548@table @kbd
549@item C-x <
550Scroll text in current window to the left (@code{scroll-left}).
551@item C-x >
552Scroll to the right (@code{scroll-right}).
553@end table
554
6bf7aab6
DL
555@kindex C-x <
556@kindex C-x >
557@findex scroll-left
558@findex scroll-right
559 The command @kbd{C-x <} (@code{scroll-left}) scrolls the selected
560window to the left by @var{n} columns with argument @var{n}. This moves
561part of the beginning of each line off the left edge of the window.
562With no argument, it scrolls by almost the full width of the window (two
563columns less, to be precise).
564
565 @kbd{C-x >} (@code{scroll-right}) scrolls similarly to the right. The
566window cannot be scrolled any farther to the right once it is displayed
567normally (with each line starting at the window's left margin);
568attempting to do so has no effect. This means that you don't have to
569calculate the argument precisely for @w{@kbd{C-x >}}; any sufficiently large
570argument will restore the normal display.
571
e598186c
RS
572 If you scroll a window horizontally by hand, that sets a lower bound
573for automatic horizontal scrolling. Automatic scrolling will continue
574to scroll the window, but never further to the right than the amount
575you previously set by @code{scroll-left}.
6bf7aab6 576
e598186c
RS
577@vindex automatic-hscrolling
578 To disable automatic horizontal scrolling, set the variable
579@code{automatic-hscrolling} to @code{nil}.
03ff8aab 580
6bf7aab6
DL
581@node Follow Mode
582@section Follow Mode
583@cindex Follow mode
584@cindex mode, Follow
fd3d3075
RS
585@findex follow-mode
586@cindex windows, synchronizing
587@cindex synchronizing windows
6bf7aab6
DL
588
589 @dfn{Follow mode} is a minor mode that makes two windows showing the
590same buffer scroll as one tall ``virtual window.'' To use Follow mode,
591go to a frame with just one window, split it into two side-by-side
592windows using @kbd{C-x 3}, and then type @kbd{M-x follow-mode}. From
593then on, you can edit the buffer in either of the two windows, or scroll
594either one; the other window follows it.
595
8f399c9b
RS
596 In Follow mode, if you move point outside the portion visible in one
597window and into the portion visible in the other window, that selects
598the other window---again, treating the two as if they were parts of
599one large window.
600
6bf7aab6
DL
601 To turn off Follow mode, type @kbd{M-x follow-mode} a second time.
602
603@node Selective Display
604@section Selective Display
4946337d 605@cindex selective display
6bf7aab6
DL
606@findex set-selective-display
607@kindex C-x $
608
609 Emacs has the ability to hide lines indented more than a certain number
610of columns (you specify how many columns). You can use this to get an
611overview of a part of a program.
612
613 To hide lines, type @kbd{C-x $} (@code{set-selective-display}) with a
614numeric argument @var{n}. Then lines with at least @var{n} columns of
615indentation disappear from the screen. The only indication of their
616presence is that three dots (@samp{@dots{}}) appear at the end of each
617visible line that is followed by one or more hidden ones.
618
619 The commands @kbd{C-n} and @kbd{C-p} move across the hidden lines as
620if they were not there.
621
622 The hidden lines are still present in the buffer, and most editing
623commands see them as usual, so you may find point in the middle of the
624hidden text. When this happens, the cursor appears at the end of the
625previous line, after the three dots. If point is at the end of the
626visible line, before the newline that ends it, the cursor appears before
627the three dots.
628
629 To make all lines visible again, type @kbd{C-x $} with no argument.
630
631@vindex selective-display-ellipses
632 If you set the variable @code{selective-display-ellipses} to
633@code{nil}, the three dots do not appear at the end of a line that
634precedes hidden lines. Then there is no visible indication of the
635hidden lines. This variable becomes local automatically when set.
636
637@node Optional Mode Line
638@section Optional Mode Line Features
639
e598186c
RS
640@cindex line number display
641@cindex display of line number
6bf7aab6
DL
642@findex line-number-mode
643 The current line number of point appears in the mode line when Line
644Number mode is enabled. Use the command @kbd{M-x line-number-mode} to
645turn this mode on and off; normally it is on. The line number appears
646before the buffer percentage @var{pos}, with the letter @samp{L} to
647indicate what it is. @xref{Minor Modes}, for more information about
648minor modes and about how to use this command.
649
650@vindex line-number-display-limit
651 If the buffer is very large (larger than the value of
652@code{line-number-display-limit}), then the line number doesn't appear.
653Emacs doesn't compute the line number when the buffer is large, because
14977fea
DL
654that would be too slow. Set it to @code{nil} to remove the limit. If
655you have narrowed the buffer (@pxref{Narrowing}), the displayed line
656number is relative to the accessible portion of the buffer.
6bf7aab6
DL
657
658@cindex Column Number mode
659@cindex mode, Column Number
660@findex column-number-mode
661 You can also display the current column number by turning on Column
662Number mode. It displays the current column number preceded by the
663letter @samp{C}. Type @kbd{M-x column-number-mode} to toggle this mode.
664
665@findex display-time
666@cindex time (on mode line)
667 Emacs can optionally display the time and system load in all mode
4f00b8c1
DL
668lines. To enable this feature, type @kbd{M-x display-time} or customize
669the option @code{display-time-mode}. The information added to the mode
670line usually appears after the buffer name, before the mode names and
671their parentheses. It looks like this:
6bf7aab6
DL
672
673@example
674@var{hh}:@var{mm}pm @var{l.ll}
675@end example
676
677@noindent
678@vindex display-time-24hr-format
679Here @var{hh} and @var{mm} are the hour and minute, followed always by
680@samp{am} or @samp{pm}. @var{l.ll} is the average number of running
681processes in the whole system recently. (Some fields may be missing if
682your operating system cannot support them.) If you prefer time display
683in 24-hour format, set the variable @code{display-time-24hr-format}
684to @code{t}.
685
686@cindex mail (on mode line)
72bd7b7b
DL
687@vindex display-time-use-mail-icon
688@vindex display-time-mail-face
6bf7aab6 689 The word @samp{Mail} appears after the load level if there is mail
72bd7b7b
DL
690for you that you have not read yet. On a graphical display you can use
691an icon instead of @samp{Mail} by customizing
692@code{display-time-use-mail-icon}; this may save some space on the mode
693line. You can customize @code{display-time-mail-face} to make the mail
694indicator prominent.
6bf7aab6 695
bd3ead08
EZ
696@cindex mode line, 3D appearence
697@cindex attributes of mode line, changing
698@cindex non-integral number of lines in a window
699 By default, the mode line is drawn on graphics displays as a 3D
700released button. Depending on the font used for the mode line's text,
701this might make the mode line use more space than a text line in a
702window, and cause the last line of the window be partially obscured.
703That is, the window displays a non-integral number of text lines. If
704you don't like this effect, you can disable the 3D appearence of the
705mode line by customizing the attributes of the @code{mode-line} face in
706your @file{.emacs} init file, like this:
707
708@example
709 (set-face-attribute 'mode-line nil :box nil)
710@end example
711
712@noindent
713Alternatively, you could turn off the box attribute in your
714@file{.Xdefaults} file:
715
716@example
717 Emacs.mode-line.AttributeBox: off
718@end example
719
6bf7aab6
DL
720@node Text Display
721@section How Text Is Displayed
722@cindex characters (in text)
723
724 ASCII printing characters (octal codes 040 through 0176) in Emacs
725buffers are displayed with their graphics. So are non-ASCII multibyte
726printing characters (octal codes above 0400).
727
728 Some ASCII control characters are displayed in special ways. The
729newline character (octal code 012) is displayed by starting a new line.
730The tab character (octal code 011) is displayed by moving to the next
731tab stop column (normally every 8 columns).
732
733 Other ASCII control characters are normally displayed as a caret
734(@samp{^}) followed by the non-control version of the character; thus,
735control-A is displayed as @samp{^A}.
736
7c9960d7
DL
737 Non-ASCII characters 0200 through 0237 (octal) are displayed with
738octal escape sequences; thus, character code 0230 (octal) is displayed
739as @samp{\230}. The display of character codes 0240 through 0377
740(octal) may be either as escape sequences or as graphics. They do not
741normally occur in multibyte buffers but if they do, they are displayed
742as Latin-1 graphics. In unibyte mode, if you enable European display
743they are displayed using their graphics (assuming your terminal supports
744them), otherwise as escape sequences. @xref{Single-Byte Character
745Support}.
6bf7aab6 746
e598186c
RS
747@node Display Custom
748@section Customization of Display
6bf7aab6
DL
749
750 This section contains information for customization only. Beginning
751users should skip it.
752
753@vindex mode-line-inverse-video
dddbaa16
MB
754 The variable @code{mode-line-inverse-video} is an obsolete way of
755controlling whether the mode line is displayed in inverse video; the
756preferred way of doing this is to change the @code{mode-line} face.
757@xref{Mode Line}. If you specify the foreground color for the
758@code{mode-line} face, and @code{mode-line-inverse-video} is
759non-@code{nil}, then the default background color for that face is the
760usual foreground color. @xref{Faces}.
6bf7aab6
DL
761
762@vindex inverse-video
763 If the variable @code{inverse-video} is non-@code{nil}, Emacs attempts
764to invert all the lines of the display from what they normally are.
765
766@vindex visible-bell
767 If the variable @code{visible-bell} is non-@code{nil}, Emacs attempts
768to make the whole screen blink when it would normally make an audible bell
769sound. This variable has no effect if your terminal does not have a way
770to make the screen blink.@refill
771
772@vindex no-redraw-on-reenter
773 When you reenter Emacs after suspending, Emacs normally clears the
774screen and redraws the entire display. On some terminals with more than
775one page of memory, it is possible to arrange the termcap entry so that
776the @samp{ti} and @samp{te} strings (output to the terminal when Emacs
777is entered and exited, respectively) switch between pages of memory so
778as to use one page for Emacs and another page for other output. Then
779you might want to set the variable @code{no-redraw-on-reenter}
780non-@code{nil}; this tells Emacs to assume, when resumed, that the
781screen page it is using still contains what Emacs last wrote there.
782
783@vindex echo-keystrokes
784 The variable @code{echo-keystrokes} controls the echoing of multi-character
785keys; its value is the number of seconds of pause required to cause echoing
786to start, or zero meaning don't echo at all. @xref{Echo Area}.
787
788@vindex ctl-arrow
789 If the variable @code{ctl-arrow} is @code{nil}, control characters in
790the buffer are displayed with octal escape sequences, except for newline
791and tab. Altering the value of @code{ctl-arrow} makes it local to the
792current buffer; until that time, the default value is in effect. The
793default is initially @code{t}. @xref{Display Tables,, Display Tables,
794elisp, The Emacs Lisp Reference Manual}.
795
796@vindex tab-width
797 Normally, a tab character in the buffer is displayed as whitespace which
798extends to the next display tab stop position, and display tab stops come
799at intervals equal to eight spaces. The number of spaces per tab is
800controlled by the variable @code{tab-width}, which is made local by
801changing it, just like @code{ctl-arrow}. Note that how the tab character
802in the buffer is displayed has nothing to do with the definition of
803@key{TAB} as a command. The variable @code{tab-width} must have an
804integer value between 1 and 1000, inclusive.
805
806@c @vindex truncate-lines @c No index entry here, because we have one
807@c in the continuation section.
808 If the variable @code{truncate-lines} is non-@code{nil}, then each
809line of text gets just one screen line for display; if the text line is
810too long, display shows only the part that fits. If
811@code{truncate-lines} is @code{nil}, then long text lines display as
812more than one screen line, enough to show the whole text of the line.
813@xref{Continuation Lines}. Altering the value of @code{truncate-lines}
814makes it local to the current buffer; until that time, the default value
815is in effect. The default is initially @code{nil}.
816
817@c @vindex truncate-partial-width-windows @c Idx entry is in Split Windows.
818 If the variable @code{truncate-partial-width-windows} is
819non-@code{nil}, it forces truncation rather than continuation in any
820window less than the full width of the screen or frame, regardless of
821the value of @code{truncate-lines}. For information about side-by-side
822windows, see @ref{Split Window}. See also @ref{Display,, Display,
823elisp, The Emacs Lisp Reference Manual}.
824
825@vindex baud-rate
87c8b5fd
RS
826 The variable @code{baud-rate} holds the output speed of the
827terminal, as far as Emacs knows. Setting this variable does not
828change the speed of actual data transmission, but the value is used
829for calculations. On terminals, it affects padding, and decisions
830about whether to scroll part of the screen or redraw it instead.
860dab78 831
e598186c
RS
832 On window-systems, @code{baud-rate} is only used to determine how
833frequently to look for pending input during display updating. A
834higher value of @code{baud-rate} means that check for pending input
835will be done less frequently.
6bf7aab6
DL
836
837 You can customize the way any particular character code is displayed
838by means of a display table. @xref{Display Tables,, Display Tables,
839elisp, The Emacs Lisp Reference Manual}.
e598186c 840
62095f01
GM
841@cindex hourglass pointer display
842@vindex hourglass-delay
099bfef9
RS
843 On a window system, Emacs can optionally display the mouse pointer
844in a special shape to say that Emacs is busy. To turn this feature on
845or off, customize the group @code{cursor}. You can also control the
846amount of time Emacs must remain busy before the busy indicator is
62095f01 847displayed, by setting the variable @code{hourglass-delay}.
099bfef9
RS
848
849@node Cursor Display
850@section Displaying the Cursor
851
e598186c
RS
852@findex hl-line-mode
853@findex blink-cursor-mode
854@cindex cursor, locating visually
855@cindex cursor, blinking
856 There are a number of ways to customize the display of the cursor.
857@kbd{M-x hl-line-mode} enables or disables a global minor mode which
099bfef9 858highlights the line containing point. On window systems, the command
e598186c
RS
859@kbd{M-x blink-cursor-mode} turns on or off the blinking of the
860cursor. (On terminals, the terminal itself blinks the cursor, and
87c8b5fd 861Emacs has no control over it.)
e598186c
RS
862
863 You can customize the cursor's color, and whether it blinks, using
864the @code{cursor} Custom group (@pxref{Easy Customization}).
099bfef9
RS
865
866@vindex x-stretch-cursor
867@cindex wide block cursor
868 When displaying on a window system, Emacs can optionally draw the
869block cursor as wide as the character under the cursor---for example,
870if the cursor is on a tab character, it would cover the full width
871occupied by that tab character. To enable this feature, set the
872variable @code{x-stretch-cursor} to a non-@code{nil} value.
0f613b80
RS
873
874@cindex cursor in non-selected windows
4946337d 875@vindex show-cursor-in-non-selected-windows
0f613b80 876@vindex cursor-in-non-selected-windows
4946337d
EZ
877 Normally, the cursor in non-selected windows is shown as a hollow box.
878To turn off cursor display in non-selected windows, customize the option
879@code{show-cursor-in-non-selected-windows}, or set the variable
880@code{cursor-in-non-selected-windows} to @code{nil}.