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