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