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