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