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