Fix last change of @key markup
[emacs.git] / doc / emacs / display.texi
blobb2a4011b4a73a8c4f30e1898996f4d7e6ad58d60
1 @c -*- coding: utf-8 -*-
2 @c This is part of the Emacs manual.
3 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
4 @c Foundation, Inc.
6 @c See file emacs.texi for copying conditions.
7 @node Display
8 @chapter Controlling the Display
10   Since only part of a large buffer fits in the window, Emacs has to
11 show only a part of it.  This chapter describes commands and variables
12 that let you specify which part of the text you want to see, and how
13 the text is displayed.
15 @menu
16 * Scrolling::              Commands to move text up and down in a window.
17 * Recentering::            A scroll command that centers the current line.
18 * Auto Scrolling::         Redisplay scrolls text automatically when needed.
19 * Horizontal Scrolling::   Moving text left and right in a window.
20 * Narrowing::              Restricting display and editing to a portion
21                              of the buffer.
22 * View Mode::              Viewing read-only buffers.
23 * Follow Mode::            Follow mode lets two windows scroll as one.
24 * Faces::                  How to change the display style using faces.
25 * Colors::                 Specifying colors for faces.
26 * Standard Faces::         The main predefined faces.
27 * Text Scale::             Increasing or decreasing text size in a buffer.
28 * Font Lock::              Minor mode for syntactic highlighting using faces.
29 * Highlight Interactively:: Tell Emacs what text to highlight.
30 * Fringes::                Enabling or disabling window fringes.
31 * Displaying Boundaries::  Displaying top and bottom of the buffer.
32 * Useless Whitespace::     Showing possibly spurious trailing whitespace.
33 * Selective Display::      Hiding lines with lots of indentation.
34 * Optional Mode Line::     Optional mode line display features.
35 * Text Display::           How text characters are normally displayed.
36 * Cursor Display::         Features for displaying the cursor.
37 * Line Truncation::        Truncating lines to fit the screen width instead
38                              of continuing them to multiple screen lines.
39 * Visual Line Mode::       Word wrap and screen line-based editing.
40 * Display Custom::         Information on variables for customizing display.
41 @end menu
43 @node Scrolling
44 @section Scrolling
45 @cindex scrolling
47   If a window is too small to display all the text in its buffer, it
48 displays only a portion of it.  @dfn{Scrolling} commands change which
49 portion of the buffer is displayed.
51   Scrolling forward or up advances the portion of the buffer
52 displayed in the window; equivalently, it moves the buffer text
53 upwards relative to the window.  Scrolling backward or down
54 displays an earlier portion of the buffer, and moves the text
55 downwards relative to the window.
57   In Emacs, scrolling up or down refers to the direction that
58 the text moves in the window, @emph{not} the direction that the window
59 moves relative to the text.  This terminology was adopted by Emacs
60 before the modern meaning of ``scrolling up'' and ``scrolling down''
61 became widespread.  Hence, the strange result that @key{PageDown}
62 scrolls up in the Emacs sense.
64   The portion of a buffer displayed in a window always contains point.
65 If you move point past the bottom or top of the window, scrolling
66 occurs automatically to bring it back onscreen (@pxref{Auto
67 Scrolling}).  You can also scroll explicitly with these commands:
69 @table @kbd
70 @item C-v
71 @itemx @key{next}
72 @itemx @key{PageDown}
73 Scroll forward by nearly a full window (@code{scroll-up-command}).
74 @item M-v
75 @itemx @key{prior}
76 @itemx @key{PageUp}
77 Scroll backward (@code{scroll-down-command}).
78 @end table
80 @kindex C-v
81 @kindex M-v
82 @kindex next
83 @kindex prior
84 @kindex PageDown
85 @kindex PageUp
86 @findex scroll-up-command
87 @findex scroll-down-command
88   @kbd{C-v} (@code{scroll-up-command}) scrolls forward by nearly the
89 whole window height.  The effect is to take the two lines at the
90 bottom of the window and put them at the top, followed by lines that
91 were not previously visible.  If point was in the text that scrolled
92 off the top, it ends up on the window's new topmost line.  The
93 @key{next} (or @key{PageDown}) key is equivalent to @kbd{C-v}.
95   @kbd{M-v} (@code{scroll-down-command}) scrolls backward in a similar
96 way.  The @key{prior} (or @key{PageUp}) key is equivalent to
97 @kbd{M-v}.
99 @vindex next-screen-context-lines
100   The number of lines of overlap left by these scroll commands is
101 controlled by the variable @code{next-screen-context-lines}, whose
102 default value is 2.  You can supply the commands with a numeric prefix
103 argument, @var{n}, to scroll by @var{n} lines; Emacs attempts to leave
104 point unchanged, so that the text and point move up or down together.
105 @kbd{C-v} with a negative argument is like @kbd{M-v} and vice versa.
107 @vindex scroll-error-top-bottom
108   By default, these commands signal an error (by beeping or flashing
109 the screen) if no more scrolling is possible, because the window has
110 reached the beginning or end of the buffer.  If you change the
111 variable @code{scroll-error-top-bottom} to @code{t}, the command moves
112 point to the farthest possible position.  If point is already there,
113 the command signals an error.
115 @vindex scroll-preserve-screen-position
116 @cindex @code{scroll-command} property
117   Some users like scroll commands to keep point at the same screen
118 position, so that scrolling back to the same screen conveniently
119 returns point to its original position.  You can enable this behavior
120 via the variable @code{scroll-preserve-screen-position}.  If the value
121 is @code{t}, Emacs adjusts point to keep the cursor at the same screen
122 position whenever a scroll command moves it off-window, rather than
123 moving it to the topmost or bottommost line.  With any other
124 non-@code{nil} value, Emacs adjusts point this way even if the scroll
125 command leaves point in the window.  This variable affects all the
126 scroll commands documented in this section, as well as scrolling with
127 the mouse wheel (@pxref{Mouse Commands}); in general, it affects any
128 command that has a non-@code{nil} @code{scroll-command} property.
129 @xref{Property Lists,,, elisp, The Emacs Lisp Reference Manual}.
131 @vindex fast-but-imprecise-scrolling
132   Sometimes, particularly when you hold down keys such as @kbd{C-v}
133 and @kbd{M-v}, activating keyboard auto-repeat, Emacs fails to keep up
134 with the rapid rate of scrolling requested; the display doesn't update
135 and Emacs can become unresponsive to input for quite a long time.  You
136 can counter this sluggishness by setting the variable
137 @code{fast-but-imprecise-scrolling} to a non-@code{nil} value.  This
138 instructs the scrolling commands not to fontify (@pxref{Font Lock})
139 any unfontified text they scroll over, instead to assume it has the
140 default face.  This can cause Emacs to scroll to somewhat wrong buffer
141 positions when the faces in use are not all the same size, even with
142 single (i.e., without auto-repeat) scrolling operations.
144 @vindex scroll-up
145 @vindex scroll-down
146 @findex scroll-up-line
147 @findex scroll-down-line
148   The commands @kbd{M-x scroll-up} and @kbd{M-x scroll-down} behave
149 similarly to @code{scroll-up-command} and @code{scroll-down-command},
150 except they do not obey @code{scroll-error-top-bottom}.  Prior to
151 Emacs 24, these were the default commands for scrolling up and down.
152 The commands @kbd{M-x scroll-up-line} and @kbd{M-x scroll-down-line}
153 scroll the current window by one line at a time.  If you intend to use
154 any of these commands, you might want to give them key bindings
155 (@pxref{Init Rebinding}).
157 @node Recentering
158 @section Recentering
160 @table @kbd
161 @item C-l
162 Scroll the selected window so the current line is the center-most text
163 line; on subsequent consecutive invocations, make the current line the
164 top line, the bottom line, and so on in cyclic order.  Possibly
165 redisplay the screen too (@code{recenter-top-bottom}).
167 @item M-x recenter
168 Scroll the selected window so the current line is the center-most text
169 line.  Possibly redisplay the screen too.
171 @item C-M-l
172 Scroll heuristically to bring useful information onto the screen
173 (@code{reposition-window}).
174 @end table
176 @kindex C-l
177 @findex recenter-top-bottom
178   The @kbd{C-l} (@code{recenter-top-bottom}) command @dfn{recenters}
179 the selected window, scrolling it so that the current screen line is
180 exactly in the center of the window, or as close to the center as
181 possible.
183   Typing @kbd{C-l} twice in a row (@kbd{C-l C-l}) scrolls the window
184 so that point is on the topmost screen line.  Typing a third @kbd{C-l}
185 scrolls the window so that point is on the bottom-most screen line.
186 Each successive @kbd{C-l} cycles through these three positions.
188 @vindex recenter-positions
189   You can change the cycling order by customizing the list variable
190 @code{recenter-positions}.  Each list element should be the symbol
191 @code{top}, @code{middle}, or @code{bottom}, or a number; an integer
192 means to move the line to the specified screen line, while a
193 floating-point number between 0.0 and 1.0 specifies a percentage of
194 the screen space from the top of the window.  The default,
195 @code{(middle top bottom)}, is the cycling order described above.
196 Furthermore, if you change the variable @code{scroll-margin} to a
197 non-zero value @var{n}, @kbd{C-l} always leaves at least @var{n}
198 screen lines between point and the top or bottom of the window
199 (@pxref{Auto Scrolling}).
201   You can also give @kbd{C-l} a prefix argument.  A plain prefix
202 argument, @kbd{C-u C-l}, simply recenters point.  A positive argument
203 @var{n} puts point @var{n} lines down from the top of the window.  An
204 argument of zero puts point on the topmost line.  A negative argument
205 @var{-n} puts point @var{n} lines from the bottom of the window.  When
206 given an argument, @kbd{C-l} does not clear the screen or cycle
207 through different screen positions.
209 @vindex recenter-redisplay
210   If the variable @code{recenter-redisplay} has a non-@code{nil}
211 value, each invocation of @kbd{C-l} also clears and redisplays the
212 screen; the special value @code{tty} (the default) says to do this on
213 text-terminal frames only.  Redisplaying is useful in case the screen
214 becomes garbled for any reason (@pxref{Screen Garbled}).
216 @findex recenter
217   The more primitive command @kbd{M-x recenter} behaves like
218 @code{recenter-top-bottom}, but does not cycle among screen positions.
220 @kindex C-M-l
221 @findex reposition-window
222   @kbd{C-M-l} (@code{reposition-window}) scrolls the current window
223 heuristically in a way designed to get useful information onto the
224 screen.  For example, in a Lisp file, this command tries to get the
225 entire current defun onto the screen if possible.
227 @node Auto Scrolling
228 @section Automatic Scrolling
230 @cindex automatic scrolling
231   Emacs performs @dfn{automatic scrolling} when point moves out of the
232 visible portion of the text.  Normally, automatic scrolling centers
233 point vertically in the window, but there are several ways to alter
234 this behavior.
236 @vindex scroll-conservatively
237   If you set @code{scroll-conservatively} to a small number @var{n},
238 then moving point just a little off the screen (no more than @var{n}
239 lines) causes Emacs to scroll just enough to bring point back on
240 screen; if doing so fails to make point visible, Emacs scrolls just
241 far enough to center point in the window.  If you set
242 @code{scroll-conservatively} to a large number (larger than 100),
243 automatic scrolling never centers point, no matter how far point
244 moves; Emacs always scrolls text just enough to bring point into view,
245 either at the top or bottom of the window depending on the scroll
246 direction.  By default, @code{scroll-conservatively} is@tie{}0, which
247 means to always center point in the window.
249 @vindex scroll-step
250   Another way to control automatic scrolling is to customize the
251 variable @code{scroll-step}.  Its value determines the number of lines
252 by which to automatically scroll, when point moves off the screen.  If
253 scrolling by that number of lines fails to bring point back into view,
254 point is centered instead.  The default value is zero, which (by
255 default) causes point to always be centered after scrolling.
257 @cindex aggressive scrolling
258 @vindex scroll-up-aggressively
259 @vindex scroll-down-aggressively
260   A third way to control automatic scrolling is to customize the
261 variables @code{scroll-up-aggressively} and
262 @code{scroll-down-aggressively}, which directly specify the vertical
263 position of point after scrolling.  The value of
264 @code{scroll-up-aggressively} should be either @code{nil} (the
265 default), or a floating point number @var{f} between 0 and 1.  The
266 latter means that when point goes below the bottom window edge (i.e.,
267 scrolling forward), Emacs scrolls the window so that point is @var{f}
268 parts of the window height from the bottom window edge.  Thus, larger
269 @var{f} means more aggressive scrolling: more new text is brought into
270 view.  The default value, @code{nil}, is equivalent to 0.5.
272   Likewise, @code{scroll-down-aggressively} is used when point goes
273 above the bottom window edge (i.e., scrolling backward).  The value
274 specifies how far point should be from the top margin of the window
275 after scrolling.  Thus, as with @code{scroll-up-aggressively}, a
276 larger value is more aggressive.
278   Note that the variables @code{scroll-conservatively},
279 @code{scroll-step}, and @code{scroll-up-aggressively} /
280 @code{scroll-down-aggressively} control automatic scrolling in
281 contradictory ways.  Therefore, you should pick no more than one of
282 these methods to customize automatic scrolling.  In case you customize
283 multiple variables, the order of priority is:
284 @code{scroll-conservatively}, then @code{scroll-step}, and finally
285 @code{scroll-up-aggressively} / @code{scroll-down-aggressively}.
287 @vindex scroll-margin
288 @vindex maximum-scroll-margin
289   The variable @code{scroll-margin} restricts how close point can come
290 to the top or bottom of a window (even if aggressive scrolling
291 specifies a fraction @var{f} that is larger than the window portion
292 between the top and the bottom margins).  Its value is a number of
293 screen lines; if point comes within that many lines of the top or
294 bottom of the window, Emacs performs automatic scrolling.  By default,
295 @code{scroll-margin} is 0.  The effective margin size is limited to a
296 quarter of the window height by default, but this limit can be
297 increased up to half (or decreased down to zero) by customizing
298 @code{maximum-scroll-margin}.
300 @node Horizontal Scrolling
301 @section Horizontal Scrolling
302 @cindex horizontal scrolling
304 @vindex auto-hscroll-mode
305   @dfn{Horizontal scrolling} means shifting all the lines sideways
306 within a window, so that some of the text near the left margin is not
307 displayed.  When the text in a window is scrolled horizontally, text
308 lines are truncated rather than continued (@pxref{Line Truncation}).
309 If a window shows truncated lines, Emacs performs automatic horizontal
310 scrolling whenever point moves off the left or right edge of the
311 screen.  By default, all the lines in the window are scrolled
312 horizontally together, but if you set the variable
313 @code{auto-hscroll-mode} to the special value of @code{current-line},
314 only the line showing the cursor will be scrolled.  To disable
315 automatic horizontal scrolling entirely, set the variable
316 @code{auto-hscroll-mode} to @code{nil}.  Note that when the automatic
317 horizontal scrolling is turned off, if point moves off the edge of the
318 screen, the cursor disappears to indicate that.  (On text terminals,
319 the cursor is left at the edge instead.)
321 @vindex hscroll-margin
322   The variable @code{hscroll-margin} controls how close point can get
323 to the window's left and right edges before automatic scrolling
324 occurs.  It is measured in columns.  For example, if the value is 5,
325 then moving point within 5 columns of an edge causes horizontal
326 scrolling away from that edge.
328 @vindex hscroll-step
329   The variable @code{hscroll-step} determines how many columns to
330 scroll the window when point gets too close to the edge.  Zero, the
331 default value, means to center point horizontally within the window.
332 A positive integer value specifies the number of columns to scroll by.
333 A floating-point number specifies the fraction of the window's width
334 to scroll by.
336   You can also perform explicit horizontal scrolling with the
337 following commands:
339 @table @kbd
340 @item C-x <
341 Scroll text in current window to the left (@code{scroll-left}).
342 @item C-x >
343 Scroll to the right (@code{scroll-right}).
344 @end table
346 @kindex C-x <
347 @kindex C-x >
348 @findex scroll-left
349 @findex scroll-right
350   @kbd{C-x <} (@code{scroll-left}) scrolls text in the selected window
351 to the left by the full width of the window, less two columns.  (In
352 other words, the text in the window moves left relative to the
353 window.)  With a numeric argument @var{n}, it scrolls by @var{n}
354 columns.
356   If the text is scrolled to the left, and point moves off the left
357 edge of the window, the cursor will freeze at the left edge of the
358 window, until point moves back to the displayed portion of the text.
359 This is independent of the current setting of
360 @code{auto-hscroll-mode}, which, for text scrolled to the left, only
361 affects the behavior at the right edge of the window.
363   @kbd{C-x >} (@code{scroll-right}) scrolls similarly to the right.
364 The window cannot be scrolled any farther to the right once it is
365 displayed normally, with each line starting at the window's left
366 margin; attempting to do so has no effect.  This means that you don't
367 have to calculate the argument precisely for @w{@kbd{C-x >}}; any
368 sufficiently large argument will restore the normal display.
370   If you use those commands to scroll a window horizontally, that sets
371 a lower bound for automatic horizontal scrolling.  Automatic scrolling
372 will continue to scroll the window, but never farther to the right
373 than the amount you previously set by @code{scroll-left}.  When
374 @code{auto-hscroll-mode} is set to @code{current-line}, all the lines
375 other than the one showing the cursor will be scrolled by that minimal
376 amount.
378 @node Narrowing
379 @section Narrowing
380 @cindex widening
381 @cindex restriction
382 @cindex narrowing
383 @cindex accessible portion
385   @dfn{Narrowing} means focusing in on some portion of the buffer,
386 making the rest temporarily inaccessible.  The portion which you can
387 still get to is called the @dfn{accessible portion}.  Canceling the
388 narrowing, which makes the entire buffer once again accessible, is
389 called @dfn{widening}.  The bounds of narrowing in effect in a buffer
390 are called the buffer's @dfn{restriction}.
392   Narrowing can make it easier to concentrate on a single subroutine or
393 paragraph by eliminating clutter.  It can also be used to limit the
394 range of operation of a replace command or repeating keyboard macro.
396 @table @kbd
397 @item C-x n n
398 Narrow down to between point and mark (@code{narrow-to-region}).
399 @item C-x n w
400 Widen to make the entire buffer accessible again (@code{widen}).
401 @item C-x n p
402 Narrow down to the current page (@code{narrow-to-page}).
403 @item C-x n d
404 Narrow down to the current defun (@code{narrow-to-defun}).
405 @end table
407   When you have narrowed down to a part of the buffer, that part appears
408 to be all there is.  You can't see the rest, you can't move into it
409 (motion commands won't go outside the accessible part), you can't change
410 it in any way.  However, it is not gone, and if you save the file all
411 the inaccessible text will be saved.  The word @samp{Narrow} appears in
412 the mode line whenever narrowing is in effect.
414 @kindex C-x n n
415 @findex narrow-to-region
416   The primary narrowing command is @kbd{C-x n n} (@code{narrow-to-region}).
417 It sets the current buffer's restrictions so that the text in the current
418 region remains accessible, but all text before the region or after the
419 region is inaccessible.  Point and mark do not change.
421 @kindex C-x n p
422 @findex narrow-to-page
423 @kindex C-x n d
424 @findex narrow-to-defun
425   Alternatively, use @kbd{C-x n p} (@code{narrow-to-page}) to narrow
426 down to the current page.  @xref{Pages}, for the definition of a page.
427 @kbd{C-x n d} (@code{narrow-to-defun}) narrows down to the defun
428 containing point (@pxref{Defuns}).
430 @kindex C-x n w
431 @findex widen
432   The way to cancel narrowing is to widen with @kbd{C-x n w}
433 (@code{widen}).  This makes all text in the buffer accessible again.
435   You can get information on what part of the buffer you are narrowed down
436 to using the @kbd{C-x =} command.  @xref{Position Info}.
438   Because narrowing can easily confuse users who do not understand it,
439 @code{narrow-to-region} is normally a disabled command.  Attempting to use
440 this command asks for confirmation and gives you the option of enabling it;
441 if you enable the command, confirmation will no longer be required for
442 it.  @xref{Disabling}.
444 @node View Mode
445 @section View Mode
446 @cindex View mode
447 @cindex mode, View
449 @kindex s @r{(View mode)}
450 @kindex SPC @r{(View mode)}
451 @kindex DEL @r{(View mode)}
452   View mode is a minor mode that lets you scan a buffer by sequential
453 screenfuls.  It provides commands for scrolling through the buffer
454 conveniently but not for changing it.  Apart from the usual Emacs
455 cursor motion commands, you can type @key{SPC} to scroll forward one
456 windowful, @kbd{S-@key{SPC}} or @key{DEL} to scroll backward, and @kbd{s} to
457 start an incremental search.
459 @kindex q @r{(View mode)}
460 @kindex e @r{(View mode)}
461 @findex View-quit
462 @findex View-exit
463   Typing @kbd{q} (@code{View-quit}) disables View mode, and switches
464 back to the buffer and position before View mode was enabled.  Typing
465 @kbd{e} (@code{View-exit}) disables View mode, keeping the current
466 buffer and position.
468 @findex view-buffer
469 @findex view-file
470   @kbd{M-x view-buffer} prompts for an existing Emacs buffer, switches
471 to it, and enables View mode.  @kbd{M-x view-file} prompts for a file
472 and visits it with View mode enabled.
474 @node Follow Mode
475 @section Follow Mode
476 @cindex Follow mode
477 @cindex mode, Follow
478 @findex follow-mode
479 @cindex windows, synchronizing
480 @cindex synchronizing windows
482   @dfn{Follow mode} is a minor mode that makes two windows, both
483 showing the same buffer, scroll as a single tall virtual window.
484 To use Follow mode, go to a frame with just one window, split it into
485 two side-by-side windows using @kbd{C-x 3}, and then type @kbd{M-x
486 follow-mode}.  From then on, you can edit the buffer in either of the
487 two windows, or scroll either one; the other window follows it.
489   In Follow mode, if you move point outside the portion visible in one
490 window and into the portion visible in the other window, that selects
491 the other window---again, treating the two as if they were parts of
492 one large window.
494   To turn off Follow mode, type @kbd{M-x follow-mode} a second time.
496 @node Faces
497 @section Text Faces
498 @cindex faces
500   Emacs can display text in several different styles, called
501 @dfn{faces}.  Each face can specify various @dfn{face attributes},
502 such as the font, height, weight, slant, foreground and background
503 color, and underlining or overlining.  Most major modes assign faces
504 to the text automatically, via Font Lock mode.  @xref{Font Lock}, for
505 more information about how these faces are assigned.
507 @findex list-faces-display
508   To see what faces are currently defined, and what they look like,
509 type @kbd{M-x list-faces-display}.  With a prefix argument, this
510 prompts for a regular expression, and displays only faces with names
511 matching that regular expression (@pxref{Regexps}).
513 @vindex frame-background-mode
514   It's possible for a given face to look different in different
515 frames.  For instance, some text terminals do not support all face
516 attributes, particularly font, height, and width, and some support a
517 limited range of colors.  In addition, most Emacs faces are defined so
518 that their attributes are different on light and dark frame
519 backgrounds, for reasons of legibility.  By default, Emacs
520 automatically chooses which set of face attributes to display on each
521 frame, based on the frame's current background color.  However, you
522 can override this by giving the variable @code{frame-background-mode}
523 a non-@code{nil} value.  A value of @code{dark} makes Emacs treat all
524 frames as if they have a dark background, whereas a value of
525 @code{light} makes it treat all frames as if they have a light
526 background.
528 @cindex background color
529 @cindex default face
530   You can customize a face to alter its attributes, and save those
531 customizations for future Emacs sessions.  @xref{Face Customization},
532 for details.
534   The @code{default} face is the default for displaying text, and all
535 of its attributes are specified.  Its background color is also used as
536 the frame's background color.  @xref{Colors}.
538 @cindex cursor face
539   Another special face is the @code{cursor} face.  On graphical
540 displays, the background color of this face is used to draw the text
541 cursor.  None of the other attributes of this face have any effect;
542 the foreground color for text under the cursor is taken from the
543 background color of the underlying text.  On text terminals, the
544 appearance of the text cursor is determined by the terminal, not by
545 the @code{cursor} face.
547   You can also use X resources to specify attributes of any particular
548 face.  @xref{Resources}.
550   Emacs can display variable-width fonts, but some Emacs commands,
551 particularly indentation commands, do not account for variable
552 character display widths.  Therefore, we recommend not using
553 variable-width fonts for most faces, particularly those assigned by
554 Font Lock mode.
556 @node Colors
557 @section Colors for Faces
558 @cindex color name
559 @cindex RGB triplet
561   Faces can have various foreground and background colors.  When you
562 specify a color for a face---for instance, when customizing the face
563 (@pxref{Face Customization})---you can use either a @dfn{color name}
564 or an @dfn{RGB triplet}.
566 @findex list-colors-display
567 @vindex list-colors-sort
568   A color name is a pre-defined name, such as @samp{dark orange} or
569 @samp{medium sea green}.  To view a list of color names, type @kbd{M-x
570 list-colors-display}.  To control the order in which colors are shown,
571 customize @code{list-colors-sort}.  If you run this command on a
572 graphical display, it shows the full range of color names known to
573 Emacs (these are the standard X11 color names, defined in X's
574 @file{rgb.txt} file).  If you run the command on a text terminal, it
575 shows only a small subset of colors that can be safely displayed on
576 such terminals.  However, Emacs understands X11 color names even on
577 text terminals; if a face is given a color specified by an X11 color
578 name, it is displayed using the closest-matching terminal color.
580   An RGB triplet is a string of the form @samp{#RRGGBB}.  Each of the
581 R, G, and B components is a hexadecimal number specifying the
582 component's relative intensity, one to four digits long (usually two
583 digits are used).  The components must have the same number of digits.
584 For hexadecimal values A to F, either upper or lower case are
585 acceptable.
587   The @kbd{M-x list-colors-display} command also shows the equivalent
588 RGB triplet for each named color.  For instance, @samp{medium sea
589 green} is equivalent to @samp{#3CB371}.
591 @cindex face colors, setting
592 @findex set-face-foreground
593 @findex set-face-background
594   You can change the foreground and background colors of a face with
595 @kbd{M-x set-face-foreground} and @kbd{M-x set-face-background}.
596 These commands prompt in the minibuffer for a face name and a color,
597 with completion, and then set that face to use the specified color.
598 They affect the face colors on all frames, but their effects do not
599 persist for future Emacs sessions, unlike using the customization
600 buffer or X resources.  You can also use frame parameters to set
601 foreground and background colors for a specific frame; @xref{Frame
602 Parameters}.
604 @node Standard Faces
605 @section Standard Faces
606 @cindex standard faces
608   Here are the standard faces for specifying text appearance.  You can
609 apply them to specific text when you want the effects they produce.
611 @table @code
612 @item default
613 This face is used for ordinary text that doesn't specify any face.
614 Its background color is used as the frame's background color.
615 @item bold
616 This face uses a bold variant of the default font.
617 @item italic
618 This face uses an italic variant of the default font.
619 @item bold-italic
620 This face uses a bold italic variant of the default font.
621 @item underline
622 This face underlines text.
623 @item fixed-pitch
624 This face forces use of a fixed-width font.  It's reasonable to
625 customize this face to use a different fixed-width font, if you like,
626 but you should not make it a variable-width font.
627 @item fixed-pitch-serif
628 This face is like @code{fixed-pitch}, except the font has serifs and
629 looks more like traditional typewriting.
630 @cindex variable-pitch face
631 @item variable-pitch
632 This face forces use of a variable-width font.
633 @cindex shadow face
634 @item shadow
635 This face is used for making the text less noticeable than the surrounding
636 ordinary text.  Usually this can be achieved by using shades of gray in
637 contrast with either black or white default foreground color.
638 @end table
640   Here's an incomplete list of faces used to highlight parts of the
641 text temporarily for specific purposes.  (Many other modes define
642 their own faces for this purpose.)
644 @table @code
645 @item highlight
646 This face is used for text highlighting in various contexts, such as
647 when the mouse cursor is moved over a hyperlink.
648 @item isearch
649 This face is used to highlight the current Isearch match
650 (@pxref{Incremental Search}).
651 @item query-replace
652 This face is used to highlight the current Query Replace match
653 (@pxref{Replace}).
654 @item lazy-highlight
655 This face is used to highlight lazy matches for Isearch and Query
656 Replace (matches other than the current one).
657 @item region
658 This face is used for displaying an active region (@pxref{Mark}).
659 When Emacs is built with GTK support, its colors are taken from the
660 current GTK theme.
661 @item secondary-selection
662 This face is used for displaying a secondary X selection (@pxref{Secondary
663 Selection}).
664 @item trailing-whitespace
665 The face for highlighting excess spaces and tabs at the end of a line
666 when @code{show-trailing-whitespace} is non-@code{nil} (@pxref{Useless
667 Whitespace}).
668 @item escape-glyph
669 The face for displaying control characters and escape sequences
670 (@pxref{Text Display}).
671 @item homoglyph
672 The face for displaying lookalike characters, i.e., characters that
673 look like but are not the characters being represented
674 (@pxref{Text Display}).
675 @item nobreak-space
676 The face for displaying no-break space characters (@pxref{Text
677 Display}).
678 @item nobreak-hyphen
679 The face for displaying no-break hyphen characters (@pxref{Text
680 Display}).
681 @end table
683   The following faces control the appearance of parts of the Emacs
684 frame:
686 @table @code
687 @item mode-line
688 @cindex mode-line face
689 @cindex faces for mode lines
690 This face is used for the mode line of the currently selected window,
691 and for menu bars when toolkit menus are not used.  By default, it's
692 drawn with shadows for a raised effect on graphical displays, and
693 drawn as the inverse of the default face on non-windowed terminals.
694 @item mode-line-inactive
695 @cindex mode-line-inactive face
696 Like @code{mode-line}, but used for mode lines of the windows other
697 than the selected one (if @code{mode-line-in-non-selected-windows} is
698 non-@code{nil}).  This face inherits from @code{mode-line}, so changes
699 in that face affect mode lines in all windows.
700 @item mode-line-highlight
701 @cindex mode-line-highlight face
702 Like @code{highlight}, but used for mouse-sensitive portions of text
703 on mode lines.  Such portions of text typically pop up tooltips
704 (@pxref{Tooltips}) when the mouse pointer hovers above them.
705 @item mode-line-buffer-id
706 @cindex mode-line-buffer-id face
707 This face is used for buffer identification parts in the mode line.
708 @item header-line
709 @cindex header-line face
710 Similar to @code{mode-line} for a window's header line, which appears
711 at the top of a window just as the mode line appears at the bottom.
712 Most windows do not have a header line---only some special modes, such
713 Info mode, create one.
714 @item header-line-highlight
715 @cindex header-line-highlight face
716 Similar to @code{highlight} and @code{mode-line-highlight}, but used
717 for mouse-sensitive portions of text on header lines.  This is a
718 separate face because the @code{header-line} face might be customized
719 in a way that does not interact well with @code{highlight}.
720 @item vertical-border
721 @cindex vertical-border face
722 This face is used for the vertical divider between windows on text
723 terminals.
724 @item minibuffer-prompt
725 @cindex @code{minibuffer-prompt} face
726 @vindex minibuffer-prompt-properties
727 This face is used for the prompt strings displayed in the minibuffer.
728 By default, Emacs automatically adds this face to the value of
729 @code{minibuffer-prompt-properties}, which is a list of text
730 properties (@pxref{Text Properties,,, elisp, the Emacs Lisp Reference
731 Manual}) used to display the prompt text.  (This variable takes effect
732 when you enter the minibuffer.)
733 @item fringe
734 @cindex @code{fringe} face
735 The face for the fringes to the left and right of windows on graphic
736 displays.  (The fringes are the narrow portions of the Emacs frame
737 between the text area and the window's right and left borders.)
738 @xref{Fringes}.
739 @item cursor
740 The @code{:background} attribute of this face specifies the color of
741 the text cursor.  @xref{Cursor Display}.
742 @item tooltip
743 This face is used for tooltip text.  By default, if Emacs is built
744 with GTK support, tooltips are drawn via GTK and this face has no
745 effect.  @xref{Tooltips}.
746 @item mouse
747 This face determines the color of the mouse pointer.
748 @end table
750   The following faces likewise control the appearance of parts of the
751 Emacs frame, but only on text terminals, or when Emacs is built on X
752 with no toolkit support.  (For all other cases, the appearance of the
753 respective frame elements is determined by system-wide settings.)
755 @table @code
756 @item scroll-bar
757 This face determines the visual appearance of the scroll bar.
758 @xref{Scroll Bars}.
759 @item tool-bar
760 This face determines the color of tool bar icons.  @xref{Tool Bars}.
761 @item menu
762 @cindex menu bar appearance
763 @cindex @code{menu} face, no effect if customized
764 @cindex customization of @code{menu} face
765 This face determines the colors and font of Emacs's menus.  @xref{Menu
766 Bars}.
767 @item tty-menu-enabled-face
768 @cindex faces for text-mode menus
769 @cindex TTY menu faces
770 This face is used to display enabled menu items on text-mode
771 terminals.
772 @item tty-menu-disabled-face
773 This face is used to display disabled menu items on text-mode
774 terminals.
775 @item tty-menu-selected-face
776 This face is used to display on text-mode terminals the menu item that
777 would be selected if you click a mouse or press @key{RET}.
778 @end table
780 @node Text Scale
781 @section Text Scale
783 @cindex adjust buffer face height
784 @findex text-scale-adjust
785 @kindex C-x C-+
786 @kindex C-x C--
787 @kindex C-x C-=
788 @kindex C-x C-0
789   To increase the height of the default face in the current buffer,
790 type @kbd{C-x C-+} or @kbd{C-x C-=}.  To decrease it, type @kbd{C-x
791 C--}.  To restore the default (global) face height, type @kbd{C-x
792 C-0}.  These keys are all bound to the same command,
793 @code{text-scale-adjust}, which looks at the last key typed to
794 determine which action to take.
796   The final key of these commands may be repeated without the leading
797 @kbd{C-x}.  For instance, @kbd{C-x C-= C-= C-=} increases the face
798 height by three steps.  Each step scales the text height by a factor
799 of 1.2; to change this factor, customize the variable
800 @code{text-scale-mode-step}.  A numeric argument of 0
801 to the @code{text-scale-adjust} command restores the default height,
802 the same as typing @kbd{C-x C-0}.
804 @cindex increase buffer face height
805 @findex text-scale-increase
806 @cindex decrease buffer face height
807 @findex text-scale-decrease
808   The commands @code{text-scale-increase} and
809 @code{text-scale-decrease} increase or decrease the height of the
810 default face, just like @kbd{C-x C-+} and @kbd{C-x C--} respectively.
811 You may find it convenient to bind to these commands, rather than
812 @code{text-scale-adjust}.
814 @cindex set buffer face height
815 @findex text-scale-set
816   The command @code{text-scale-set} scales the height of the default
817 face in the current buffer to an absolute level specified by its
818 prefix argument.
820 @findex text-scale-mode
821   The above commands automatically enable the minor mode
822 @code{text-scale-mode} if the current font scaling is other than 1,
823 and disable it otherwise.
825 @node Font Lock
826 @section Font Lock mode
827 @cindex Font Lock mode
828 @cindex mode, Font Lock
829 @cindex syntax highlighting and coloring
831   Font Lock mode is a minor mode, always local to a particular buffer,
832 which assigns faces to (or @dfn{fontifies}) the text in the buffer.
833 Each buffer's major mode tells Font Lock mode which text to fontify;
834 for instance, programming language modes fontify syntactically
835 relevant constructs like comments, strings, and function names.
837 @findex font-lock-mode
838   Font Lock mode is enabled by default.  To toggle it in the current
839 buffer, type @kbd{M-x font-lock-mode}.  A positive numeric argument
840 unconditionally enables Font Lock mode, and a negative or zero
841 argument disables it.
843 @findex global-font-lock-mode
844 @vindex global-font-lock-mode
845   Type @kbd{M-x global-font-lock-mode} to toggle Font Lock mode in all
846 buffers.  To impose this setting for future Emacs sessions, customize
847 the variable @code{global-font-lock-mode} (@pxref{Easy
848 Customization}), or add the following line to your init file:
850 @example
851 (global-font-lock-mode 0)
852 @end example
854 @noindent
855 If you have disabled Global Font Lock mode, you can still enable Font
856 Lock for specific major modes by adding the function
857 @code{font-lock-mode} to the mode hooks (@pxref{Hooks}).  For example,
858 to enable Font Lock mode for editing C files, you can do this:
860 @example
861 (add-hook 'c-mode-hook 'font-lock-mode)
862 @end example
864   Font Lock mode uses several specifically named faces to do its job,
865 including @code{font-lock-string-face}, @code{font-lock-comment-face},
866 and others.  The easiest way to find them all is to use @kbd{M-x
867 customize-group @key{RET} font-lock-faces @key{RET}}.  You can then
868 use that customization buffer to customize the appearance of these
869 faces.  @xref{Face Customization}.
871 @vindex font-lock-maximum-decoration
872   You can customize the variable @code{font-lock-maximum-decoration}
873 to alter the amount of fontification applied by Font Lock mode, for
874 major modes that support this feature.  The value should be a number
875 (with 1 representing a minimal amount of fontification; some modes
876 support levels as high as 3); or @code{t}, meaning ``as high as
877 possible'' (the default).  To be effective for a given file buffer,
878 the customization of @code{font-lock-maximum-decoration} should be
879 done @emph{before} the file is visited; if you already have the file
880 visited in a buffer when you customize this variable, kill the buffer
881 and visit the file again after the customization.
883 You can also specify different numbers for particular major modes; for
884 example, to use level 1 for C/C++ modes, and the default level
885 otherwise, use the value
887 @example
888 '((c-mode . 1) (c++-mode . 1)))
889 @end example
891 @cindex incorrect fontification
892 @cindex parenthesis in column zero and fontification
893 @cindex brace in column zero and fontification
894   Comment and string fontification (or ``syntactic'' fontification)
895 relies on analysis of the syntactic structure of the buffer text.  For
896 the sake of speed, some modes, including Lisp mode, rely on a special
897 convention: an open-parenthesis or open-brace in the leftmost column
898 always defines the beginning of a defun, and is thus always outside
899 any string or comment.  Therefore, you should avoid placing an
900 open-parenthesis or open-brace in the leftmost column, if it is inside
901 a string or comment.  @xref{Left Margin Paren}, for details.
903 @findex font-lock-add-keywords
904   Font Lock highlighting patterns already exist for most modes, but
905 you may want to fontify additional patterns.  You can use the function
906 @code{font-lock-add-keywords}, to add your own highlighting patterns
907 for a particular mode.  For example, to highlight @samp{FIXME:} words
908 in C comments, use this:
910 @example
911 (add-hook 'c-mode-hook
912           (lambda ()
913            (font-lock-add-keywords nil
914             '(("\\<\\(FIXME\\):" 1
915                font-lock-warning-face t)))))
916 @end example
918 @findex font-lock-remove-keywords
919 @noindent
920 To remove keywords from the font-lock highlighting patterns, use the
921 function @code{font-lock-remove-keywords}.  @xref{Search-based
922 Fontification,,, elisp, The Emacs Lisp Reference Manual}.
924 @cindex just-in-time (JIT) font-lock
925 @cindex background syntax highlighting
926   Fontifying large buffers can take a long time.  To avoid large
927 delays when a file is visited, Emacs initially fontifies only the
928 visible portion of a buffer.  As you scroll through the buffer, each
929 portion that becomes visible is fontified as soon as it is displayed;
930 this type of Font Lock is called @dfn{Just-In-Time} (or @dfn{JIT})
931 Lock.  You can control how JIT Lock behaves, including telling it to
932 perform fontification while idle, by customizing variables in the
933 customization group @samp{jit-lock}.  @xref{Specific Customization}.
935 @node Highlight Interactively
936 @section Interactive Highlighting
937 @cindex highlighting by matching
938 @cindex interactive highlighting
939 @cindex Highlight Changes mode
941 @findex highlight-changes-mode
942 Highlight Changes mode is a minor mode that @dfn{highlights} the parts
943 of the buffer that were changed most recently, by giving that text a
944 different face.  To enable or disable Highlight Changes mode, use
945 @kbd{M-x highlight-changes-mode}.
947 @cindex Hi Lock mode
948 @findex hi-lock-mode
949   Hi Lock mode is a minor mode that highlights text that matches
950 regular expressions you specify.  For example, you can use it to
951 highlight all the references to a certain variable in a program source
952 file, highlight certain parts in a voluminous output of some program,
953 or highlight certain names in an article.  To enable or disable Hi
954 Lock mode, use the command @kbd{M-x hi-lock-mode}.  To enable Hi Lock
955 mode for all buffers, use @kbd{M-x global-hi-lock-mode} or place
956 @code{(global-hi-lock-mode 1)} in your @file{.emacs} file.
958   Hi Lock mode works like Font Lock mode (@pxref{Font Lock}), except
959 that you specify explicitly the regular expressions to highlight.  You
960 can control them with the following commands.  (The key bindings
961 below that begin with @kbd{C-x w} are deprecated in favor of the
962 global @kbd{M-s h} bindings, and will be removed in some future Emacs
963 version.)
965 @table @kbd
966 @item M-s h r @var{regexp} @key{RET} @var{face} @key{RET}
967 @itemx C-x w h @var{regexp} @key{RET} @var{face} @key{RET}
968 @kindex M-s h r
969 @kindex C-x w h
970 @findex highlight-regexp
971 Highlight text that matches @var{regexp} using face @var{face}
972 (@code{highlight-regexp}).  The highlighting will remain as long as
973 the buffer is loaded.  For example, to highlight all occurrences of
974 the word ``whim'' using the default face (a yellow background)
975 @kbd{M-s h r whim @key{RET} @key{RET}}.  Any face can be used for
976 highlighting, Hi Lock provides several of its own and these are
977 pre-loaded into a list of default values.  While being prompted
978 for a face use @kbd{M-n} and @kbd{M-p} to cycle through them.
980 @vindex hi-lock-auto-select-face
981 Setting the option @code{hi-lock-auto-select-face} to a non-@code{nil}
982 value causes this command (and other Hi Lock commands that read faces)
983 to automatically choose the next face from the default list without
984 prompting.
986 You can use this command multiple times, specifying various regular
987 expressions to highlight in different ways.
989 @item M-s h u @var{regexp} @key{RET}
990 @itemx C-x w r @var{regexp} @key{RET}
991 @kindex M-s h u
992 @kindex C-x w r
993 @findex unhighlight-regexp
994 Unhighlight @var{regexp} (@code{unhighlight-regexp}).
996 If you invoke this from the menu, you select the expression to
997 unhighlight from a list.  If you invoke this from the keyboard, you
998 use the minibuffer.  It will show the most recently added regular
999 expression; use @kbd{M-n} to show the next older expression and
1000 @kbd{M-p} to select the next newer expression.  (You can also type the
1001 expression by hand, with completion.)  When the expression you want to
1002 unhighlight appears in the minibuffer, press @kbd{@key{RET}} to exit
1003 the minibuffer and unhighlight it.
1005 @item M-s h l @var{regexp} @key{RET} @var{face} @key{RET}
1006 @itemx C-x w l @var{regexp} @key{RET} @var{face} @key{RET}
1007 @kindex M-s h l
1008 @kindex C-x w l
1009 @findex highlight-lines-matching-regexp
1010 @cindex lines, highlighting
1011 @cindex highlighting lines of text
1012 Highlight entire lines containing a match for @var{regexp}, using face
1013 @var{face} (@code{highlight-lines-matching-regexp}).
1015 @item M-s h p @var{phrase} @key{RET} @var{face} @key{RET}
1016 @itemx C-x w p @var{phrase} @key{RET} @var{face} @key{RET}
1017 @kindex M-s h p
1018 @kindex C-x w p
1019 @findex highlight-phrase
1020 @cindex phrase, highlighting
1021 @cindex highlighting phrase
1022 Highlight matches of @var{phrase}, using face @var{face}
1023 (@code{highlight-phrase}).  @var{phrase} can be any regexp,
1024 but spaces will be replaced by matches to whitespace and
1025 initial lower-case letters will become case insensitive.
1027 @item M-s h .
1028 @itemx C-x w .
1029 @kindex M-s h .
1030 @kindex C-x w .
1031 @findex highlight-symbol-at-point
1032 @cindex symbol, highlighting
1033 @cindex highlighting symbol at point
1034 Highlight the symbol found near point, using the next available face
1035 (@code{highlight-symbol-at-point}).
1037 @item M-s h w
1038 @itemx C-x w b
1039 @kindex M-s h w
1040 @kindex C-x w b
1041 @findex hi-lock-write-interactive-patterns
1042 Insert all the current highlighting regexp/face pairs into the buffer
1043 at point, with comment delimiters to prevent them from changing your
1044 program.  (This key binding runs the
1045 @code{hi-lock-write-interactive-patterns} command.)
1047 These patterns are extracted from the comments, if appropriate, if you
1048 invoke @kbd{M-x hi-lock-find-patterns}, or if you visit the file while
1049 Hi Lock mode is enabled (since that runs @code{hi-lock-find-patterns}).
1051 @item M-s h f
1052 @itemx C-x w i
1053 @kindex M-s h f
1054 @kindex C-x w i
1055 @findex hi-lock-find-patterns
1056 Extract regexp/face pairs from comments in the current buffer
1057 (@code{hi-lock-find-patterns}).  Thus, you can enter patterns
1058 interactively with @code{highlight-regexp}, store them into the file
1059 with @code{hi-lock-write-interactive-patterns}, edit them (perhaps
1060 including different faces for different parenthesized parts of the
1061 match), and finally use this command (@code{hi-lock-find-patterns}) to
1062 have Hi Lock highlight the edited patterns.
1064 @vindex hi-lock-file-patterns-policy
1065 The variable @code{hi-lock-file-patterns-policy} controls whether Hi
1066 Lock mode should automatically extract and highlight patterns found in a
1067 file when it is visited.  Its value can be @code{nil} (never highlight),
1068 @code{ask} (query the user), or a function.  If it is a function,
1069 @code{hi-lock-find-patterns} calls it with the patterns as argument; if
1070 the function returns non-@code{nil}, the patterns are used.  The default
1071 is @code{ask}.  Note that patterns are always highlighted if you call
1072 @code{hi-lock-find-patterns} directly, regardless of the value of this
1073 variable.
1075 @vindex hi-lock-exclude-modes
1076 Also, @code{hi-lock-find-patterns} does nothing if the current major
1077 mode's symbol is a member of the list @code{hi-lock-exclude-modes}.
1078 @end table
1080 @node Fringes
1081 @section Window Fringes
1082 @cindex fringes
1084 @findex set-fringe-style
1085 @findex fringe-mode
1086 @vindex fringe-mode @r{(variable)}
1087   On graphical displays, each Emacs window normally has narrow
1088 @dfn{fringes} on the left and right edges.  The fringes are used to
1089 display symbols that provide information about the text in the window.
1090 You can type @kbd{M-x fringe-mode} to toggle display of the fringes or
1091 to modify their width.  This command affects fringes in all frames; to
1092 modify fringes on the selected frame only, use @kbd{M-x
1093 set-fringe-style}.  You can make your changes to the fringes permanent
1094 by customizing the variable @code{fringe-mode}.
1096   The most common use of the fringes is to indicate a continuation
1097 line (@pxref{Continuation Lines}).  When one line of text is split
1098 into multiple screen lines, the left fringe shows a curving arrow for
1099 each screen line except the first, indicating that this is not the
1100 real beginning.  The right fringe shows a curving arrow for each
1101 screen line except the last, indicating that this is not the real
1102 end.  If the line's direction is right-to-left (@pxref{Bidirectional
1103 Editing}), the meanings of the curving arrows in the fringes are
1104 swapped.
1106   The fringes indicate line truncation (@pxref{Line Truncation}) with
1107 short horizontal arrows meaning there's more text on this line which
1108 is scrolled horizontally out of view.  Clicking the mouse on one of
1109 the arrows scrolls the display horizontally in the direction of the
1110 arrow.
1112   The fringes can also indicate other things, such as buffer
1113 boundaries (@pxref{Displaying Boundaries}), and where a program you
1114 are debugging is executing (@pxref{Debuggers}).
1116 @vindex overflow-newline-into-fringe
1117   The fringe is also used for drawing the cursor, if the current line
1118 is exactly as wide as the window and point is at the end of the line.
1119 To disable this, change the variable
1120 @code{overflow-newline-into-fringe} to @code{nil}; this causes Emacs
1121 to continue or truncate lines that are exactly as wide as the window.
1123   If you customize @code{fringe-mode} to remove the fringes on one or
1124 both sides of the window display, the features that display on the
1125 fringe are not available.  Indicators of line continuation and
1126 truncation are an exception: when fringes are not available, Emacs
1127 uses the leftmost and rightmost character cells to indicate
1128 continuation and truncation with special ASCII characters, see
1129 @ref{Continuation Lines}, and @ref{Line Truncation}.  This reduces the
1130 width available for displaying text on each line, because the
1131 character cells used for truncation and continuation indicators are
1132 reserved for that purpose.  Since buffer text can include
1133 bidirectional text, and thus both left-to-right and right-to-left
1134 paragraphs (@pxref{Bidirectional Editing}), removing only one of the
1135 fringes still reserves two character cells, one on each side of the
1136 window, for truncation and continuation indicators, because these
1137 indicators are displayed on opposite sides of the window in
1138 right-to-left paragraphs.
1140 @node Displaying Boundaries
1141 @section Displaying Boundaries
1143 @vindex indicate-buffer-boundaries
1144   On graphical displays, Emacs can indicate the buffer boundaries in
1145 the fringes.  If you enable this feature, the first line and the last
1146 line are marked with angle images in the fringes.  This can be
1147 combined with up and down arrow images which say whether it is
1148 possible to scroll the window.
1150   The buffer-local variable @code{indicate-buffer-boundaries} controls
1151 how the buffer boundaries and window scrolling is indicated in the
1152 fringes.  If the value is @code{left} or @code{right}, both angle and
1153 arrow bitmaps are displayed in the left or right fringe, respectively.
1155   If value is an alist (@pxref{Association Lists,,, elisp, the Emacs
1156 Lisp Reference Manual}), each element @code{(@var{indicator} .
1157 @var{position})} specifies the position of one of the indicators.  The
1158 @var{indicator} must be one of @code{top}, @code{bottom}, @code{up},
1159 @code{down}, or @code{t} which specifies the default position for the
1160 indicators not present in the alist.  The @var{position} is one of
1161 @code{left}, @code{right}, or @code{nil} which specifies not to show
1162 this indicator.
1164   For example, @code{((top . left) (t . right))} places the top angle
1165 bitmap in left fringe, the bottom angle bitmap in right fringe, and
1166 both arrow bitmaps in right fringe.  To show just the angle bitmaps in
1167 the left fringe, but no arrow bitmaps, use @code{((top .  left)
1168 (bottom . left))}.
1170 @node Useless Whitespace
1171 @section Useless Whitespace
1173 @cindex trailing whitespace
1174 @cindex whitespace, trailing
1175 @vindex show-trailing-whitespace
1176   It is easy to leave unnecessary spaces at the end of a line, or
1177 empty lines at the end of a buffer, without realizing it.  In most
1178 cases, this @dfn{trailing whitespace} has no effect, but sometimes it
1179 can be a nuisance.
1181 @cindex trailing-whitespace face
1182   You can make trailing whitespace at the end of a line visible by
1183 setting the buffer-local variable @code{show-trailing-whitespace} to
1184 @code{t}.  Then Emacs displays trailing whitespace, using the face
1185 @code{trailing-whitespace}.
1187   This feature does not apply when point is at the end of the line
1188 containing the whitespace.  Strictly speaking, that is trailing
1189 whitespace nonetheless, but displaying it specially in that case
1190 looks ugly while you are typing in new text.  In this special case,
1191 the location of point is enough to show you that the spaces are
1192 present.
1194 @findex delete-trailing-whitespace
1195 @vindex delete-trailing-lines
1196   Type @kbd{M-x delete-trailing-whitespace} to delete all trailing
1197 whitespace.  This command deletes all extra spaces at the end of each
1198 line in the buffer, and all empty lines at the end of the buffer; to
1199 ignore the latter, change the variable @code{delete-trailing-lines} to
1200 @code{nil}.  If the region is active, the command instead deletes
1201 extra spaces at the end of each line in the region.
1203 @vindex indicate-empty-lines
1204 @cindex unused lines
1205 @cindex fringes, and unused line indication
1206   On graphical displays, Emacs can indicate unused lines at the end of
1207 the window with a small image in the left fringe (@pxref{Fringes}).
1208 The image appears for screen lines that do not correspond to any
1209 buffer text, so blank lines at the end of the buffer stand out because
1210 they lack this image.  To enable this feature, set the buffer-local
1211 variable @code{indicate-empty-lines} to a non-@code{nil} value.  You
1212 can enable or disable this feature for all new buffers by setting the
1213 default value of this variable, e.g., @code{(setq-default
1214 indicate-empty-lines t)}.
1216 @cindex Whitespace mode
1217 @cindex mode, Whitespace
1218 @findex whitespace-mode
1219 @vindex whitespace-style
1220 @findex whitespace-toggle-options
1221   Whitespace mode is a buffer-local minor mode that lets you
1222 visualize many kinds of whitespace in the buffer, by either
1223 drawing the whitespace characters with a special face or displaying
1224 them as special glyphs.  To toggle this mode, type @kbd{M-x
1225 whitespace-mode}.  The kinds of whitespace visualized are determined
1226 by the list variable @code{whitespace-style}.  Individual elements in
1227 that list can be toggled on or off in the current buffer by typing
1228 @w{@kbd{M-x whitespace-toggle-options}}.  Here is a partial list
1229 of possible elements (see the variable's documentation for the full
1230 list):
1232 @table @code
1233 @item face
1234 Enable all visualizations which use special faces.  This element has a
1235 special meaning: if it is absent from the list, none of the other
1236 visualizations take effect except @code{space-mark}, @code{tab-mark},
1237 and @code{newline-mark}.
1239 @item trailing
1240 Highlight trailing whitespace.
1242 @item tabs
1243 Highlight tab characters.
1245 @item spaces
1246 Highlight space and non-breaking space characters.
1248 @item lines
1249 @vindex whitespace-line-column
1250 Highlight lines longer than 80 columns.  To change the column limit,
1251 customize the variable @code{whitespace-line-column}.
1253 @item newline
1254 Highlight newlines.
1256 @item empty
1257 Highlight empty lines.
1259 @item big-indent
1260 @vindex whitespace-big-indent-regexp
1261 Highlight too-deep indentation.  By default any sequence of at least 4
1262 consecutive TAB characters or 32 consecutive SPC characters is
1263 highlighted.  To change that, customize the regular expression
1264 @code{whitespace-big-indent-regexp}.
1266 @item space-mark
1267 Draw space and non-breaking characters with a special glyph.
1269 @item tab-mark
1270 Draw tab characters with a special glyph.
1272 @item newline-mark
1273 Draw newline characters with a special glyph.
1274 @end table
1276 @findex global-whitespace-toggle-options
1277 @findex global-whitespace-mode
1278 Global Whitespace mode is a global minor mode that lets you visualize
1279 whitespace in all buffers.  To toggle individual features, use
1280 @kbd{M-x global-whitespace-toggle-options}.
1282 @node Selective Display
1283 @section Selective Display
1284 @cindex selective display
1285 @findex set-selective-display
1286 @kindex C-x $
1288   Emacs has the ability to hide lines indented more than a given
1289 number of columns.  You can use this to get an overview of a part of a
1290 program.
1292   To hide lines in the current buffer, type @kbd{C-x $}
1293 (@code{set-selective-display}) with a numeric argument @var{n}.  Then
1294 lines with at least @var{n} columns of indentation disappear from the
1295 screen.  The only indication of their presence is that three dots
1296 (@samp{@dots{}}) appear at the end of each visible line that is
1297 followed by one or more hidden ones.
1299   The commands @kbd{C-n} and @kbd{C-p} move across the hidden lines as
1300 if they were not there.
1302   The hidden lines are still present in the buffer, and most editing
1303 commands see them as usual, so you may find point in the middle of the
1304 hidden text.  When this happens, the cursor appears at the end of the
1305 previous line, after the three dots.  If point is at the end of the
1306 visible line, before the newline that ends it, the cursor appears before
1307 the three dots.
1309   To make all lines visible again, type @kbd{C-x $} with no argument.
1311 @vindex selective-display-ellipses
1312   If you set the variable @code{selective-display-ellipses} to
1313 @code{nil}, the three dots do not appear at the end of a line that
1314 precedes hidden lines.  Then there is no visible indication of the
1315 hidden lines.  This variable becomes local automatically when set.
1317   See also @ref{Outline Mode} for another way to hide part of
1318 the text in a buffer.
1320 @node Optional Mode Line
1321 @section Optional Mode Line Features
1323 @cindex buffer size display
1324 @cindex display of buffer size
1325 @findex size-indication-mode
1326   The buffer percentage @var{pos} indicates the percentage of the
1327 buffer above the top of the window.  You can additionally display the
1328 size of the buffer by typing @kbd{M-x size-indication-mode} to turn on
1329 Size Indication mode.  The size will be displayed immediately
1330 following the buffer percentage like this:
1332 @example
1333 @var{pos} of @var{size}
1334 @end example
1336 @noindent
1337 Here @var{size} is the human readable representation of the number of
1338 characters in the buffer, which means that @samp{k} for 10^3, @samp{M}
1339 for 10^6, @samp{G} for 10^9, etc., are used to abbreviate.
1341 @cindex line number display
1342 @cindex display of current line number
1343 @findex line-number-mode
1344   The current line number of point appears in the mode line when Line
1345 Number mode is enabled.  Use the command @kbd{M-x line-number-mode} to
1346 turn this mode on and off; normally it is on.  The line number appears
1347 after the buffer percentage @var{pos}, with the letter @samp{L} to
1348 indicate what it is.
1350 @cindex Column Number mode
1351 @cindex mode, Column Number
1352 @findex column-number-mode
1353   Similarly, you can display the current column number by turning on
1354 Column Number mode with @kbd{M-x column-number-mode}.  The column
1355 number is indicated by the letter @samp{C}.  However, when both of
1356 these modes are enabled, the line and column numbers are displayed in
1357 parentheses, the line number first, rather than with @samp{L} and
1358 @samp{C}.  For example: @samp{(561,2)}.  @xref{Minor Modes}, for more
1359 information about minor modes and about how to use these commands.
1361 @vindex column-number-indicator-zero-based
1362   In Column Number mode, the displayed column number counts from zero
1363 starting at the left margin of the window.  If you would prefer for
1364 the displayed column number to count from one, you may set
1365 @code{column-number-indicator-zero-based} to @code{nil}.
1367 @cindex narrowing, and line number display
1368   If you have narrowed the buffer (@pxref{Narrowing}), the displayed
1369 line number is relative to the accessible portion of the buffer.
1370 Thus, it isn't suitable as an argument to @code{goto-line}.  (Use
1371 @code{what-line} command to see the line number relative to the whole
1372 file.)
1374 @vindex line-number-display-limit
1375   If the buffer is very large (larger than the value of
1376 @code{line-number-display-limit}), Emacs won't compute the line
1377 number, because that would be too slow; therefore, the line number
1378 won't appear on the mode-line.  To remove this limit, set
1379 @code{line-number-display-limit} to @code{nil}.
1381 @vindex line-number-display-limit-width
1382   Line-number computation can also be slow if the lines in the buffer
1383 are too long.  For this reason, Emacs doesn't display line numbers if
1384 the average width, in characters, of lines near point is larger than
1385 the value of @code{line-number-display-limit-width}.  The default
1386 value is 200 characters.
1388 @findex display-time
1389 @cindex time (on mode line)
1390   Emacs can optionally display the time and system load in all mode
1391 lines.  To enable this feature, type @kbd{M-x display-time} or customize
1392 the option @code{display-time-mode}.  The information added to the mode
1393 line looks like this:
1395 @example
1396 @var{hh}:@var{mm}pm @var{l.ll}
1397 @end example
1399 @noindent
1400 @vindex display-time-24hr-format
1401 Here @var{hh} and @var{mm} are the hour and minute, followed always by
1402 @samp{am} or @samp{pm}.  @var{l.ll} is the average number, collected
1403 for the last few minutes, of processes in the whole system that were
1404 either running or ready to run (i.e., were waiting for an available
1405 processor).  (Some fields may be missing if your operating system
1406 cannot support them.)  If you prefer time display in 24-hour format,
1407 set the variable @code{display-time-24hr-format} to @code{t}.
1409 @cindex mail (on mode line)
1410 @vindex display-time-use-mail-icon
1411 @vindex display-time-mail-face
1412 @vindex display-time-mail-file
1413 @vindex display-time-mail-directory
1414   The word @samp{Mail} appears after the load level if there is mail
1415 for you that you have not read yet.  On graphical displays, you can
1416 use an icon instead of @samp{Mail} by customizing
1417 @code{display-time-use-mail-icon}; this may save some space on the
1418 mode line.  You can customize @code{display-time-mail-face} to make
1419 the mail indicator prominent.  Use @code{display-time-mail-file} to
1420 specify the mail file to check, or set
1421 @code{display-time-mail-directory} to specify the directory to check
1422 for incoming mail (any nonempty regular file in the directory is
1423 considered to be newly arrived mail).
1425 @cindex battery status (on mode line)
1426 @findex display-battery-mode
1427 @vindex display-battery-mode
1428 @vindex battery-mode-line-format
1429   When running Emacs on a laptop computer, you can display the battery
1430 charge on the mode-line, by using the command
1431 @code{display-battery-mode} or customizing the variable
1432 @code{display-battery-mode}.  The variable
1433 @code{battery-mode-line-format} determines the way the battery charge
1434 is displayed; the exact mode-line message depends on the operating
1435 system, and it usually shows the current battery charge as a
1436 percentage of the total charge.
1438 @cindex mode line, 3D appearance
1439 @cindex attributes of mode line, changing
1440 @cindex non-integral number of lines in a window
1441   On graphical displays, the mode line is drawn as a 3D box.  If you
1442 don't like this effect, you can disable it by customizing the
1443 @code{mode-line} face and setting its @code{box} attribute to
1444 @code{nil}.  @xref{Face Customization}.
1446 @cindex non-selected windows, mode line appearance
1447   By default, the mode line of nonselected windows is displayed in a
1448 different face, called @code{mode-line-inactive}.  Only the selected
1449 window is displayed in the @code{mode-line} face.  This helps show
1450 which window is selected.  When the minibuffer is selected, since
1451 it has no mode line, the window from which you activated the minibuffer
1452 has its mode line displayed using @code{mode-line}; as a result,
1453 ordinary entry to the minibuffer does not change any mode lines.
1455 @vindex mode-line-in-non-selected-windows
1456   You can disable use of @code{mode-line-inactive} by setting variable
1457 @code{mode-line-in-non-selected-windows} to @code{nil}; then all mode
1458 lines are displayed in the @code{mode-line} face.
1460 @vindex eol-mnemonic-unix
1461 @vindex eol-mnemonic-dos
1462 @vindex eol-mnemonic-mac
1463 @vindex eol-mnemonic-undecided
1464   You can customize the mode line display for each of the end-of-line
1465 formats by setting each of the variables @code{eol-mnemonic-unix},
1466 @code{eol-mnemonic-dos}, @code{eol-mnemonic-mac}, and
1467 @code{eol-mnemonic-undecided} to the strings you prefer.
1469 @node Text Display
1470 @section How Text Is Displayed
1471 @cindex characters (in text)
1472 @cindex printing character
1474   Most characters are @dfn{printing characters}: when they appear in a
1475 buffer, they are displayed literally on the screen.  Printing
1476 characters include @acronym{ASCII} numbers, letters, and punctuation
1477 characters, as well as many non-@acronym{ASCII} characters.
1479 @vindex tab-width
1480 @cindex control characters on display
1481   The @acronym{ASCII} character set contains non-printing @dfn{control
1482 characters}.  Two of these are displayed specially: the newline
1483 character (Unicode code point @code{U+000A}) is displayed by starting
1484 a new line, while the tab character (@code{U+0009}) is displayed as a
1485 space that extends to the next tab stop column (normally every 8
1486 columns).  The number of spaces per tab is controlled by the
1487 buffer-local variable @code{tab-width}, which must have an integer
1488 value between 1 and 1000, inclusive.  Note that how the tab character
1489 in the buffer is displayed has nothing to do with the definition of
1490 @key{TAB} as a command.
1492   Other @acronym{ASCII} control characters, whose codes are below
1493 @code{U+0020} (octal 40, decimal 32), are displayed as a caret
1494 (@samp{^}) followed by the non-control version of the character, with
1495 the @code{escape-glyph} face.  For instance, the @samp{control-A}
1496 character, @code{U+0001}, is displayed as @samp{^A}.
1498 @cindex octal escapes
1499 @vindex ctl-arrow
1500   The raw bytes with codes @code{U+0080} (octal 200) through
1501 @code{U+009F} (octal 237) are displayed as @dfn{octal escape
1502 sequences}, with the @code{escape-glyph} face.  For instance,
1503 character code @code{U+0098} (octal 230) is displayed as @samp{\230}.
1504 If you change the buffer-local variable @code{ctl-arrow} to
1505 @code{nil}, the @acronym{ASCII} control characters are also displayed
1506 as octal escape sequences instead of caret escape sequences.
1508 @vindex nobreak-char-display
1509 @cindex non-breaking space
1510 @cindex non-breaking hyphen
1511 @cindex soft hyphen
1512 @cindex escape-glyph face
1513 @cindex nobreak-space face
1514   Some non-@acronym{ASCII} characters have the same appearance as an
1515 @acronym{ASCII} space or hyphen (minus) character.  Such characters
1516 can cause problems if they are entered into a buffer without your
1517 realization, e.g., by yanking; for instance, source code compilers
1518 typically do not treat non-@acronym{ASCII} spaces as whitespace
1519 characters.  To deal with this problem, Emacs displays such characters
1520 specially: it displays @code{U+00A0} (no-break space) with the
1521 @code{nobreak-space} face, and it displays @code{U+00AD} (soft
1522 hyphen), @code{U+2010} (hyphen), and @code{U+2011} (non-breaking
1523 hyphen) with the @code{nobreak-hyphen} face.  To disable this, change
1524 the variable @code{nobreak-char-display} to @code{nil}.  If you give
1525 this variable a non-@code{nil} and non-@code{t} value, Emacs instead
1526 displays such characters as a highlighted backslash followed by a
1527 space or hyphen.
1529   You can customize the way any particular character code is displayed
1530 by means of a display table.  @xref{Display Tables,, Display Tables,
1531 elisp, The Emacs Lisp Reference Manual}.
1533 @cindex glyphless characters
1534 @cindex characters with no font glyphs
1535 @cindex glyphless-char face
1536   On graphical displays, some characters may have no glyphs in any of
1537 the fonts available to Emacs.  These @dfn{glyphless characters} are
1538 normally displayed as boxes containing the hexadecimal character code.
1539 Similarly, on text terminals, characters that cannot be displayed
1540 using the terminal encoding (@pxref{Terminal Coding}) are normally
1541 displayed as question signs.  You can control the display method by
1542 customizing the variable @code{glyphless-char-display-control}.  You
1543 can also customize the @code{glyphless-char} face to make these
1544 characters more prominent on display.  @xref{Glyphless Chars,,
1545 Glyphless Character Display, elisp, The Emacs Lisp Reference Manual},
1546 for details.
1548 @cindex curly quotes, and terminal capabilities
1549 @cindex curved quotes, and terminal capabilities
1550 @cindex homoglyph face
1552 Emacs tries to determine if the curved quotes @samp{‘} and @samp{’}
1553 can be displayed on the current display.  By default, if this seems to
1554 be so, then Emacs will translate the @acronym{ASCII} quotes (@samp{`}
1555 and @samp{'}), when they appear in messages and help texts, to these
1556 curved quotes.  You can influence or inhibit this translation by
1557 customizing the user option @code{text-quoting-style} (@pxref{Keys in
1558 Documentation,,, elisp, The Emacs Lisp Reference Manual}).
1560   If the curved quotes @samp{‘}, @samp{’}, @samp{“}, and @samp{”} are
1561 known to look just like @acronym{ASCII} characters, they are shown
1562 with the @code{homoglyph} face.  Curved quotes that are known not to
1563 be displayable are shown as their @acronym{ASCII} approximations
1564 @samp{`}, @samp{'}, and @samp{"} with the @code{homoglyph} face.
1566 @node Cursor Display
1567 @section Displaying the Cursor
1568 @cindex text cursor
1570 @vindex visible-cursor
1571   On a text terminal, the cursor's appearance is controlled by the
1572 terminal, largely out of the control of Emacs.  Some terminals offer
1573 two different cursors: a visible static cursor, and a very
1574 visible blinking cursor.  By default, Emacs uses the very visible
1575 cursor, and switches to it when you start or resume Emacs.  If the
1576 variable @code{visible-cursor} is @code{nil} when Emacs starts or
1577 resumes, it uses the normal cursor.
1579 @vindex cursor-type
1580   On a graphical display, many more properties of the text cursor can
1581 be altered.  To customize its color, change the @code{:background}
1582 attribute of the face named @code{cursor} (@pxref{Face
1583 Customization}).  (The other attributes of this face have no effect;
1584 the text shown under the cursor is drawn using the frame's background
1585 color.)  To change its shape, customize the buffer-local variable
1586 @code{cursor-type}; possible values are @code{box} (the default),
1587 @code{hollow} (a hollow box), @code{bar} (a vertical bar), @code{(bar
1588 . @var{n})} (a vertical bar @var{n} pixels wide), @code{hbar} (a
1589 horizontal bar), @code{(hbar . @var{n})} (a horizontal bar @var{n}
1590 pixels tall), or @code{nil} (no cursor at all).
1592 @findex blink-cursor-mode
1593 @cindex cursor, blinking
1594 @cindex blinking cursor
1595 @vindex blink-cursor-mode
1596 @vindex blink-cursor-blinks
1597 @vindex blink-cursor-alist
1598   By default, the cursor stops blinking after 10 blinks, if Emacs does
1599 not get any input during that time; any input event restarts the
1600 count.  You can customize the variable @code{blink-cursor-blinks} to
1601 control that: its value says how many times to blink without input
1602 before stopping.  Setting that variable to a zero or negative value
1603 will make the cursor blink forever.  To disable cursor blinking
1604 altogether, change the variable @code{blink-cursor-mode} to @code{nil}
1605 (@pxref{Easy Customization}), or add the line
1607 @lisp
1608   (blink-cursor-mode 0)
1609 @end lisp
1611 @noindent
1612 to your init file.  Alternatively, you can change how the cursor
1613 looks when it blinks off by customizing the list variable
1614 @code{blink-cursor-alist}.  Each element in the list should have the
1615 form @code{(@var{on-type} . @var{off-type})}; this means that if the
1616 cursor is displayed as @var{on-type} when it blinks on (where
1617 @var{on-type} is one of the cursor types described above), then it is
1618 displayed as @var{off-type} when it blinks off.
1620 @vindex x-stretch-cursor
1621 @cindex wide block cursor
1622   Some characters, such as tab characters, are extra wide.  When
1623 the cursor is positioned over such a character, it is normally drawn
1624 with the default character width.  You can make the cursor stretch to
1625 cover wide characters, by changing the variable
1626 @code{x-stretch-cursor} to a non-@code{nil} value.
1628 @cindex cursor in non-selected windows
1629 @vindex cursor-in-non-selected-windows
1630   The cursor normally appears in non-selected windows as a
1631 non-blinking hollow box.  (For a bar cursor, it instead appears as a
1632 thinner bar.)  To turn off cursors in non-selected windows, change the
1633 variable @code{cursor-in-non-selected-windows} to @code{nil}.
1635 @findex hl-line-mode
1636 @findex global-hl-line-mode
1637 @cindex highlight current line
1638   To make the cursor even more visible, you can use HL Line mode, a
1639 minor mode that highlights the line containing point.  Use @kbd{M-x
1640 hl-line-mode} to enable or disable it in the current buffer.  @kbd{M-x
1641 global-hl-line-mode} enables or disables the same mode globally.
1643 @node Line Truncation
1644 @section Line Truncation
1646 @cindex truncation
1647 @cindex line truncation
1648   As an alternative to continuation (@pxref{Continuation Lines}),
1649 Emacs can display long lines by @dfn{truncation}.  This means that all
1650 the characters that do not fit in the width of the screen or window do
1651 not appear at all.  On graphical displays, a small straight arrow in
1652 the fringe indicates truncation at either end of the line.  On text
1653 terminals, this is indicated with @samp{$} signs in the leftmost
1654 and/or rightmost columns.
1656 @vindex truncate-lines
1657 @findex toggle-truncate-lines
1658   Horizontal scrolling automatically causes line truncation
1659 (@pxref{Horizontal Scrolling}).  You can explicitly enable line
1660 truncation for a particular buffer with the command @kbd{M-x
1661 toggle-truncate-lines}.  This works by locally changing the variable
1662 @code{truncate-lines}.  If that variable is non-@code{nil}, long lines
1663 are truncated; if it is @code{nil}, they are continued onto multiple
1664 screen lines.  Setting the variable @code{truncate-lines} in any way
1665 makes it local to the current buffer; until that time, the default
1666 value, which is normally @code{nil}, is in effect.
1668   If a split window becomes too narrow, Emacs may automatically enable
1669 line truncation.  @xref{Split Window}, for the variable
1670 @code{truncate-partial-width-windows} which controls this.
1672 @node Visual Line Mode
1673 @section Visual Line Mode
1675 @cindex word wrap
1676   Another alternative to ordinary line continuation is to use
1677 @dfn{word wrap}.  Here, each long logical line is divided into two or
1678 more screen lines, like in ordinary line continuation.  However, Emacs
1679 attempts to wrap the line at word boundaries near the right window
1680 edge.  This makes the text easier to read, as wrapping does not occur
1681 in the middle of words.
1683 @cindex mode, Visual Line
1684 @cindex Visual Line mode
1685 @findex visual-line-mode
1686 @findex global-visual-line-mode
1687   Word wrap is enabled by Visual Line mode, an optional minor mode.
1688 To turn on Visual Line mode in the current buffer, type @kbd{M-x
1689 visual-line-mode}; repeating this command turns it off.  You can also
1690 turn on Visual Line mode using the menu bar: in the Options menu,
1691 select the @samp{Line Wrapping in this Buffer} submenu, followed by
1692 the @samp{Word Wrap (Visual Line Mode)} menu item.  While Visual Line
1693 mode is enabled, the mode-line shows the string @samp{wrap} in the
1694 mode display.  The command @kbd{M-x global-visual-line-mode} toggles
1695 Visual Line mode in all buffers.
1697 @findex beginning-of-visual-line
1698 @findex end-of-visual-line
1699 @findex next-logical-line
1700 @findex previous-logical-line
1701   In Visual Line mode, some editing commands work on screen lines
1702 instead of logical lines: @kbd{C-a} (@code{beginning-of-visual-line})
1703 moves to the beginning of the screen line, @kbd{C-e}
1704 (@code{end-of-visual-line}) moves to the end of the screen line, and
1705 @kbd{C-k} (@code{kill-visual-line}) kills text to the end of the
1706 screen line.
1708   To move by logical lines, use the commands @kbd{M-x
1709 next-logical-line} and @kbd{M-x previous-logical-line}.  These move
1710 point to the next logical line and the previous logical line
1711 respectively, regardless of whether Visual Line mode is enabled.  If
1712 you use these commands frequently, it may be convenient to assign key
1713 bindings to them.  @xref{Init Rebinding}.
1715   By default, word-wrapped lines do not display fringe indicators.
1716 Visual Line mode is often used to edit files that contain many long
1717 logical lines, so having a fringe indicator for each wrapped line
1718 would be visually distracting.  You can change this by customizing the
1719 variable @code{visual-line-fringe-indicators}.
1721 @node Display Custom
1722 @section Customization of Display
1724   This section describes variables that control miscellaneous aspects
1725 of the appearance of the Emacs screen.  Beginning users can skip it.
1727 @vindex display-line-numbers
1728 @cindex number lines in a buffer
1729 @cindex display line numbers
1730   If you want to have Emacs display line numbers for every line in the
1731 buffer, customize the buffer-local variable
1732 @code{display-line-numbers}; it is @code{nil} by default.  This
1733 variable can have several different values to support various modes of
1734 line-number display:
1736 @table @asis
1737 @item @code{t}
1738 Display (an absolute) line number before each non-continuation screen
1739 line that displays buffer text.  If the line is a continuation line,
1740 or if the entire screen line displays a display or an overlay string,
1741 that line will not be numbered.
1743 @item @code{relative}
1744 Display relative line numbers before non-continuation lines which show
1745 buffer text.  The line numbers are relative to the line showing point,
1746 so the numbers grow both up and down as lines become farther from the
1747 current line.
1749 @item @code{visual}
1750 This value causes Emacs to count lines visually: only lines actually
1751 shown on the display will be counted (disregarding any lines in
1752 invisible parts of text), and lines which wrap to consume more than
1753 one screen line will be numbered that many times.  The displayed
1754 numbers are relative, as with @code{relative} value above.  This is
1755 handy in modes that fold text, such as Outline mode (@pxref{Outline
1756 Mode}), and when you need to move by exact number of screen lines.
1758 @item anything else
1759 Any other non-@code{nil} value is treated as @code{t}.
1760 @end table
1762 @findex display-line-numbers-mode
1763 @findex global-display-line-numbers-mode
1764 @vindex display-line-numbers-type
1765 The command @kbd{M-x display-line-numbers-mode} provides a
1766 convenient way to turn on display of line numbers.  This mode has a globalized
1767 variant, @code{global-display-line-numbers-mode}.  The user option
1768 @code{display-line-numbers-type} controls which sub-mode of
1769 line-number display, described above, will these modes activate.
1771 @vindex display-line-numbers-current-absolute
1772 When Emacs displays relative line numbers, you can control the number
1773 displayed before the current line, the line showing point.  By
1774 default, Emacs displays the absolute number of the current line there,
1775 even though all the other line numbers are relative.  If you customize
1776 the variable @code{display-line-numbers-current-absolute} to a
1777 @code{nil} value, the number displayed for the current line will be
1778 zero.  This is handy if you don't care about the number of the current
1779 line, and want to leave more horizontal space for text in large
1780 buffers.
1782 @vindex display-line-numbers-widen
1783 In a narrowed buffer (@pxref{Narrowing}) lines are normally numbered
1784 starting at the beginning of the narrowing.  However, if you customize
1785 the variable @code{display-line-numbers-widen} to a non-@code{nil}
1786 value, line numbers will disregard any narrowing and will start at the
1787 first character of the buffer.
1789 @vindex display-line-numbers-width-start
1790 @vindex display-line-numbers-grow-only
1791 @vindex display-line-numbers-width
1792 In selective display mode (@pxref{Selective Display}), and other modes
1793 that hide many lines from display (such as Outline and Org modes), you
1794 may wish to customize the variables
1795 @code{display-line-numbers-width-start} and
1796 @code{display-line-numbers-grow-only}, or set
1797 @code{display-line-numbers-width} to a large enough value, to avoid
1798 occasional miscalculations of space reserved for the line numbers.
1800 @cindex line-number face
1801 The line numbers are displayed in a special face @code{line-number}.
1802 The current line number is displayed in a different face,
1803 @code{line-number-current-line}, so you can make the current line's
1804 number have a distinct appearance, which will help locating the line
1805 showing point.
1807 @vindex visible-bell
1808   If the variable @code{visible-bell} is non-@code{nil}, Emacs attempts
1809 to make the whole screen blink when it would normally make an audible bell
1810 sound.  This variable has no effect if your terminal does not have a way
1811 to make the screen blink.
1813 @vindex echo-keystrokes
1814   The variable @code{echo-keystrokes} controls the echoing of multi-character
1815 keys; its value is the number of seconds of pause required to cause echoing
1816 to start, or zero, meaning don't echo at all.  The value takes effect when
1817 there is something to echo.  @xref{Echo Area}.
1819 @cindex mouse pointer
1820 @cindex hourglass pointer display
1821 @vindex display-hourglass
1822 @vindex hourglass-delay
1823   On graphical displays, Emacs displays the mouse pointer as an
1824 hourglass if Emacs is busy.  To disable this feature, set the variable
1825 @code{display-hourglass} to @code{nil}.  The variable
1826 @code{hourglass-delay} determines the number of seconds of busy
1827 time before the hourglass is shown; the default is 1.
1829 @vindex make-pointer-invisible
1830   If the mouse pointer lies inside an Emacs frame, Emacs makes it
1831 invisible each time you type a character to insert text, to prevent it
1832 from obscuring the text.  (To be precise, the hiding occurs when you
1833 type a self-inserting character.  @xref{Inserting Text}.)  Moving
1834 the mouse pointer makes it visible again.  To disable this feature,
1835 set the variable @code{make-pointer-invisible} to @code{nil}.
1837 @vindex underline-minimum-offset
1838 @vindex x-underline-at-descent-line
1839   On graphical displays, the variable @code{underline-minimum-offset}
1840 determines the minimum distance between the baseline and underline, in
1841 pixels, for underlined text.  By default, the value is 1; increasing
1842 it may improve the legibility of underlined text for certain fonts.
1843 (However, Emacs will never draw the underline below the current line
1844 area.)  The variable @code{x-underline-at-descent-line} determines how
1845 to draw underlined text.  The default is @code{nil}, which means to
1846 draw it at the baseline level of the font; if you change it to
1847 @code{nil}, Emacs draws the underline at the same height as the font's
1848 descent line.
1850 @vindex overline-margin
1851   The variable @code{overline-margin} specifies the vertical position
1852 of an overline above the text, including the height of the overline
1853 itself, in pixels; the default is 2.
1855 @findex tty-suppress-bold-inverse-default-colors
1856   On some text terminals, bold face and inverse video together result
1857 in text that is hard to read.  Call the function
1858 @code{tty-suppress-bold-inverse-default-colors} with a non-@code{nil}
1859 argument to suppress the effect of bold-face in this case.
1861 @vindex display-raw-bytes-as-hex
1862   Raw bytes are displayed in octal format by default, for example a
1863 byte with a decimal value of 128 is displayed as @code{\200}.  To
1864 change display to the hexadecimal format of @code{\x80}, set the
1865 variable @code{display-raw-bytes-as-hex} to @code{t}.