etc/PROBLEMS: Mention crashes on MS-Windows when compiled with GCC 4.6.1.
[bpt/emacs.git] / doc / emacs / display.texi
CommitLineData
802b0ea7 1@c This is part of the Emacs manual.
73b0cd50 2@c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2011
0419b8d6
GM
3@c Free Software Foundation, Inc.
4
6bf7aab6
DL
5@c See file emacs.texi for copying conditions.
6@node Display, Search, Registers, Top
7@chapter Controlling the Display
8
41859241
CY
9 Since only part of a large buffer fits in the window, Emacs has to
10show only a part of it. This chapter describes commands and variables
11that let you specify which part of the text you want to see, and how
12the text is displayed.
6bf7aab6
DL
13
14@menu
8838673e 15* Scrolling:: Commands to move text up and down in a window.
43d67313 16* Auto Scrolling:: Redisplay scrolls text automatically when needed.
54952612 17* Horizontal Scrolling:: Moving text left and right in a window.
f404f8bc
CY
18* Narrowing:: Restricting display and editing to a portion
19 of the buffer.
a6326082 20* View Mode:: Viewing read-only buffers.
54952612 21* Follow Mode:: Follow mode lets two windows scroll as one.
8838673e 22* Faces:: How to change the display style using faces.
43d08eb9 23* Standard Faces:: Emacs' predefined faces.
d366bd53 24* Text Scale:: Increasing or decreasing text size in a buffer.
b8f3a9e3 25* Font Lock:: Minor mode for syntactic highlighting using faces.
b8f3a9e3 26* Highlight Interactively:: Tell Emacs what text to highlight.
fad78d58 27* Fringes:: Enabling or disabling window fringes.
9d2908a6 28* Displaying Boundaries:: Displaying top and bottom of the buffer.
fad78d58 29* Useless Whitespace:: Showing possibly-spurious trailing whitespace.
6bf7aab6
DL
30* Selective Display:: Hiding lines with lots of indentation.
31* Optional Mode Line:: Optional mode line display features.
32* Text Display:: How text characters are normally displayed.
099bfef9 33* Cursor Display:: Features for displaying the cursor.
9d2908a6
RS
34* Line Truncation:: Truncating lines to fit the screen width instead
35 of continuing them to multiple screen lines.
458db4b6 36* Visual Line Mode:: Word wrap and screen line-based editing.
0015d677 37* Display Custom:: Information on variables for customizing display.
6bf7aab6
DL
38@end menu
39
dc917bd9
RS
40@node Scrolling
41@section Scrolling
550f41cd 42@cindex scrolling
dc917bd9 43
550f41cd
CY
44 If a window is too small to display all the text in its buffer, it
45displays only a portion of it. @dfn{Scrolling} commands change which
46portion of the buffer is displayed.
dc917bd9 47
550f41cd
CY
48 Scrolling ``forward'' or ``up'' advances the portion of the buffer
49displayed in the window; equivalently, it moves the buffer text
50upwards relative to the window. Scrolling ``backward'' or ``down''
51moves the displayed portion backwards, and moves the text downwards
41859241
CY
52relative to the window. In Emacs, scrolling ``up'' or ``down'' refers
53to the direction that the text moves in the window, @emph{not} the
54direction that the window moves relative to the text; this terminology
55was taken up by Emacs before the modern meaning of ``scrolling up''
56and ``scrolling down'' became widely adopted. Hence the strange
57result that @key{PageDown} scrolls ``up'' in the Emacs sense. In this
d366bd53 58manual, we refer to scrolling ``forward'' and ``backward'' where
41859241 59possible, in order to minimize confusion.
dc917bd9 60
550f41cd
CY
61 The portion of a buffer displayed in a window always contains point.
62If you move point past the bottom or top of the window, scrolling
63occurs automatically to bring it back onscreen (@pxref{Auto
64Scrolling}). You can also scroll explicitly with these commands:
dc917bd9
RS
65
66@table @kbd
67@item C-l
91ed7ea8
CY
68Scroll the selected window so that the current line is the center-most
69text line; on subsequent consecutive invocations, make the current
41859241 70line the top-most line, the bottom-most line, and so on in cyclic
91ed7ea8 71order; also, maybe redisplay the screen (@code{recenter-top-bottom}).
dc917bd9 72@item C-v
b5700de6
CY
73@itemx @key{next}
74@itemx @key{PageDown}
61436e9f 75Scroll forward by nearly a full window (@code{scroll-up-command}).
dc917bd9 76@item M-v
b5700de6
CY
77@itemx @key{prior}
78@itemx @key{PageUp}
61436e9f 79Scroll backward (@code{scroll-down-command}).
dc917bd9
RS
80@item C-M-l
81Scroll heuristically to bring useful information onto the screen
82(@code{reposition-window}).
83@end table
84
85@kindex C-l
956c76ef 86@findex recenter-top-bottom
550f41cd
CY
87 The @kbd{C-l} (@code{recenter-top-bottom}) command @dfn{recenters}
88the selected window, scrolling it so that the current screen line is
89exactly in the center of the window, or as close to the center as
90possible.
956c76ef
CY
91
92 Typing @kbd{C-l} twice in a row (@kbd{C-l C-l}) scrolls the window
93so that point is on the topmost screen line. Typing a third @kbd{C-l}
94scrolls the window so that point is on the bottom-most screen line.
41859241 95Each successive @kbd{C-l} cycles through these three positions.
91ed7ea8
CY
96
97@vindex recenter-positions
98 You can change the cycling order by customizing the list variable
99@code{recenter-positions}. Each list element should be the symbol
100@code{top}, @code{middle}, or @code{bottom}, or a number; an integer
41859241 101means to move the line to the specified screen line, while a
91ed7ea8 102floating-point number between 0.0 and 1.0 specifies a percentage of
41859241
CY
103the screen space from the top of the window. The default,
104@code{(middle top bottom)}, is the cycling order described above.
105Furthermore, if you change the variable @code{scroll-margin} to a
106non-zero value @var{n}, @kbd{C-l} always leaves at least @var{n}
107screen lines between point and the top or bottom of the window
108(@pxref{Auto Scrolling}).
956c76ef
CY
109
110 You can also supply @kbd{C-l} with a prefix argument. With a plain
111prefix argument, @kbd{C-u C-l}, Emacs simply recenters point. With a
112positive argument @var{n}, it scrolls to place point @var{n} lines
113down from the top of the window. An argument of zero puts point on
114the topmost line. A negative argument @var{-n} puts point @var{n}
41859241
CY
115lines from the bottom of the window. When given an argument,
116@kbd{C-l} does not clear the screen or cycle through different screen
117positions.
dc917bd9 118
666e158e 119@vindex recenter-redisplay
91ed7ea8 120 If the variable @code{recenter-redisplay} has a non-@code{nil}
550f41cd
CY
121value, each invocation of @kbd{C-l} also clears and redisplays the
122screen; the special value @code{tty} (the default) says to do this on
123text-terminal frames only. Redisplaying is useful in case the screen
124becomes garbled for any reason (@pxref{Screen Garbled}).
125
126@findex recenter
41859241 127 The more primitive command @kbd{M-x recenter} behaves like
550f41cd 128@code{recenter-top-bottom}, but does not cycle among screen positions.
666e158e 129
dc917bd9
RS
130@kindex C-v
131@kindex M-v
b5700de6
CY
132@kindex next
133@kindex prior
134@kindex PageDown
135@kindex PageUp
550f41cd
CY
136@findex scroll-up-command
137@findex scroll-down-command
41859241
CY
138 @kbd{C-v} (@code{scroll-up-command}) scrolls forward by nearly the
139whole window height. The effect is to take the two lines at the
140bottom of the window and put them at the top, followed by lines that
141were not previously visible. If point was in the text that scrolled
142off the top, it ends up on the window's new topmost line.
956c76ef 143
550f41cd 144 Similarly, @kbd{M-v} (@code{scroll-down-command}) scrolls backward.
dc917bd9 145
41859241
CY
146 We refer to @kbd{C-v} and @kbd{M-v} as @dfn{full-screen scroll
147commands}. The function key @key{next}, or @key{PageDown}, is
148equivalent to @kbd{C-v}; the function key @key{prior}, or
149@key{PageUp}, is equivalent to @kbd{M-v}.
150
43d67313 151@vindex next-screen-context-lines
956c76ef 152 The variable @code{next-screen-context-lines} controls the number of
41859241
CY
153lines of overlap left by the full-screen scroll commands; by default,
154it is 2. You can supply these commands with a numeric prefix argument
956c76ef
CY
155@var{n}. This scrolls the window by @var{n} lines, while attempting
156to leave point unchanged (so that the text and point move up or down
157together). @kbd{C-v} with a negative argument is like @kbd{M-v} and
158vice versa.
dc917bd9 159
41859241
CY
160@vindex scroll-error-top-bottom
161 By default, the full-screen scroll commands signal an error (by
162beeping or flashing the screen) if no more scrolling is possible,
163because the window has reached the beginning or end of the buffer. If
164you change the variable @code{scroll-error-top-bottom} to @code{t},
165Emacs instead moves point to the farthest possible position. If point
166is already there, the command signals an error.
dc917bd9
RS
167
168@vindex scroll-preserve-screen-position
41859241
CY
169 Some users like scroll commands to keep point at the same screen
170position. Then, scrolling back to the same screen also conveniently
171returns point to its original position. You can enable this via the
172variable @code{scroll-preserve-screen-position}. If the value is
173@code{t}, Emacs adjusts point to keep it at the same vertical position
174within the window, rather than the window edge, whenever a scroll
175command moves it off the window. With any other non-@code{nil} value,
176Emacs adjusts point this way even if the scroll command leaves point
177in the window.
550f41cd
CY
178
179@vindex scroll-up
180@vindex scroll-down
181 The commands @code{scroll-up} and @code{scroll-down} behave
182similarly to @code{scroll-up-command} and @code{scroll-down-command},
183except they do not obey @code{scroll-error-top-bottom}. Prior to
184Emacs 24, these were the default commands for scrolling up and down.
dc917bd9
RS
185
186@kindex C-M-l
187@findex reposition-window
41859241
CY
188 @kbd{C-M-l} (@code{reposition-window}) scrolls the current window
189heuristically in a way designed to get useful information onto the
190screen. For example, in a Lisp file, this command tries to get the
dc917bd9
RS
191entire current defun onto the screen if possible.
192
43d67313
RS
193@node Auto Scrolling
194@section Automatic Scrolling
195
956c76ef
CY
196 Emacs performs @dfn{automatic scrolling} when point moves out of the
197visible portion of the text.
198
dc917bd9 199@vindex scroll-conservatively
956c76ef
CY
200 Normally, this centers point vertically within the window. However,
201if you set @code{scroll-conservatively} to a small number @var{n},
202then if you move point just a little off the screen (less than @var{n}
203lines), Emacs scrolls the text just far enough to bring point back on
09725d26
EZ
204screen. By default, @code{scroll-conservatively} is@tie{}0. If you
205set @code{scroll-conservatively} to a large number (larger than 100),
206Emacs will never center point as result of scrolling, even if point
207moves far away from the text previously displayed in the window. With
208such a large value, Emacs will always scroll text just enough for
209bringing point into view, so point will end up at the top or bottom of
210the window, depending on the scroll direction.
211
212@vindex scroll-step
213 The variable @code{scroll-step} determines how many lines to scroll
214the window when point moves off the screen. If moving by that number
215of lines fails to bring point back into view, point is centered
216instead. The default value is zero, which causes point to always be
217centered after scrolling.
dc917bd9
RS
218
219@cindex aggressive scrolling
220@vindex scroll-up-aggressively
221@vindex scroll-down-aggressively
222 When the window does scroll by a longer distance, you can control
956c76ef 223how aggressively it scrolls by setting the variables
dc917bd9
RS
224@code{scroll-up-aggressively} and @code{scroll-down-aggressively}.
225The value of @code{scroll-up-aggressively} should be either
226@code{nil}, or a fraction @var{f} between 0 and 1. A fraction
3b361baf 227specifies where on the screen to put point when scrolling upward,
41859241
CY
228i.e. forward. When point goes off the window end, the new start
229position is chosen to put point @var{f} parts of the window height
230from the bottom. Thus, larger @var{f} means more aggressive
3b361baf
EZ
231scrolling: more new text is brought into view. The default value,
232@code{nil}, is equivalent to 0.5.
dc917bd9
RS
233
234 Likewise, @code{scroll-down-aggressively} is used for scrolling
41859241
CY
235down, i.e. backward. The value specifies how far point should be
236placed from the top of the window; thus, as with
3b361baf 237@code{scroll-up-aggressively}, a larger value is more aggressive.
dc917bd9 238
09725d26
EZ
239 These two variables are ignored if either @code{scroll-step} or
240@code{scroll-conservatively} are set to a non-zero value.
241
dc917bd9
RS
242@vindex scroll-margin
243 The variable @code{scroll-margin} restricts how close point can come
244to the top or bottom of a window. Its value is a number of screen
956c76ef
CY
245lines; if point comes within that many lines of the top or bottom of
246the window, Emacs performs automatic scrolling. By default,
247@code{scroll-margin} is 0.
dc917bd9
RS
248
249@node Horizontal Scrolling
250@section Horizontal Scrolling
251@cindex horizontal scrolling
252
956c76ef 253@vindex auto-hscroll-mode
dc917bd9 254 @dfn{Horizontal scrolling} means shifting all the lines sideways
956c76ef
CY
255within a window, so that some of the text near the left margin is not
256displayed. When the text in a window is scrolled horizontally, text
257lines are truncated rather than continued (@pxref{Line Truncation}).
258If a window shows truncated lines, Emacs performs automatic horizontal
259scrolling whenever point moves off the left or right edge of the
260screen. To disable automatic horizontal scrolling, set the variable
6308321a
EZ
261@code{auto-hscroll-mode} to @code{nil}. Note that when the automatic
262horizontal scrolling is turned off, if point moves off the edge of the
41859241 263screen, the cursor disappears to indicate that. (On text-only
6308321a 264terminals, the cursor is left at the edge instead.)
956c76ef
CY
265
266@vindex hscroll-margin
267 The variable @code{hscroll-margin} controls how close point can get
6308321a
EZ
268to the window's edges before automatic scrolling occurs. It is
269measured in columns. For example, if the value is 5, then moving
270point within 5 columns of an edge causes horizontal scrolling away
271from that edge.
956c76ef
CY
272
273@vindex hscroll-step
274 The variable @code{hscroll-step} determines how many columns to
275scroll the window when point gets too close to the edge. Zero, the
276default value, means to center point horizontally within the window.
277A positive integer value specifies the number of columns to scroll by.
278A floating-point number specifies the fraction of the window's width
279to scroll by.
280
281 You can also perform explicit horizontal scrolling with the
282following commands:
dc917bd9
RS
283
284@table @kbd
285@item C-x <
286Scroll text in current window to the left (@code{scroll-left}).
287@item C-x >
288Scroll to the right (@code{scroll-right}).
289@end table
290
291@kindex C-x <
292@kindex C-x >
293@findex scroll-left
294@findex scroll-right
6308321a
EZ
295 @kbd{C-x <} (@code{scroll-left}) scrolls text in the selected window
296to the left by the full width of the window, less two columns. (In
297other words, the text in the window moves left relative to the
298window.) With a numeric argument @var{n}, it scrolls by @var{n}
299columns.
300
301 If the text is scrolled to the left, and point moves off the left
302edge of the window, the cursor will freeze at the left edge of the
303window, until point moves back to the displayed portion of the text.
304This is independent of the current setting of
305@code{auto-hscroll-mode}, which, for text scrolled to the left, only
306affects the behavior at the right edge of the window.
956c76ef
CY
307
308 @kbd{C-x >} (@code{scroll-right}) scrolls similarly to the right.
309The window cannot be scrolled any farther to the right once it is
310displayed normally, with each line starting at the window's left
311margin; attempting to do so has no effect. This means that you don't
312have to calculate the argument precisely for @w{@kbd{C-x >}}; any
313sufficiently large argument will restore the normal display.
dc917bd9
RS
314
315 If you use those commands to scroll a window horizontally, that sets
316a lower bound for automatic horizontal scrolling. Automatic scrolling
317will continue to scroll the window, but never farther to the right
318than the amount you previously set by @code{scroll-left}.
319
f404f8bc
CY
320@node Narrowing
321@section Narrowing
322@cindex widening
323@cindex restriction
324@cindex narrowing
325@cindex accessible portion
326
327 @dfn{Narrowing} means focusing in on some portion of the buffer,
328making the rest temporarily inaccessible. The portion which you can
329still get to is called the @dfn{accessible portion}. Canceling the
330narrowing, which makes the entire buffer once again accessible, is
331called @dfn{widening}. The bounds of narrowing in effect in a buffer
332are called the buffer's @dfn{restriction}.
333
334 Narrowing can make it easier to concentrate on a single subroutine or
335paragraph by eliminating clutter. It can also be used to limit the
336range of operation of a replace command or repeating keyboard macro.
337
338@table @kbd
339@item C-x n n
340Narrow down to between point and mark (@code{narrow-to-region}).
341@item C-x n w
342Widen to make the entire buffer accessible again (@code{widen}).
343@item C-x n p
344Narrow down to the current page (@code{narrow-to-page}).
345@item C-x n d
346Narrow down to the current defun (@code{narrow-to-defun}).
347@end table
348
349 When you have narrowed down to a part of the buffer, that part appears
350to be all there is. You can't see the rest, you can't move into it
351(motion commands won't go outside the accessible part), you can't change
352it in any way. However, it is not gone, and if you save the file all
353the inaccessible text will be saved. The word @samp{Narrow} appears in
354the mode line whenever narrowing is in effect.
355
356@kindex C-x n n
357@findex narrow-to-region
358 The primary narrowing command is @kbd{C-x n n} (@code{narrow-to-region}).
359It sets the current buffer's restrictions so that the text in the current
360region remains accessible, but all text before the region or after the
361region is inaccessible. Point and mark do not change.
362
363@kindex C-x n p
364@findex narrow-to-page
365@kindex C-x n d
366@findex narrow-to-defun
367 Alternatively, use @kbd{C-x n p} (@code{narrow-to-page}) to narrow
368down to the current page. @xref{Pages}, for the definition of a page.
369@kbd{C-x n d} (@code{narrow-to-defun}) narrows down to the defun
370containing point (@pxref{Defuns}).
371
372@kindex C-x n w
373@findex widen
374 The way to cancel narrowing is to widen with @kbd{C-x n w}
375(@code{widen}). This makes all text in the buffer accessible again.
376
377 You can get information on what part of the buffer you are narrowed down
378to using the @kbd{C-x =} command. @xref{Position Info}.
379
380 Because narrowing can easily confuse users who do not understand it,
381@code{narrow-to-region} is normally a disabled command. Attempting to use
382this command asks for confirmation and gives you the option of enabling it;
383if you enable the command, confirmation will no longer be required for
384it. @xref{Disabling}.
385
a6326082
CY
386@node View Mode
387@section View Mode
388@cindex View mode
389@cindex mode, View
390
41859241
CY
391@kindex s @r{(View mode)}
392@kindex SPC @r{(View mode)}
393@kindex DEL @r{(View mode)}
a6326082
CY
394 View mode is a minor mode that lets you scan a buffer by sequential
395screenfuls. It provides commands for scrolling through the buffer
396conveniently but not for changing it. Apart from the usual Emacs
397cursor motion commands, you can type @key{SPC} to scroll forward one
e2aeef63
CY
398windowful, @key{DEL} to scroll backward, and @kbd{s} to start an
399incremental search.
a6326082 400
41859241
CY
401@kindex q @r{(View mode)}
402@kindex e @r{(View mode)}
403@findex View-quit
404@findex View-exit
405 Typing @kbd{q} (@code{View-quit}) disables View mode, and switches
406back to the buffer and position before View mode was enabled. Typing
407@kbd{e} (@code{View-exit}) disables View mode, keeping the current
408buffer and position.
a6326082
CY
409
410@findex view-buffer
411@findex view-file
412 @kbd{M-x view-buffer} prompts for an existing Emacs buffer, switches
413to it, and enables View mode. @kbd{M-x view-file} prompts for a file
414and visits it with View mode enabled.
415
dc917bd9
RS
416@node Follow Mode
417@section Follow Mode
418@cindex Follow mode
419@cindex mode, Follow
420@findex follow-mode
421@cindex windows, synchronizing
422@cindex synchronizing windows
423
424 @dfn{Follow mode} is a minor mode that makes two windows, both
425showing the same buffer, scroll as a single tall ``virtual window.''
426To use Follow mode, go to a frame with just one window, split it into
427two side-by-side windows using @kbd{C-x 3}, and then type @kbd{M-x
428follow-mode}. From then on, you can edit the buffer in either of the
429two windows, or scroll either one; the other window follows it.
430
431 In Follow mode, if you move point outside the portion visible in one
432window and into the portion visible in the other window, that selects
433the other window---again, treating the two as if they were parts of
434one large window.
435
436 To turn off Follow mode, type @kbd{M-x follow-mode} a second time.
437
b8f3a9e3 438@node Faces
b18a8f7f 439@section Faces: Controlling Text Display Style
b8f3a9e3
GM
440@cindex faces
441
d366bd53 442 Emacs can display text in several different styles, called
0015d677 443@dfn{faces}. Each face can specify various @dfn{face attributes},
d366bd53
CY
444such as the font, height, weight, slant, foreground and background
445color, and underlining or overlining. Most major modes assign faces
446to the text automatically, via Font Lock mode. @xref{Font Lock}, for
447more information about how these faces are assigned.
448
449@findex list-faces-display
450 To see what faces are currently defined, and what they look like,
451type @kbd{M-x list-faces-display}. With a prefix argument, this
452prompts for a regular expression, and displays only faces with names
453matching that regular expression (@pxref{Regexps}).
454
455 It's possible for a given face to look different in different
456frames. For instance, some text-only terminals do not support all
457face attributes, particularly font, height, and width, and some
458support a limited range of colors. The @code{list-faces-display}
459command shows the appearance for the selected frame.
b8f3a9e3
GM
460
461@cindex face colors, setting
d366bd53
CY
462@cindex background color
463@cindex default face
464 You can customize a face to alter its appearance, and save those
465changes for future Emacs sessions. @xref{Face Customization}. A face
466does not have to specify every single attribute; often it inherits
467most attributes from another face. Any ultimately unspecified
468attribute is taken from a face named @code{default}, whose attributes
469are all specified. The @code{default} face is the default for
470displaying text, and its background color is also used as the frame's
471background color.
472
473 You can also use X resources to specify attributes of any particular
474face. @xref{Resources}.
956c76ef
CY
475
476@findex set-face-foreground
477@findex set-face-background
d366bd53
CY
478 You can also change the foreground and background colors of a face
479with @kbd{M-x set-face-foreground} and @kbd{M-x set-face-background}.
480These commands prompt in the minibuffer for a face name and a color
481name, with completion, and then set that face to use the specified
482color (@pxref{Face Customization}, for information about color names).
483They affect the face colors on all frames, but their effects do not
484persist for future Emacs sessions, unlike using the customization
485buffer or X resources. You can also use frame parameters to set
486foreground and background colors for a specific frame; see @ref{Frame
487Parameters}.
488
489 Emacs can display variable-width fonts, but some Emacs commands,
490particularly indentation commands, do not account for variable
491character display widths. Therefore, we recommend not using
492variable-width fonts for most faces, particularly those assigned by
493Font Lock mode.
b8f3a9e3 494
43d08eb9
RS
495@node Standard Faces
496@section Standard Faces
497
54952612
RS
498 Here are the standard faces for specifying text appearance. You can
499apply them to specific text when you want the effects they produce.
b8f3a9e3
GM
500
501@table @code
502@item default
54952612 503This face is used for ordinary text that doesn't specify any face.
d366bd53 504Its background color is used as the frame's background color.
43d08eb9 505@item bold
956c76ef 506This face uses a bold variant of the default font.
43d08eb9 507@item italic
956c76ef 508This face uses an italic variant of the default font.
43d08eb9 509@item bold-italic
956c76ef 510This face uses a bold italic variant of the default font.
43d08eb9
RS
511@item underline
512This face underlines text.
513@item fixed-pitch
956c76ef
CY
514This face forces use of a fixed-width font. It's reasonable to
515customize this face to use a different fixed-width font, if you like,
516but you should not make it a variable-width font.
43d08eb9 517@item variable-pitch
956c76ef 518This face forces use of a variable-width font.
3b91a16d
JL
519@item shadow
520This face is used for making the text less noticeable than the surrounding
521ordinary text. Usually this can be achieved by using shades of gray in
522contrast with either black or white default foreground color.
43d08eb9
RS
523@end table
524
525 Here's an incomplete list of faces used to highlight parts of the
526text temporarily for specific purposes. (Many other modes define
527their own faces for this purpose.)
528
529@table @code
530@item highlight
d366bd53
CY
531This face is used for text highlighting in various contexts, such as
532when the mouse cursor is moved over a hyperlink.
43d08eb9 533@item isearch
d366bd53 534This face is used to highlight the current Isearch match
956c76ef 535(@pxref{Incremental Search}).
54952612 536@item query-replace
d366bd53 537This face is used to highlight the current Query Replace match
956c76ef 538(@pxref{Replace}).
43d08eb9 539@item lazy-highlight
d366bd53
CY
540This face is used to highlight ``lazy matches'' for Isearch and Query
541Replace (matches other than the current one).
43d08eb9 542@item region
d366bd53
CY
543This face is used for displaying an active region (@pxref{Mark}).
544When Emacs is built with GTK support, its colors are taken from the
545current GTK theme.
43d08eb9
RS
546@item secondary-selection
547This face is used for displaying a secondary X selection (@pxref{Secondary
548Selection}).
549@item trailing-whitespace
3b91a16d 550The face for highlighting excess spaces and tabs at the end of a line
d366bd53
CY
551when @code{show-trailing-whitespace} is non-@code{nil} (@pxref{Useless
552Whitespace}).
43d08eb9 553@item escape-glyph
d366bd53
CY
554The face for displaying control characters and escape sequences
555(@pxref{Text Display}).
556@item nobreak-space
939db9ac 557The face for displaying ``no-break'' space characters (@pxref{Text
d366bd53 558Display}).
43d08eb9
RS
559@end table
560
d366bd53
CY
561 The following faces control the appearance of parts of the Emacs
562frame:
43d08eb9
RS
563
564@table @code
b8f3a9e3 565@item mode-line
3b91a16d
JL
566This face is used for the mode line of the currently selected window,
567and for menu bars when toolkit menus are not used. By default, it's
54952612 568drawn with shadows for a ``raised'' effect on graphical displays, and
3b91a16d 569drawn as the inverse of the default face on non-windowed terminals.
b9e58bf2
EZ
570@item mode-line-inactive
571Like @code{mode-line}, but used for mode lines of the windows other
572than the selected one (if @code{mode-line-in-non-selected-windows} is
ac6875fc
RS
573non-@code{nil}). This face inherits from @code{mode-line}, so changes
574in that face affect mode lines in all windows.
d545c9fd
JL
575@item mode-line-highlight
576Like @code{highlight}, but used for portions of text on mode lines.
577@item mode-line-buffer-id
578This face is used for buffer identification parts in the mode line.
b8f3a9e3 579@item header-line
54952612
RS
580Similar to @code{mode-line} for a window's header line, which appears
581at the top of a window just as the mode line appears at the bottom.
582Most windows do not have a header line---only some special modes, such
583Info mode, create one.
53abc3bf 584@item vertical-border
d366bd53
CY
585This face is used for the vertical divider between windows on
586text-only terminals.
3094ad7a 587@item minibuffer-prompt
3b91a16d
JL
588@cindex @code{minibuffer-prompt} face
589@vindex minibuffer-prompt-properties
3094ad7a 590This face is used for the prompt strings displayed in the minibuffer.
3b91a16d
JL
591By default, Emacs automatically adds this face to the value of
592@code{minibuffer-prompt-properties}, which is a list of text
43d67313
RS
593properties used to display the prompt text. (This variable takes
594effect when you enter the minibuffer.)
b8f3a9e3 595@item fringe
3b91a16d 596@cindex @code{fringe} face
b8f3a9e3
GM
597The face for the fringes to the left and right of windows on graphic
598displays. (The fringes are the narrow portions of the Emacs frame
940627fe 599between the text area and the window's right and left borders.)
43d08eb9 600@xref{Fringes}.
b8f3a9e3 601@item cursor
939db9ac
CY
602The @code{:background} attribute of this face specifies the color of
603the text cursor. @xref{Cursor Display}.
d366bd53
CY
604@item tooltip
605This face is used for tooltip text. By default, if Emacs is built
606with GTK support, tooltips are drawn via GTK and this face has no
607effect. @xref{Tooltips}.
b8f3a9e3
GM
608@item mouse
609This face determines the color of the mouse pointer.
d366bd53
CY
610@end table
611
612 The following faces likewise control the appearance of parts of the
613Emacs frame, but only on text-only terminals, or when Emacs is built
614on X with no toolkit support. (For all other cases, the appearance of
615the respective frame elements is determined by system-wide settings.)
616
617@table @code
618@item scroll-bar
619This face determines the visual appearance of the scroll bar.
620@xref{Scroll Bars}.
b8f3a9e3 621@item tool-bar
54952612 622This face determines the color of tool bar icons. @xref{Tool Bars}.
b8f3a9e3 623@item menu
9e6bb19f
EZ
624@cindex menu bar appearance
625@cindex @code{menu} face, no effect if customized
626@cindex customization of @code{menu} face
627This face determines the colors and font of Emacs's menus. @xref{Menu
d366bd53 628Bars}.
b8f3a9e3
GM
629@end table
630
d366bd53
CY
631@node Text Scale
632@section Text Scale
956c76ef
CY
633
634@cindex adjust buffer face height
635@findex text-scale-adjust
636@kindex C-x C-+
637@kindex C-x C--
638@kindex C-x C-=
639@kindex C-x C-0
640 To increase the height of the default face in the current buffer,
641type @kbd{C-x C-+} or @kbd{C-x C-=}. To decrease it, type @kbd{C-x
642C--}. To restore the default (global) face height, type @kbd{C-x
643C-0}. These keys are all bound to the same command,
644@code{text-scale-adjust}, which looks at the last key typed to
645determine which action to take.
646
647 The final key of these commands may be repeated without the leading
648@kbd{C-x}. For instance, @kbd{C-x C-= C-= C-=} increases the face
d366bd53
CY
649height by three steps. Each step scales the text height by a factor
650of 1.2; to change this factor, customize the variable
651@code{text-scale-mode-step}. As an exception, a numeric argument of 0
652to the @code{text-scale-adjust} command restores the default height,
653similar to typing @kbd{C-x C-0}.
956c76ef
CY
654
655@cindex increase buffer face height
656@findex text-scale-increase
657@cindex decrease buffer face height
658@findex text-scale-decrease
659 The commands @code{text-scale-increase} and
660@code{text-scale-decrease} increase or decrease the height of the
661default face, just like @kbd{C-x C-+} and @kbd{C-x C--} respectively.
662You may find it convenient to bind to these commands, rather than
663@code{text-scale-adjust}.
664
05fbc4a9
MB
665@cindex set buffer face height
666@findex text-scale-set
d366bd53
CY
667 The command @code{text-scale-set} scales the height of the default
668face in the current buffer to an absolute level specified by its
669prefix argument.
05fbc4a9 670
956c76ef 671@findex text-scale-mode
d366bd53
CY
672 The above commands automatically enable the minor mode
673@code{text-scale-mode} if the current font scaling is other than 1,
674and disable it otherwise.
956c76ef 675
b8f3a9e3
GM
676@node Font Lock
677@section Font Lock mode
678@cindex Font Lock mode
679@cindex mode, Font Lock
680@cindex syntax highlighting and coloring
681
8cc11660 682 Font Lock mode is a minor mode, always local to a particular buffer,
d366bd53
CY
683which assigns faces to (or @dfn{fontifies}) the text in the buffer.
684Each buffer's major mode tells Font Lock mode which text to fontify;
685for instance, programming language modes fontify syntactically
686relevant constructs like comments, strings, and function names.
b8f3a9e3
GM
687
688@findex font-lock-mode
d366bd53
CY
689 Font Lock mode is enabled by default. To toggle it in the current
690buffer, type @kbd{M-x font-lock-mode}. A positive numeric argument
691unconditionally enables Font Lock mode, and a negative or zero
692argument disables it.
b8f3a9e3
GM
693
694@findex global-font-lock-mode
695@vindex global-font-lock-mode
d366bd53
CY
696 To toggle Font Lock mode in all buffers, type @kbd{M-x
697global-font-lock-mode}. To impose this setting for future Emacs
698sessions, customize the variable @code{global-font-lock-mode}
699(@pxref{Easy Customization}), or add the following line to your init
700file:
b8f3a9e3
GM
701
702@example
c4e8acbc 703(global-font-lock-mode 0)
b8f3a9e3
GM
704@end example
705
d366bd53
CY
706@noindent
707If you have disabled Global Font Lock mode, you can still enable Font
54952612 708Lock for specific major modes by adding the function
6e317956
CY
709@code{font-lock-mode} to the mode hooks (@pxref{Hooks}). For example,
710to enable Font Lock mode for editing C files, you can do this:
c4e8acbc
CY
711
712@example
6e317956 713(add-hook 'c-mode-hook 'font-lock-mode)
c4e8acbc 714@end example
0015d677 715
b8f3a9e3
GM
716 Font Lock mode uses several specifically named faces to do its job,
717including @code{font-lock-string-face}, @code{font-lock-comment-face},
54952612
RS
718and others. The easiest way to find them all is to use @kbd{M-x
719customize-group @key{RET} font-lock-faces @key{RET}}. You can then
720use that customization buffer to customize the appearance of these
721faces. @xref{Face Customization}.
b8f3a9e3 722
b8f3a9e3 723@vindex font-lock-maximum-decoration
d366bd53
CY
724 You can customize the variable @code{font-lock-maximum-decoration}
725to alter the amount of fontification applied by Font Lock mode, for
726major modes that support this feature. The value should be a number
727(with 1 representing a minimal amount of fontification; some modes
728support levels as high as 3); or @code{t}, meaning ``as high as
729possible'' (the default). You can also specify different numbers for
730particular major modes; for example, to use level 1 for C/C++ modes,
731and the default level otherwise, use the value
b8f3a9e3
GM
732
733@example
d366bd53 734'((c-mode . 1) (c++-mode . 1)))
b8f3a9e3
GM
735@end example
736
b8f3a9e3 737@vindex font-lock-beginning-of-syntax-function
e07e854d
EZ
738@cindex incorrect fontification
739@cindex parenthesis in column zero and fontification
740@cindex brace in column zero and fontification
b8f3a9e3
GM
741 Comment and string fontification (or ``syntactic'' fontification)
742relies on analysis of the syntactic structure of the buffer text. For
174862cf
RS
743the sake of speed, some modes, including Lisp mode, rely on a special
744convention: an open-parenthesis or open-brace in the leftmost column
d366bd53
CY
745always defines the beginning of a defun, and is thus always outside
746any string or comment. Therefore, you should avoid placing a an
747open-parenthesis or open-brace in the leftmost column, if it is inside
748a string or comment. @xref{Left Margin Paren}, for details.
b8f3a9e3 749
6bb2ed9b 750@cindex slow display during scrolling
ae742cb5
CY
751 The variable @code{font-lock-beginning-of-syntax-function}, which is
752always buffer-local, specifies how Font Lock mode can find a position
753guaranteed to be outside any comment or string. In modes which use
754the leftmost column parenthesis convention, the default value of the
755variable is @code{beginning-of-defun}---that tells Font Lock mode to
756use the convention. If you set this variable to @code{nil}, Font Lock
757no longer relies on the convention. This avoids incorrect results,
758but the price is that, in some cases, fontification for a changed text
759must rescan buffer text from the beginning of the buffer. This can
760considerably slow down redisplay while scrolling, particularly if you
761are close to the end of a large buffer.
b8f3a9e3
GM
762
763@findex font-lock-add-keywords
d366bd53
CY
764 Font Lock highlighting patterns already exist for most modes, but
765you may want to fontify additional patterns. You can use the function
766@code{font-lock-add-keywords}, to add your own highlighting patterns
767for a particular mode. For example, to highlight @samp{FIXME:} words
768in C comments, use this:
b8f3a9e3
GM
769
770@example
a152877d
SM
771(add-hook 'c-mode-hook
772 (lambda ()
773 (font-lock-add-keywords nil
ae742cb5
CY
774 '(("\\<\\(FIXME\\):" 1
775 font-lock-warning-face t)))))
b8f3a9e3
GM
776@end example
777
4063fff3 778@findex font-lock-remove-keywords
d366bd53
CY
779@noindent
780To remove keywords from the font-lock highlighting patterns, use the
cd77ce13 781function @code{font-lock-remove-keywords}. @xref{Search-based
956c76ef 782Fontification,,, elisp, The Emacs Lisp Reference Manual}.
4063fff3 783
3be9b0ca
EZ
784@cindex just-in-time (JIT) font-lock
785@cindex background syntax highlighting
786 Fontifying large buffers can take a long time. To avoid large
d366bd53
CY
787delays when a file is visited, Emacs initially fontifies only the
788visible portion of a buffer. As you scroll through the buffer, each
789portion that becomes visible is fontified as soon as it is displayed;
790this type of Font Lock is called @dfn{Just-In-Time} (or @dfn{JIT})
791Lock. You can control how JIT Lock behaves, including telling it to
792perform fontification while idle, by customizing variables in the
956c76ef 793customization group @samp{jit-lock}. @xref{Specific Customization}.
3be9b0ca 794
b8f3a9e3 795@node Highlight Interactively
54952612 796@section Interactive Highlighting
b8f3a9e3
GM
797@cindex highlighting by matching
798@cindex interactive highlighting
54952612 799@cindex Highlight Changes mode
b8f3a9e3 800
54952612 801@findex highlight-changes-mode
956c76ef 802Highlight Changes mode is a minor mode that @dfn{highlights} the parts
d366bd53 803of the buffer that were changed most recently, by giving that text a
956c76ef
CY
804different face. To enable or disable Highlight Changes mode, use
805@kbd{M-x highlight-changes-mode}.
b8f3a9e3 806
54952612 807@cindex Hi Lock mode
b8f3a9e3 808@findex hi-lock-mode
956c76ef
CY
809 Hi Lock mode is a minor mode that highlights text that matches
810regular expressions you specify. For example, you can use it to
811highlight all the references to a certain variable in a program source
812file, highlight certain parts in a voluminous output of some program,
813or highlight certain names in an article. To enable or disable Hi
814Lock mode, use the command @kbd{M-x hi-lock-mode}. To enable Hi Lock
815mode for all buffers, use @kbd{M-x global-hi-lock-mode} or place
816@code{(global-hi-lock-mode 1)} in your @file{.emacs} file.
54952612
RS
817
818 Hi Lock mode works like Font Lock mode (@pxref{Font Lock}), except
819that you specify explicitly the regular expressions to highlight. You
820control them with these commands:
b8f3a9e3
GM
821
822@table @kbd
823@item C-x w h @var{regexp} @key{RET} @var{face} @key{RET}
824@kindex C-x w h
825@findex highlight-regexp
cedf175b 826Highlight text that matches @var{regexp} using face @var{face}
54952612
RS
827(@code{highlight-regexp}). The highlighting will remain as long as
828the buffer is loaded. For example, to highlight all occurrences of
829the word ``whim'' using the default face (a yellow background)
830@kbd{C-x w h whim @key{RET} @key{RET}}. Any face can be used for
831highlighting, Hi Lock provides several of its own and these are
29a483ac
JL
832pre-loaded into a list of default values. While being prompted
833for a face use @kbd{M-n} and @kbd{M-p} to cycle through them.
54952612
RS
834
835You can use this command multiple times, specifying various regular
836expressions to highlight in different ways.
b8f3a9e3
GM
837
838@item C-x w r @var{regexp} @key{RET}
839@kindex C-x w r
840@findex unhighlight-regexp
630acdcc 841Unhighlight @var{regexp} (@code{unhighlight-regexp}).
54952612
RS
842
843If you invoke this from the menu, you select the expression to
844unhighlight from a list. If you invoke this from the keyboard, you
845use the minibuffer. It will show the most recently added regular
846expression; use @kbd{M-p} to show the next older expression and
847@kbd{M-n} to select the next newer expression. (You can also type the
848expression by hand, with completion.) When the expression you want to
849unhighlight appears in the minibuffer, press @kbd{@key{RET}} to exit
850the minibuffer and unhighlight it.
b8f3a9e3
GM
851
852@item C-x w l @var{regexp} @key{RET} @var{face} @key{RET}
853@kindex C-x w l
854@findex highlight-lines-matching-regexp
855@cindex lines, highlighting
856@cindex highlighting lines of text
04d0b662 857Highlight entire lines containing a match for @var{regexp}, using face
b8f3a9e3
GM
858@var{face} (@code{highlight-lines-matching-regexp}).
859
860@item C-x w b
861@kindex C-x w b
862@findex hi-lock-write-interactive-patterns
863Insert all the current highlighting regexp/face pairs into the buffer
864at point, with comment delimiters to prevent them from changing your
54952612
RS
865program. (This key binding runs the
866@code{hi-lock-write-interactive-patterns} command.)
b8f3a9e3 867
3173ce7e
RS
868These patterns are extracted from the comments, if appropriate, if you
869invoke @kbd{M-x hi-lock-find-patterns}, or if you visit the file while
870Hi Lock mode is enabled (since that runs @code{hi-lock-find-patterns}).
b8f3a9e3
GM
871
872@item C-x w i
873@kindex C-x w i
874@findex hi-lock-find-patterns
3173ce7e
RS
875Extract regexp/face pairs from comments in the current buffer
876(@code{hi-lock-find-patterns}). Thus, you can enter patterns
877interactively with @code{highlight-regexp}, store them into the file
878with @code{hi-lock-write-interactive-patterns}, edit them (perhaps
cedf175b 879including different faces for different parenthesized parts of the
3173ce7e
RS
880match), and finally use this command (@code{hi-lock-find-patterns}) to
881have Hi Lock highlight the edited patterns.
b8f3a9e3 882
3173ce7e 883@vindex hi-lock-file-patterns-policy
d439bcd8 884The variable @code{hi-lock-file-patterns-policy} controls whether Hi
0419b8d6
GM
885Lock mode should automatically extract and highlight patterns found in a
886file when it is visited. Its value can be @code{nil} (never highlight),
887@code{ask} (query the user), or a function. If it is a function,
888@code{hi-lock-find-patterns} calls it with the patterns as argument; if
889the function returns non-@code{nil}, the patterns are used. The default
890is @code{ask}. Note that patterns are always highlighted if you call
891@code{hi-lock-find-patterns} directly, regardless of the value of this
892variable.
3173ce7e
RS
893
894@vindex hi-lock-exclude-modes
895Also, @code{hi-lock-find-patterns} does nothing if the current major
896mode's symbol is a member of the list @code{hi-lock-exclude-modes}.
b8f3a9e3
GM
897@end table
898
fad78d58
RS
899@node Fringes
900@section Window Fringes
901@cindex fringes
902
939db9ac
CY
903@findex set-fringe-style
904@findex fringe-mode
905 On graphical displays, each Emacs window normally has narrow
956c76ef
CY
906@dfn{fringes} on the left and right edges. The fringes are used to
907display symbols that provide information about the text in the window.
939db9ac
CY
908You can type @kbd{M-x fringe-mode} to disable the fringes, or modify
909their width. This command affects fringes in all frames; to modify
910fringes on the selected frame only, use @kbd{M-x set-fringe-style}.
fad78d58
RS
911
912 The most common use of the fringes is to indicate a continuation
d366bd53
CY
913line (@pxref{Continuation Lines}). When one line of text is split
914into multiple screen lines, the left fringe shows a curving arrow for
915each screen line except the first, indicating that ``this is not the
916real beginning.'' The right fringe shows a curving arrow for each
917screen line except the last, indicating that ``this is not the real
918end.'' If the line's direction is right-to-left (@pxref{Bidirectional
919Editing}), the meanings of the curving arrows in the fringes are
34313041 920swapped.
fad78d58 921
566da2e7 922 The fringes indicate line truncation with short horizontal arrows
fad78d58 923meaning ``there's more text on this line which is scrolled
d366bd53
CY
924horizontally out of view.'' Clicking the mouse on one of the arrows
925scrolls the display horizontally in the direction of the arrow.
926
927 The fringes can also indicate other things, such as buffer
928boundaries (@pxref{Displaying Boundaries}), and where a program you
929are debugging is executing (@pxref{Debuggers}).
fad78d58 930
939db9ac
CY
931@vindex overflow-newline-into-fringe
932 The fringe is also used for drawing the cursor, if the current line
933is exactly as wide as the window and point is at the end of the line.
934To disable this, change the variable
935@code{overflow-newline-into-fringe} to @code{nil}; this causes Emacs
936to continue or truncate lines that are exactly as wide as the window.
fad78d58 937
9d2908a6
RS
938@node Displaying Boundaries
939@section Displaying Boundaries
940
941@vindex indicate-buffer-boundaries
939db9ac 942 On graphical displays, Emacs can indicate the buffer boundaries in
d366bd53
CY
943the fringes. If you enable this feature, the first line and the last
944line are marked with angle images in the fringes. This can be
945combined with up and down arrow images which say whether it is
946possible to scroll the window.
9d2908a6
RS
947
948 The buffer-local variable @code{indicate-buffer-boundaries} controls
949how the buffer boundaries and window scrolling is indicated in the
950fringes. If the value is @code{left} or @code{right}, both angle and
951arrow bitmaps are displayed in the left or right fringe, respectively.
952
953 If value is an alist, each element @code{(@var{indicator} .
954@var{position})} specifies the position of one of the indicators.
955The @var{indicator} must be one of @code{top}, @code{bottom},
956@code{up}, @code{down}, or @code{t} which specifies the default
957position for the indicators not present in the alist.
958The @var{position} is one of @code{left}, @code{right}, or @code{nil}
959which specifies not to show this indicator.
960
961 For example, @code{((top . left) (t . right))} places the top angle
962bitmap in left fringe, the bottom angle bitmap in right fringe, and
963both arrow bitmaps in right fringe. To show just the angle bitmaps in
964the left fringe, but no arrow bitmaps, use @code{((top . left)
965(bottom . left))}.
966
fad78d58
RS
967@node Useless Whitespace
968@section Useless Whitespace
969
970@cindex trailing whitespace
971@cindex whitespace, trailing
972@vindex show-trailing-whitespace
973 It is easy to leave unnecessary spaces at the end of a line, or
974empty lines at the end of a file, without realizing it. In most
975cases, this @dfn{trailing whitespace} has no effect, but there are
956c76ef 976special circumstances where it matters, and it can be a nuisance.
fad78d58 977
956c76ef
CY
978 You can make trailing whitespace at the end of a line visible by
979setting the buffer-local variable @code{show-trailing-whitespace} to
980@code{t}. Then Emacs displays trailing whitespace, using the face
981@code{trailing-whitespace}.
fad78d58
RS
982
983 This feature does not apply when point is at the end of the line
984containing the whitespace. Strictly speaking, that is ``trailing
985whitespace'' nonetheless, but displaying it specially in that case
986looks ugly while you are typing in new text. In this special case,
987the location of point is enough to show you that the spaces are
988present.
989
990@findex delete-trailing-whitespace
d366bd53
CY
991 Type @kbd{M-x delete-trailing-whitespace} to delete all trailing
992whitespace within the buffer. If the region is active, it deletes all
993trailing whitespace in the region instead.
fad78d58 994
23e3383d 995@vindex indicate-empty-lines
877db12e
RS
996@cindex unused lines
997@cindex fringes, and unused line indication
d366bd53
CY
998 On graphical displays, Emacs can indicate unused lines at the end of
999the window with a small image in the left fringe (@pxref{Fringes}).
1000The image appears for window lines that do not correspond to any
1001buffer text. Blank lines at the end of the buffer then stand out
1002because they do not have this image in the fringe. To enable this
1003feature, set the buffer-local variable @code{indicate-empty-lines} to
1004a non-@code{nil} value. You can enable or disable this feature for
1005all new buffers by setting the default value of this variable,
1006e.g.@:@code{(setq-default indicate-empty-lines t)}.
fad78d58 1007
6bf7aab6
DL
1008@node Selective Display
1009@section Selective Display
4946337d 1010@cindex selective display
6bf7aab6
DL
1011@findex set-selective-display
1012@kindex C-x $
1013
956c76ef
CY
1014 Emacs has the ability to hide lines indented more than a given
1015number of columns. You can use this to get an overview of a part of a
1016program.
6bf7aab6 1017
d239287a
LT
1018 To hide lines in the current buffer, type @kbd{C-x $}
1019(@code{set-selective-display}) with a numeric argument @var{n}. Then
1020lines with at least @var{n} columns of indentation disappear from the
1021screen. The only indication of their presence is that three dots
1022(@samp{@dots{}}) appear at the end of each visible line that is
1023followed by one or more hidden ones.
6bf7aab6
DL
1024
1025 The commands @kbd{C-n} and @kbd{C-p} move across the hidden lines as
1026if they were not there.
1027
1028 The hidden lines are still present in the buffer, and most editing
1029commands see them as usual, so you may find point in the middle of the
1030hidden text. When this happens, the cursor appears at the end of the
1031previous line, after the three dots. If point is at the end of the
1032visible line, before the newline that ends it, the cursor appears before
1033the three dots.
1034
1035 To make all lines visible again, type @kbd{C-x $} with no argument.
1036
1037@vindex selective-display-ellipses
1038 If you set the variable @code{selective-display-ellipses} to
1039@code{nil}, the three dots do not appear at the end of a line that
1040precedes hidden lines. Then there is no visible indication of the
1041hidden lines. This variable becomes local automatically when set.
1042
0015d677
RS
1043 See also @ref{Outline Mode} for another way to hide part of
1044the text in a buffer.
1045
6bf7aab6
DL
1046@node Optional Mode Line
1047@section Optional Mode Line Features
1048
b213b767
LK
1049@cindex buffer size display
1050@cindex display of buffer size
1051@findex size-indication-mode
1052 The buffer percentage @var{pos} indicates the percentage of the
1053buffer above the top of the window. You can additionally display the
1054size of the buffer by typing @kbd{M-x size-indication-mode} to turn on
1055Size Indication mode. The size will be displayed immediately
1056following the buffer percentage like this:
1057
1058@example
1059@var{POS} of @var{SIZE}
1060@end example
1061
1062@noindent
1063Here @var{SIZE} is the human readable representation of the number of
1064characters in the buffer, which means that @samp{k} for 10^3, @samp{M}
1065for 10^6, @samp{G} for 10^9, etc., are used to abbreviate.
1066
e598186c
RS
1067@cindex line number display
1068@cindex display of line number
6bf7aab6
DL
1069@findex line-number-mode
1070 The current line number of point appears in the mode line when Line
1071Number mode is enabled. Use the command @kbd{M-x line-number-mode} to
1072turn this mode on and off; normally it is on. The line number appears
b213b767 1073after the buffer percentage @var{pos}, with the letter @samp{L} to
79199dd2
AM
1074indicate what it is.
1075
1076@cindex Column Number mode
1077@cindex mode, Column Number
1078@findex column-number-mode
1079 Similarly, you can display the current column number by turning on
1080Column number mode with @kbd{M-x column-number-mode}. The column
1081number is indicated by the letter @samp{C}. However, when both of
1082these modes are enabled, the line and column numbers are displayed in
1083parentheses, the line number first, rather than with @samp{L} and
1084@samp{C}. For example: @samp{(561,2)}. @xref{Minor Modes}, for more
1085information about minor modes and about how to use these commands.
6bf7aab6 1086
43f971ab
EZ
1087@cindex narrowing, and line number display
1088 If you have narrowed the buffer (@pxref{Narrowing}), the displayed
1089line number is relative to the accessible portion of the buffer.
54952612
RS
1090Thus, it isn't suitable as an argument to @code{goto-line}. (Use
1091@code{what-line} command to see the line number relative to the whole
1092file.)
43f971ab 1093
6bf7aab6
DL
1094@vindex line-number-display-limit
1095 If the buffer is very large (larger than the value of
956c76ef
CY
1096@code{line-number-display-limit}), Emacs won't compute the line
1097number, because that would be too slow; therefore, the line number
1098won't appear on the mode-line. To remove this limit, set
1099@code{line-number-display-limit} to @code{nil}.
43f971ab
EZ
1100
1101@vindex line-number-display-limit-width
1102 Line-number computation can also be slow if the lines in the buffer
956c76ef
CY
1103are too long. For this reason, Emacs doesn't display line numbers if
1104the average width, in characters, of lines near point is larger than
1105the value of @code{line-number-display-limit-width}. The default
1106value is 200 characters.
6bf7aab6 1107
6bf7aab6
DL
1108@findex display-time
1109@cindex time (on mode line)
1110 Emacs can optionally display the time and system load in all mode
4f00b8c1
DL
1111lines. To enable this feature, type @kbd{M-x display-time} or customize
1112the option @code{display-time-mode}. The information added to the mode
bb3865e8 1113line looks like this:
6bf7aab6
DL
1114
1115@example
1116@var{hh}:@var{mm}pm @var{l.ll}
1117@end example
1118
1119@noindent
1120@vindex display-time-24hr-format
1121Here @var{hh} and @var{mm} are the hour and minute, followed always by
4f1948eb
EZ
1122@samp{am} or @samp{pm}. @var{l.ll} is the average number, collected
1123for the last few minutes, of processes in the whole system that were
1124either running or ready to run (i.e.@: were waiting for an available
1125processor). (Some fields may be missing if your operating system
1126cannot support them.) If you prefer time display in 24-hour format,
1127set the variable @code{display-time-24hr-format} to @code{t}.
6bf7aab6
DL
1128
1129@cindex mail (on mode line)
72bd7b7b
DL
1130@vindex display-time-use-mail-icon
1131@vindex display-time-mail-face
fad78d58
RS
1132@vindex display-time-mail-file
1133@vindex display-time-mail-directory
6bf7aab6 1134 The word @samp{Mail} appears after the load level if there is mail
939db9ac
CY
1135for you that you have not read yet. On graphical displays, you can
1136use an icon instead of @samp{Mail} by customizing
1137@code{display-time-use-mail-icon}; this may save some space on the
1138mode line. You can customize @code{display-time-mail-face} to make
1139the mail indicator prominent. Use @code{display-time-mail-file} to
1140specify the mail file to check, or set
1141@code{display-time-mail-directory} to specify the directory to check
1142for incoming mail (any nonempty regular file in the directory is
1143considered as ``newly arrived mail'').
6bf7aab6 1144
956c76ef
CY
1145@cindex mail (on mode line)
1146@findex display-battery-mode
1147@vindex display-battery-mode
1148@vindex battery-mode-line-format
1149 When running Emacs on a laptop computer, you can display the battery
1150charge on the mode-line, by using the command
1151@code{display-battery-mode} or customizing the variable
1152@code{display-battery-mode}. The variable
1153@code{battery-mode-line-format} determines the way the battery charge
1154is displayed; the exact mode-line message depends on the operating
1155system, and it usually shows the current battery charge as a
1156percentage of the total charge.
1157
47d7776c 1158@cindex mode line, 3D appearance
bd3ead08
EZ
1159@cindex attributes of mode line, changing
1160@cindex non-integral number of lines in a window
939db9ac 1161 On graphical displays, the mode line is drawn as a 3D box. If you
d366bd53
CY
1162don't like this effect, you can disable it by customizing the
1163@code{mode-line} face and setting its @code{box} attribute to
1164@code{nil}. @xref{Face Customization}.
bd3ead08 1165
b9e58bf2 1166@cindex non-selected windows, mode line appearance
ac6875fc 1167 By default, the mode line of nonselected windows is displayed in a
1c9f5f23 1168different face, called @code{mode-line-inactive}. Only the selected
ac6875fc
RS
1169window is displayed in the @code{mode-line} face. This helps show
1170which window is selected. When the minibuffer is selected, since
1171it has no mode line, the window from which you activated the minibuffer
1172has its mode line displayed using @code{mode-line}; as a result,
1173ordinary entry to the minibuffer does not change any mode lines.
1174
1175@vindex mode-line-in-non-selected-windows
1176 You can disable use of @code{mode-line-inactive} by setting variable
1c9f5f23
KS
1177@code{mode-line-in-non-selected-windows} to @code{nil}; then all mode
1178lines are displayed in the @code{mode-line} face.
b9e58bf2 1179
589a3f9f
RS
1180@vindex eol-mnemonic-unix
1181@vindex eol-mnemonic-dos
1182@vindex eol-mnemonic-mac
1183@vindex eol-mnemonic-undecided
1184 You can customize the mode line display for each of the end-of-line
1185formats by setting each of the variables @code{eol-mnemonic-unix},
1186@code{eol-mnemonic-dos}, @code{eol-mnemonic-mac}, and
54952612 1187@code{eol-mnemonic-undecided} to the strings you prefer.
589a3f9f 1188
6bf7aab6
DL
1189@node Text Display
1190@section How Text Is Displayed
1191@cindex characters (in text)
d366bd53 1192@cindex printing character
6bf7aab6 1193
d366bd53
CY
1194 Most characters are @dfn{printing characters}: when they appear in a
1195buffer, they are displayed literally on the screen. Printing
1196characters include @acronym{ASCII} numbers, letters, and punctuation
1197characters, as well as many non-@acronym{ASCII} characters.
6bf7aab6 1198
956c76ef 1199@vindex tab-width
d366bd53
CY
1200@cindex control character
1201 The @acronym{ASCII} character set contains non-printing @dfn{control
1202characters}. Two of these are displayed specially: the newline
1203character (Unicode code point @code{U+000A}) is displayed by starting
1204a new line, while the tab character (@code{U+0009}) is displayed as a
1205space that extends to the next tab stop column (normally every 8
1206columns). The number of spaces per tab is controlled by the
1207buffer-local variable @code{tab-width}, which must have an integer
1208value between 1 and 1000, inclusive. Note that how the tab character
1209in the buffer is displayed has nothing to do with the definition of
1210@key{TAB} as a command.
1211
1212 Other @acronym{ASCII} control characters are displayed as a caret
1213(@samp{^}) followed by the non-control version of the character, with
1214the @code{escape-glyph} face. For instance, the @samp{control-A}
1215character, @code{U+0001}, is displayed as @samp{^A}.
54952612
RS
1216
1217@vindex ctl-arrow
d366bd53
CY
1218 The non-@acronym{ASCII}, non-printing characters @code{U+0080}
1219(octal 200) through @code{U+009F} (octal 237) are displayed as octal
1220escape sequences, with the @code{escape-glyph} face. For instance,
1221character code @code{U+0098} (octal 230) is displayed as @samp{\230}.
1222If you change the buffer-local variable @code{ctl-arrow} to
1223@code{nil}, @acronym{ASCII} control characters are also displayed as
1224octal escape sequences instead of caret escape sequences.
6bf7aab6 1225
470a11a3 1226@vindex nobreak-char-display
939db9ac
CY
1227@cindex non-breaking space
1228@cindex non-breaking hyphen
1229@cindex soft hyphen
1230 Some non-@acronym{ASCII} characters have the same appearance as an
1231@acronym{ASCII} space or hyphen (minus) character. Such characters
1232can cause problems if they are entered into a buffer without your
1233realization, e.g. by yanking; for instance, source code compilers
1234typically do not treat non-@acronym{ASCII} spaces as whitespace
1235characters. To deal with this problem, Emacs displays such characters
1236specially: it displays @code{U+00A0} (no-break space) with the
1237@code{nobreak-space} face, and it displays @code{U+00AD} (soft
1238hyphen), @code{U+2010} (hyphen), and @code{U+2011} (non-breaking
1239hyphen) with the @code{escape-glyph} face. To disable this, change
1240the variable @code{nobreak-char-display} to @code{nil}. If you give
1241this variable a non-@code{nil} and non-@code{t} value, Emacs instead
1242displays such characters as a highlighted backslash followed by a
1243space or hyphen.
b5cced4b 1244
54952612
RS
1245 You can customize the way any particular character code is displayed
1246by means of a display table. @xref{Display Tables,, Display Tables,
1247elisp, The Emacs Lisp Reference Manual}.
1248
0eb025fb
EZ
1249@cindex glyphless characters
1250@cindex characters with no font glyphs
d366bd53
CY
1251 On graphical displays, some characters may have no glyphs in any of
1252the fonts available to Emacs. These @dfn{glyphless characters} are
1253normally displayed as boxes containing the hexadecimal character code.
1254You can control the display method by customizing the variable
1255@code{glyphless-char-display-control}. @xref{Glyphless Chars,,
1256Glyphless Character Display, elisp, The Emacs Lisp Reference Manual},
1257for details.
0eb025fb 1258
0015d677
RS
1259@node Cursor Display
1260@section Displaying the Cursor
939db9ac 1261@cindex text cursor
4cb4f3ba 1262
468160b7 1263@vindex visible-cursor
939db9ac
CY
1264 On a text terminal, the cursor's appearance is controlled by the
1265terminal, largely out of the control of Emacs. Some terminals offer
1266two different cursors: a ``visible'' static cursor, and a ``very
1267visible'' blinking cursor. By default, Emacs uses the very visible
1268cursor, and switches to it when you start or resume Emacs. If the
1269variable @code{visible-cursor} is @code{nil} when Emacs starts or
1270resumes, it uses the normal cursor.
1271
1272@cindex cursor face
1273@vindex cursor-type
1274 On a graphical display, many more properties of the text cursor can
1275be altered. To customize its color, change the @code{:background}
1276attribute of the face named @code{cursor} (@pxref{Face
1277Customization}). (The other attributes of this face have no effect;
1278the text shown under the cursor is drawn using the frame's background
1279color.) To change its shape, customize the buffer-local variable
1280@code{cursor-type}; possible values are @code{box} (the default),
1281@code{hollow} (a hollow box), @code{bar} (a vertical bar), @code{(bar
1282. @var{n})} (a vertical bar @var{n} pixels wide), @code{hbar} (a
1283horizontal bar), @code{(hbar . @var{n})} (a horizontal bar @var{n}
1284pixels tall), or @code{nil} (no cursor at all).
468160b7 1285
939db9ac
CY
1286@findex blink-cursor-mode
1287@cindex cursor, blinking
1288@cindex blinking cursor
1289@vindex blink-cursor-alist
1290 To disable cursor blinking, change the variable
1291@code{blink-cursor-mode} to @code{nil} (@pxref{Easy Customization}),
1292or add the line @code{(blink-cursor-mode 0)} to your init file.
1293Alternatively, you can change how the cursor looks when it ``blinks
1294off'' by customizing the list variable @code{blink-cursor-alist}.
1295Each element in the list should have the form @code{(@var{on-type}
1296. @var{off-type})}; this means that if the cursor is displayed as
1297@var{on-type} when it blinks on (where @var{on-type} is one of the
1298cursor types described above), then it is displayed as @var{off-type}
1299when it blinks off.
0015d677
RS
1300
1301@vindex x-stretch-cursor
1302@cindex wide block cursor
939db9ac
CY
1303 Some characters, such as tab characters, are ``extra wide''. When
1304the cursor is positioned over such a character, it is normally drawn
1305with the default character width. You can make the cursor stretch to
1306cover wide characters, by changing the variable
0015d677
RS
1307@code{x-stretch-cursor} to a non-@code{nil} value.
1308
939db9ac
CY
1309@cindex cursor in non-selected windows
1310@vindex cursor-in-non-selected-windows
1311 The cursor normally appears in non-selected windows as a
1312non-blinking hollow box. (For a bar cursor, it instead appears as a
1313thinner bar.) To turn off cursors in non-selected windows, change the
1314variable @code{cursor-in-non-selected-windows} to @code{nil}.
1315
0015d677
RS
1316@findex hl-line-mode
1317@findex global-hl-line-mode
1318@cindex highlight current line
54952612
RS
1319 To make the cursor even more visible, you can use HL Line mode, a
1320minor mode that highlights the line containing point. Use @kbd{M-x
0015d677
RS
1321hl-line-mode} to enable or disable it in the current buffer. @kbd{M-x
1322global-hl-line-mode} enables or disables the same mode globally.
1323
9d2908a6 1324@node Line Truncation
939db9ac 1325@section Line Truncation
0015d677
RS
1326
1327@cindex truncation
1328@cindex line truncation, and fringes
939db9ac
CY
1329 As an alternative to continuation (@pxref{Continuation Lines}),
1330Emacs can display long lines by @dfn{truncation}. This means that all
1331the characters that do not fit in the width of the screen or window do
1332not appear at all. On graphical displays, a small straight arrow in
1333the fringe indicates truncation at either end of the line. On
1334text-only terminals, this is indicated with @samp{$} signs in the
1335leftmost and/or rightmost columns.
0015d677
RS
1336
1337@vindex truncate-lines
1338@findex toggle-truncate-lines
1339 Horizontal scrolling automatically causes line truncation
1340(@pxref{Horizontal Scrolling}). You can explicitly enable line
1341truncation for a particular buffer with the command @kbd{M-x
1342toggle-truncate-lines}. This works by locally changing the variable
1343@code{truncate-lines}. If that variable is non-@code{nil}, long lines
1344are truncated; if it is @code{nil}, they are continued onto multiple
1345screen lines. Setting the variable @code{truncate-lines} in any way
1346makes it local to the current buffer; until that time, the default
939db9ac 1347value, which is normally @code{nil}, is in effect.
6bf7aab6 1348
939db9ac
CY
1349@vindex truncate-partial-width-windows
1350 If a split window becomes too narrow, Emacs may automatically enable
1351line truncation. @xref{Split Window}, for the variable
1352@code{truncate-partial-width-windows} which controls this.
80174a97 1353
458db4b6
CY
1354@node Visual Line Mode
1355@section Visual Line Mode
1356
1357@cindex word wrap
1358 Another alternative to ordinary line continuation is to use
1359@dfn{word wrap}. Here, each long logical line is divided into two or
1360more screen lines, like in ordinary line continuation. However, Emacs
1361attempts to wrap the line at word boundaries near the right window
1362edge. This makes the text easier to read, as wrapping does not occur
1363in the middle of words.
1364
1365@cindex Visual Line mode
1366@findex visual-line-mode
1367@findex global-visual-line-mode
1368 Word wrap is enabled by Visual Line mode, an optional minor mode.
1369To turn on Visual Line mode in the current buffer, type @kbd{M-x
1370visual-line-mode}; repeating this command turns it off. You can also
1371turn on Visual Line mode using the menu bar: in the Options menu,
1372select the @samp{Line Wrapping in this Buffer} submenu, followed by
1373the @samp{Word Wrap (Visual Line Mode)} menu item. While Visual Line
1374mode is enabled, the mode-line shows the string @samp{wrap} in the
1375mode display. The command @kbd{M-x global-visual-line-mode} toggles
1376Visual Line mode in all buffers.
1377
1378@findex beginning-of-visual-line
1379@findex end-of-visual-line
1380@findex next-logical-line
1381@findex previous-logical-line
1382 In Visual Line mode, some editing commands work on screen lines
1383instead of logical lines: @kbd{C-a} (@code{beginning-of-visual-line})
1384moves to the beginning of the screen line, @kbd{C-e}
1385(@code{end-of-visual-line}) moves to the end of the screen line, and
1386@kbd{C-k} (@code{kill-visual-line}) kills text to the end of the
21927cd7
CY
1387screen line.
1388
1389 To move by logical lines, use the commands @kbd{M-x
1390next-logical-line} and @kbd{M-x previous-logical-line}. These move
1391point to the next logical line and the previous logical line
1392respectively, regardless of whether Visual Line mode is enabled. If
1393you use these commands frequently, it may be convenient to assign key
1394bindings to them. @xref{Init Rebinding}.
458db4b6
CY
1395
1396 By default, word-wrapped lines do not display fringe indicators.
1397Visual Line mode is often used to edit files that contain many long
1398logical lines, so having a fringe indicator for each wrapped line
1399would be visually distracting. You can change this by customizing the
1400variable @code{visual-line-fringe-indicators}.
1401
9d2908a6
RS
1402@node Display Custom
1403@section Customization of Display
80174a97 1404
939db9ac
CY
1405 This section describes variables that control miscellaneous aspects
1406of the appearance of the Emacs screen. Beginning users can skip it.
62ea61af 1407
9d2908a6
RS
1408@vindex visible-bell
1409 If the variable @code{visible-bell} is non-@code{nil}, Emacs attempts
1410to make the whole screen blink when it would normally make an audible bell
1411sound. This variable has no effect if your terminal does not have a way
1412to make the screen blink.
80174a97 1413
9d2908a6
RS
1414@vindex echo-keystrokes
1415 The variable @code{echo-keystrokes} controls the echoing of multi-character
1416keys; its value is the number of seconds of pause required to cause echoing
1417to start, or zero, meaning don't echo at all. The value takes effect when
1418there is someting to echo. @xref{Echo Area}.
80174a97 1419
b4a1a8b2 1420@cindex mouse pointer
62095f01 1421@cindex hourglass pointer display
b4a1a8b2 1422@vindex display-hourglass
62095f01 1423@vindex hourglass-delay
b4a1a8b2
CY
1424 On graphical displays, Emacs displays the mouse pointer as an
1425hourglass if Emacs is busy. To disable this feature, set the variable
1426@code{display-hourglass} to @code{nil}. The variable
1427@code{hourglass-delay} determines the number of seconds of ``busy
1428time'' before the hourglass is shown; the default is 1.
1429
1430@vindex make-pointer-invisible
1431 If the mouse pointer lies inside an Emacs frame, Emacs makes it
1432invisible each time you type a character to insert text, to prevent it
1433from obscuring the text. (To be precise, the hiding occurs when you
1434type a ``self-inserting'' character. @xref{Inserting Text}.) Moving
1435the mouse pointer makes it visible again. To disable this feature,
1436set the variable @code{make-pointer-invisible} to @code{nil}.
1437
1438@vindex underline-minimum-offset
1439@vindex x-underline-at-descent-line
1440 On graphical displays, the variable @code{underline-minimum-offset}
1441determines the minimum distance between the baseline and underline, in
1442pixels, for underlined text. By default, the value is 1; increasing
1443it may improve the legibility of underlined text for certain fonts.
1444(However, Emacs will never draw the underline below the current line
1445area.) The variable @code{x-underline-at-descent-line} determines how
1446to draw underlined text. The default is @code{nil}, which means to
1447draw it at the baseline level of the font; if you change it to
1448@code{nil}, Emacs draws the underline at the same height as the font's
1449descent line.
099bfef9 1450
9d2908a6 1451@vindex overline-margin
b4a1a8b2
CY
1452 The variable @code{overline-margin} specifies the vertical position
1453of an overline above the text, including the height of the overline
1454itself, in pixels; the default is 2.
9d2908a6 1455
a66b12be
RS
1456@findex tty-suppress-bold-inverse-default-colors
1457 On some text-only terminals, bold face and inverse video together
1458result in text that is hard to read. Call the function
1459@code{tty-suppress-bold-inverse-default-colors} with a non-@code{nil}
1460argument to suppress the effect of bold-face in this case.