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