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