(ex-unix-type-shell-options): Fix :type.
[emacs.git] / man / frames.texi
blob106243346fdbca07bd462d6e70ad710a4a9a88ac
1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 99, 2000
3 @c   Free Software Foundation, Inc.
4 @c See file emacs.texi for copying conditions.
5 @node Frames, International, Windows, Top
6 @chapter Frames and X Windows
7 @cindex frames
9   When using the X Window System, you can create multiple windows at the
10 X level in a single Emacs session.  Each X window that belongs to Emacs
11 displays a @dfn{frame} which can contain one or several Emacs windows.
12 A frame initially contains a single general-purpose Emacs window which
13 you can subdivide vertically or horizontally into smaller windows.  A
14 frame normally contains its own echo area and minibuffer, but you can
15 make frames that don't have these---they use the echo area and
16 minibuffer of another frame.
18   Editing you do in one frame also affects the other frames.  For
19 instance, if you put text in the kill ring in one frame, you can yank it
20 in another frame.  If you exit Emacs through @kbd{C-x C-c} in one frame,
21 it terminates all the frames.  To delete just one frame, use @kbd{C-x 5
22 0}.
24   To avoid confusion, we reserve the word ``window'' for the
25 subdivisions that Emacs implements, and never use it to refer to a
26 frame.
28   Emacs compiled for MS-DOS emulates some aspects of the window system
29 so that you can use many of the features described in this chapter.
30 @xref{MS-DOS Input}, for more information.
32 @cindex MS Windows
33   Emacs compiled for MS Windows mostly supports the same features as
34 under X.  However, as of version 21.1, images, tool bars, and tooltips
35 are not yet available on MS Windows.
37 Features which rely on text in multiple faces (such as Font Lock mode)
38 will also work on non-windowed terminals that can display more than one
39 face, whether by colors or underlining and emboldening, such as the
40 Linux console.  Emacs determines automatically whether the terminal has
41 such support.
43 @menu
44 * Mouse Commands::      Moving, cutting, and pasting, with the mouse.
45 * Secondary Selection:: Cutting without altering point and mark.
46 * Clipboard::           Using the clipboard for selections.
47 * Mouse References::    Using the mouse to select an item from a list.
48 * Menu Mouse Clicks::   Mouse clicks that bring up menus.
49 * Mode Line Mouse::     Mouse clicks on the mode line.
50 * Speedbar::            How to make and use a speedbar frame.
51 * Creating Frames::     Creating additional Emacs frames with various contents.
52 * Multiple Displays::   How one Emacs job can talk to several displays.
53 * Special Buffer Frames::  You can make certain buffers have their own frames.
54 * Frame Parameters::    Changing the colors and other modes of frames.
55 * Scroll Bars::         How to enable and disable scroll bars; how to use them.
56 * Wheeled Mice::        Using mouse wheels for scrolling.
57 * Menu Bars::           Enabling and disabling the menu bar.
58 * Tool Bars::           Enabling and disabling the tool bar.
59 * Dialog Boxes::        Controlling use of dialog boxes.
60 * Faces::               How to change the display style using faces.
61 * Font Lock::           Minor mode for syntactic highlighting using faces.
62 * Support Modes::       Font Lock support modes make Font Lock faster.
63 * Highlight Changes::   Using colors to show where you changed the buffer.
64 * Highlight Interactively:: Tell Emacs what text to highlight.
65 * Trailing Whitespace:: Showing possibly-spurious trailing whitespace.
66 * Tooltips::            Showing `tooltips', AKA `ballon help' for active text.
67 * Mouse Avoidance::     Moving the mouse pointer out of the way.
68 * Misc X::              Iconifying and deleting frames.
69 * Non-Window Terminals::  Multiple frames on terminals that show only one.
70 * XTerm Mouse::         Using the mouse in an XTerm terminal emulator.
71 @end menu
73 @node Mouse Commands
74 @section Mouse Commands for Editing
75 @cindex mouse buttons (what they do)
77   The mouse commands for selecting and copying a region are mostly
78 compatible with the @code{xterm} program.  You can use the same mouse
79 commands for copying between Emacs and other X client programs.
81 @kindex DELETE
82   If you select a region with any of these mouse commands, and then
83 immediately afterward type the @key{DELETE} function key, it deletes the
84 region that you selected.  The @key{BACKSPACE} function key and the
85 ASCII character @key{DEL} do not do this; if you type any other key
86 in between the mouse command and @key{DELETE}, it does not do this.
88 @findex mouse-set-region
89 @findex mouse-set-point
90 @findex mouse-yank-at-click
91 @findex mouse-save-then-click
92 @kindex Mouse-1
93 @kindex Mouse-2
94 @kindex Mouse-3
95 @table @kbd
96 @item Mouse-1
97 Move point to where you click (@code{mouse-set-point}).
98 This is normally the left button.
100 @item Drag-Mouse-1
101 Set the region to the text you select by dragging, and copy it to the
102 kill ring (@code{mouse-set-region}).  You can specify both ends of the
103 region with this single command.
105 @vindex mouse-scroll-min-lines
106 If you move the mouse off the top or bottom of the window while
107 dragging, the window scrolls at a steady rate until you move the mouse
108 back into the window.  This way, you can select regions that don't fit
109 entirely on the screen.  The number of lines scrolled per step depends
110 on how far away from the window edge the mouse has gone; the variable
111 @code{mouse-scroll-min-lines} specifies a minimum step size.
113 @item Mouse-2
114 Yank the last killed text, where you click (@code{mouse-yank-at-click}).
115 This is normally the middle button.
117 @item Mouse-3
118 This command, @code{mouse-save-then-kill}, has several functions
119 depending on where you click and the status of the region.
121 The most basic case is when you click @kbd{Mouse-1} in one place and
122 then @kbd{Mouse-3} in another.  This selects the text between those two
123 positions as the region.  It also copies the new region to the kill
124 ring, so that you can copy it to someplace else.
126 If you click @kbd{Mouse-1} in the text, scroll with the scroll bar, and
127 then click @kbd{Mouse-3}, it remembers where point was before scrolling
128 (where you put it with @kbd{Mouse-1}), and uses that position as the
129 other end of the region.  This is so that you can select a region that
130 doesn't fit entirely on the screen.
132 More generally, if you do not have a highlighted region, @kbd{Mouse-3}
133 selects the text between point and the click position as the region.  It
134 does this by setting the mark where point was, and moving point to where
135 you click.
137 If you have a highlighted region, or if the region was set just before
138 by dragging button 1, @kbd{Mouse-3} adjusts the nearer end of the region
139 by moving it to where you click.  The adjusted region's text also
140 replaces the old region's text in the kill ring.
142 If you originally specified the region using a double or triple
143 @kbd{Mouse-1}, so that the region is defined to consist of entire words
144 or lines, then adjusting the region with @kbd{Mouse-3} also proceeds by
145 entire words or lines.
147 If you use @kbd{Mouse-3} a second time consecutively, at the same place,
148 that kills the region already selected.
150 @item Double-Mouse-1
151 This key sets the region around the word which you click on.  If you
152 click on a character with ``symbol'' syntax (such as underscore, in C
153 mode), it sets the region around the symbol surrounding that character.
155 If you click on a character with open-parenthesis or close-parenthesis
156 syntax, it sets the region around the parenthetical grouping (sexp)
157 which that character starts or ends.  If you click on a character with
158 string-delimiter syntax (such as a singlequote or doublequote in C), it
159 sets the region around the string constant (using heuristics to figure
160 out whether that character is the beginning or the end of it).
162 @item Double-Drag-Mouse-1
163 This key selects a region made up of the words you drag across.
165 @item Triple-Mouse-1
166 This key sets the region around the line you click on.
168 @item Triple-Drag-Mouse-1
169 This key selects a region made up of the lines you drag across.
170 @end table
172   The simplest way to kill text with the mouse is to press @kbd{Mouse-1}
173 at one end, then press @kbd{Mouse-3} twice at the other end.
174 @xref{Killing}.  To copy the text into the kill ring without deleting it
175 from the buffer, press @kbd{Mouse-3} just once---or just drag across the
176 text with @kbd{Mouse-1}.  Then you can copy it elsewhere by yanking it.
178 @vindex mouse-yank-at-point
179   To yank the killed or copied text somewhere else, move the mouse there
180 and press @kbd{Mouse-2}.  @xref{Yanking}.  However, if
181 @code{mouse-yank-at-point} is non-@code{nil}, @kbd{Mouse-2} yanks at
182 point.  Then it does not matter where you click, or even which of the
183 frame's windows you click on.  The default value is @code{nil}.  This
184 variable also affects yanking the secondary selection.
186 @cindex cutting and X
187 @cindex pasting and X
188 @cindex X cutting and pasting
189   To copy text to another X window, kill it or save it in the kill ring.
190 Under X, this also sets the @dfn{primary selection}.  Then use the
191 ``paste'' or ``yank'' command of the program operating the other window
192 to insert the text from the selection.
194   To copy text from another X window, use the ``cut'' or ``copy'' command
195 of the program operating the other window, to select the text you want.
196 Then yank it in Emacs with @kbd{C-y} or @kbd{Mouse-2}.
198   These cutting and pasting commands also work on MS-Windows.
200 @cindex primary selection
201 @cindex cut buffer
202 @cindex selection, primary
203 @vindex x-cut-buffer-max
204   When Emacs puts text into the kill ring, or rotates text to the front
205 of the kill ring, it sets the @dfn{primary selection} in the X server.
206 This is how other X clients can access the text.  Emacs also stores the
207 text in the cut buffer, but only if the text is short enough
208 (@code{x-cut-buffer-max} specifies the maximum number of characters);
209 putting long strings in the cut buffer can be slow.
211   The commands to yank the first entry in the kill ring actually check
212 first for a primary selection in another program; after that, they check
213 for text in the cut buffer.  If neither of those sources provides text
214 to yank, the kill ring contents are used.
216 @node Secondary Selection
217 @section Secondary Selection
218 @cindex secondary selection
220   The @dfn{secondary selection} is another way of selecting text using
221 X.  It does not use point or the mark, so you can use it to kill text
222 without setting point or the mark.
224 @table @kbd
225 @findex mouse-set-secondary
226 @kindex M-Drag-Mouse-1
227 @item M-Drag-Mouse-1
228 Set the secondary selection, with one end at the place where you press
229 down the button, and the other end at the place where you release it
230 (@code{mouse-set-secondary}).  The highlighting appears and changes as
231 you drag.
233 If you move the mouse off the top or bottom of the window while
234 dragging, the window scrolls at a steady rate until you move the mouse
235 back into the window.  This way, you can mark regions that don't fit
236 entirely on the screen.
238 @findex mouse-start-secondary
239 @kindex M-Mouse-1
240 @item M-Mouse-1
241 Set one endpoint for the @dfn{secondary selection}
242 (@code{mouse-start-secondary}).
244 @findex mouse-secondary-save-then-kill
245 @kindex M-Mouse-3
246 @item M-Mouse-3
247 Make a secondary selection, using the place specified with @kbd{M-Mouse-1}
248 as the other end (@code{mouse-secondary-save-then-kill}).  A second click
249 at the same place kills the secondary selection just made.
251 @findex mouse-yank-secondary
252 @kindex M-Mouse-2
253 @item M-Mouse-2
254 Insert the secondary selection where you click
255 (@code{mouse-yank-secondary}).  This places point at the end of the
256 yanked text.
257 @end table
259 Double or triple clicking of @kbd{M-Mouse-1} operates on words and
260 lines, much like @kbd{Mouse-1}.
262 If @code{mouse-yank-at-point} is non-@code{nil}, @kbd{M-Mouse-2}
263 yanks at point.  Then it does not matter precisely where you click; all
264 that matters is which window you click on.  @xref{Mouse Commands}.
266 @node Clipboard
267 @section Using the Clipboard
268 @cindex X clipboard
269 @cindex clipboard
270 @vindex x-select-enable-clipboard
271 @findex menu-bar-enable-clipboard
272 @cindex OpenWindows
273 @cindex Gnome
275 As well as the primary and secondary selection types, X supports a
276 @dfn{clipboard} selection type which is used by some applications,
277 particularly under OpenWindows and Gnome.
279 The command @kbd{M-x menu-bar-enable-clipboard} makes the @code{Cut},
280 @code{Paste} and @code{Copy} menu items, as well as the keys of the same
281 names, all use the clipboard.
283 You can customize the option @code{x-select-enable-clipboard} to make
284 the Emacs yank functions consult the clipboard before the primary
285 selection, and to make the kill functions to store in the clipboard as
286 well as the primary selection.  Otherwise they do not access the
287 clipboard at all.  Using the clipboard is the default on MS-Windows,
288 unlike most systems.
290 @node Mouse References
291 @section Following References with the Mouse
292 @kindex Mouse-2 @r{(selection)}
294   Some Emacs buffers display lists of various sorts.  These include
295 lists of files, of buffers, of possible completions, of matches for
296 a pattern, and so on.
298   Since yanking text into these buffers is not very useful, most of them
299 define @kbd{Mouse-2} specially, as a command to use or view the item you
300 click on.
302   For example, if you click @kbd{Mouse-2} on a file name in a Dired
303 buffer, you visit that file.  If you click @kbd{Mouse-2} on an error
304 message in the @samp{*Compilation*} buffer, you go to the source code
305 for that error message.  If you click @kbd{Mouse-2} on a completion in
306 the @samp{*Completions*} buffer, you choose that completion.
308   You can usually tell when @kbd{Mouse-2} has this special sort of
309 meaning because the sensitive text highlights when you move the mouse
310 over it.
312 @node Menu Mouse Clicks
313 @section Mouse Clicks for Menus
315   Mouse clicks modified with the @key{CTRL} and @key{SHIFT} keys
316 bring up menus.
318 @table @kbd
319 @item C-Mouse-1
320 @kindex C-Mouse-1
321 @findex msb-mode
322 @cindex MSB minor mode
323 @cindex mode, MSB
324 This menu is for selecting a buffer.
326 The MSB (`mouse select buffer') global minor mode alters this menu to a
327 form some people prefer and which is customizable.  See the Custom group
328 @code{msb}.
330 @item C-Mouse-2
331 @kindex C-Mouse-2
332 This menu is for specifying faces and other text properties
333 for editing formatted text.  @xref{Formatted Text}.
335 @item C-Mouse-3
336 @kindex C-Mouse-3
337 This menu is mode-specific.  For most modes if Menu-bar mode is on, this
338 menu has the same items as all the mode-specific menu-bar menus put
339 together.  Some modes may specify a different menu for this
340 button.@footnote{Some systems use @kbd{Mouse-3} for a mode-specific
341 menu.  We took a survey of users, and found they preferred to keep
342 @kbd{Mouse-3} for selecting and killing regions.  Hence the decision to
343 use @kbd{C-Mouse-3} for this menu.}  If Menu-bar mode is off, this menu
344 contains all the items which would be present in the menu bar---not just
345 the mode-specific ones---so that you can access them without having to
346 display the menu bar.
348 @item S-mouse-1
349 This menu is for specifying the frame's principal font.
350 @end table
352 @node Mode Line Mouse
353 @section Mode Line Mouse Commands
354 @cindex mode line, mouse
355 @cindex mouse on mode line
357   You can use mouse clicks on window mode lines to select and manipulate
358 windows.
360 @table @kbd
361 @item Mouse-1
362 @kindex mode-line mouse-1
363 @kbd{Mouse-1} on a mode line selects the window above.  By dragging
364 @kbd{Mouse-1} on the mode line, you can move it, thus changing the
365 height of the windows above and below.
367 @item Mouse-2
368 @kindex mode-line mouse-2
369 @kbd{Mouse-2} on a mode line expands that window to fill its frame.
371 @item Mouse-3
372 @kindex mode-line mouse-3
373 @kbd{Mouse-3} on a mode line deletes the window above.  If the frame has
374 only one window, it buries the current buffer instead and switches to
375 another buffer.
377 @item C-Mouse-2
378 @kindex mode-line C-mouse-2
379 @kbd{C-Mouse-2} on a mode line splits the window above
380 horizontally, above the place in the mode line where you click.
381 @end table
383 @kindex vertical-scroll-bar mouse-1
384   @kbd{C-Mouse-2} on a scroll bar splits the corresponding window
385 vertically.  @xref{Split Window}.
387 The commands above apply to areas of the mode line which do not have
388 mouse bindings of their own.  Normally some areas, such as those
389 displaying the buffer name and the major mode name, have their own mouse
390 bindings.  Help on these bindings is echoed when the mouse is positioned
391 over them.
393 @node Creating Frames
394 @section Creating Frames
395 @cindex creating frames
397 @kindex C-x 5
398   The prefix key @kbd{C-x 5} is analogous to @kbd{C-x 4}, with parallel
399 subcommands.  The difference is that @kbd{C-x 5} commands create a new
400 frame rather than just a new window in the selected frame (@pxref{Pop
401 Up Window}).  If an existing visible or iconified frame already displays
402 the requested material, these commands use the existing frame, after
403 raising or deiconifying as necessary. 
405   The various @kbd{C-x 5} commands differ in how they find or create the
406 buffer to select:
408 @table @kbd
409 @item C-x 5 1
410 @kindex C-x 5 1
411 @findex delete-other-frames
412 Delete all frames except the selected one (@code{delete-other-frames}).
413 @item C-x 5 2
414 @kindex C-x 5 2
415 @findex make-frame-command
416 Create a new frame (@code{make-frame-command}).
417 @item C-x 5 b @var{bufname} @key{RET}
418 Select buffer @var{bufname} in another frame.  This runs
419 @code{switch-to-buffer-other-frame}.
420 @item C-x 5 f @var{filename} @key{RET}
421 Visit file @var{filename} and select its buffer in another frame.  This
422 runs @code{find-file-other-frame}.  @xref{Visiting}.
423 @item C-x 5 d @var{directory} @key{RET}
424 Select a Dired buffer for directory @var{directory} in another frame.
425 This runs @code{dired-other-frame}.  @xref{Dired}.
426 @item C-x 5 m
427 Start composing a mail message in another frame.  This runs
428 @code{mail-other-frame}.  It is the other-frame variant of @kbd{C-x m}.
429 @xref{Sending Mail}.
430 @item C-x 5 .
431 Find a tag in the current tag table in another frame.  This runs
432 @code{find-tag-other-frame}, the multiple-frame variant of @kbd{M-.}.
433 @xref{Tags}.
434 @item C-x 5 r @var{filename} @key{RET}
435 @kindex C-x 5 r
436 @findex find-file-read-only-other-frame
437 Visit file @var{filename} read-only, and select its buffer in another
438 frame.  This runs @code{find-file-read-only-other-frame}.
439 @xref{Visiting}.
440 @end table
442 @cindex default-frame-alist
443 @cindex initial-frame-alist
444   You can control the appearance of new frames you create by setting the
445 frame parameters in @code{default-frame-alist}.  You can use the
446 variable @code{initial-frame-alist} to specify parameters that affect
447 only the initial frame.  @xref{Initial Parameters,,, elisp, The Emacs
448 Lisp Reference Manual}, for more information.
450 @cindex font (default)
451   The easiest way to specify the principal font for all your Emacs
452 frames is with an X resource (@pxref{Font X}), but you can also do it by
453 modifying @code{default-frame-alist} to specify the @code{font}
454 parameter, as shown here:
456 @example
457 (add-to-list 'default-frame-alist '(font . "10x20"))
458 @end example
460 @node Speedbar
461 @section Making and Using a Speedbar Frame
462 @cindex speedbar
464   An Emacs frame can have a @dfn{speedbar}, which is a vertical window
465 that serves as a scrollable menu of files you could visit and tags
466 within those files.  To create a speedbar, type @kbd{M-x speedbar}; this
467 creates a speedbar window for the selected frame.  From then on, you can
468 click on a file name in the speedbar to visit that file in the
469 corresponding Emacs frame, or click on a tag name to jump to that tag in
470 the Emacs frame.
472   Initially the speedbar lists the immediate contents of the current
473 directory, one file per line.  Each line also has a box, @samp{[+]} or
474 @samp{<+>}, that you can click on with @kbd{Mouse-2} to ``open up'' the
475 contents of that item.  If the line names a directory, opening it adds
476 the contents of that directory to the speedbar display, underneath the
477 directory's own line.  If the line lists an ordinary file, opening it up
478 adds a list of the tags in that file to the speedbar display.  When a
479 file is opened up, the @samp{[+]} changes to @samp{[-]}; you can click
480 on that box to ``close up'' that file (hide its contents).
482   Some major modes, including Rmail mode, Info, and GUD, have
483 specialized ways of putting useful items into the speedbar for you to
484 select.  For example, in Rmail mode, the speedbar shows a list of Rmail
485 files, and lets you move the current message to another Rmail file by
486 clicking on its @samp{<M>} box.
488   A speedbar belongs to one Emacs frame, and always operates on that
489 frame.  If you use multiple frames, you can make a speedbar for some or
490 all of the frames; type @kbd{M-x speedbar} in any given frame to make a
491 speedbar for it.
493 @node Multiple Displays
494 @section Multiple Displays
495 @cindex multiple displays
497   A single Emacs can talk to more than one X display.  Initially, Emacs
498 uses just one display---the one specified with the @env{DISPLAY}
499 environment variable or with the @samp{--display} option (@pxref{Initial
500 Options}).  To connect to another display, use the command
501 @code{make-frame-on-display}:
503 @findex make-frame-on-display
504 @table @kbd
505 @item M-x make-frame-on-display @key{RET} @var{display} @key{RET}
506 Create a new frame on display @var{display}.
507 @end table
509   A single X server can handle more than one screen.  When you open
510 frames on two screens belonging to one server, Emacs knows they share a
511 single keyboard, and it treats all the commands arriving from these
512 screens as a single stream of input.
514   When you open frames on different X servers, Emacs makes a separate
515 input stream for each server.  This way, two users can type
516 simultaneously on the two displays, and Emacs will not garble their
517 input.  Each server also has its own selected frame.  The commands you
518 enter with a particular X server apply to that server's selected frame.
520   Despite these features, people using the same Emacs job from different
521 displays can still interfere with each other if they are not careful.
522 For example, if any one types @kbd{C-x C-c}, that exits the Emacs job
523 for all of them!
525 @node Special Buffer Frames
526 @section Special Buffer Frames
528 @vindex special-display-buffer-names
529   You can make certain chosen buffers, for which Emacs normally creates
530 a second window when you have just one window, appear in special frames
531 of their own.  To do this, set the variable
532 @code{special-display-buffer-names} to a list of buffer names; any
533 buffer whose name is in that list automatically gets a special frame,
534 when an Emacs command wants to display it ``in another window.''
536   For example, if you set the variable this way,
538 @example
539 (setq special-display-buffer-names
540       '("*Completions*" "*grep*" "*tex-shell*"))
541 @end example
543 @noindent
544 then completion lists, @code{grep} output and the @TeX{} mode shell
545 buffer get individual frames of their own.  These frames, and the
546 windows in them, are never automatically split or reused for any other
547 buffers.  They continue to show the buffers they were created for,
548 unless you alter them by hand.  Killing the special buffer deletes its
549 frame automatically.
551 @vindex special-display-regexps
552   More generally, you can set @code{special-display-regexps} to a list
553 of regular expressions; then a buffer gets its own frame if its name
554 matches any of those regular expressions.  (Once again, this applies only
555 to buffers that normally get displayed for you in a separate window.)
557 @vindex special-display-frame-alist
558   The variable @code{special-display-frame-alist} specifies the frame
559 parameters for these frames.  It has a default value, so you don't need
560 to set it.
562   For those who know Lisp, an element of
563 @code{special-display-buffer-names} or @code{special-display-regexps}
564 can also be a list.  Then the first element is the buffer name or
565 regular expression; the rest of the list specifies how to create the
566 frame.  It can be an association list specifying frame parameter values;
567 these values take precedence over parameter values specified in
568 @code{special-display-frame-alist}.  Alternatively, it can have this
569 form:
571 @example
572 (@var{function} @var{args}...)
573 @end example
575 @noindent
576 where @var{function} is a symbol.  Then the frame is constructed by
577 calling @var{function}; its first argument is the buffer, and its
578 remaining arguments are @var{args}.
580    An analogous feature lets you specify buffers which should be
581 displayed in the selected window.  @xref{Force Same Window}.  The
582 same-window feature takes precedence over the special-frame feature;
583 therefore, if you add a buffer name to
584 @code{special-display-buffer-names} and it has no effect, check to see
585 whether that feature is also in use for the same buffer name.
587 @node Frame Parameters
588 @section Setting Frame Parameters
589 @cindex colors
590 @cindex Auto-Raise mode
591 @cindex Auto-Lower mode
593   This section describes commands for altering the display style and
594 window management behavior of the selected frame.
596 @findex set-foreground-color
597 @findex set-background-color
598 @findex set-cursor-color
599 @findex set-mouse-color
600 @findex set-border-color
601 @findex auto-raise-mode
602 @findex auto-lower-mode
603 @table @kbd
604 @item M-x set-foreground-color @key{RET} @var{color} @key{RET}
605 Specify color @var{color} for the foreground of the selected frame.
606 (This also changes the foreground color of the default face.)
608 @item M-x set-background-color @key{RET} @var{color} @key{RET}
609 Specify color @var{color} for the background of the selected frame.
610 (This also changes the background color of the default face.)
612 @item M-x set-cursor-color @key{RET} @var{color} @key{RET}
613 Specify color @var{color} for the cursor of the selected frame.
615 @item M-x set-mouse-color @key{RET} @var{color} @key{RET}
616 Specify color @var{color} for the mouse cursor when it is over the
617 selected frame.
619 @item M-x set-border-color @key{RET} @var{color} @key{RET}
620 Specify color @var{color} for the border of the selected frame.
622 @item M-x list-colors-display
623 Display the defined color names and show what the colors look like.
624 This command is somewhat slow.
626 @item M-x auto-raise-mode
627 Toggle whether or not the selected frame should auto-raise.  Auto-raise
628 means that every time you move the mouse onto the frame, it raises the
629 frame.
631 Note that this auto-raise feature is implemented by Emacs itself.  Some
632 window managers also implement auto-raise.  If you enable auto-raise for
633 Emacs frames in your X window manager, it should work, but it is beyond
634 Emacs's control and therefore @code{auto-raise-mode} has no effect on
637 @item M-x auto-lower-mode
638 Toggle whether or not the selected frame should auto-lower.
639 Auto-lower means that every time you move the mouse off the frame,
640 the frame moves to the bottom of the stack of X windows.
642 The command @code{auto-lower-mode} has no effect on auto-lower
643 implemented by the X window manager.  To control that, you must use
644 the appropriate window manager features.
646 @findex set-frame-font
647 @item M-x set-frame-font @key{RET} @var{font} @key{RET}
648 @cindex font (principal)
649 Specify font @var{font} as the principal font for the selected frame.
650 The principal font controls several face attributes of the
651 @code{default} face (@pxref{Faces}).  For example, if the principal font
652 has a height of 12 pt, all text will be drawn in 12 pt fonts, unless you
653 use another face that specifies a different height.  @xref{Font X}, for
654 ways to list the available fonts on your system.
656 @kindex S-Mouse-1
657 You can also set a frame's principal font through a pop-up menu.
658 Press @kbd{S-Mouse-1} to activate this menu.
659 @end table
661   In Emacs versions that use an X toolkit, the color-setting and
662 font-setting functions don't affect menus and the menu bar, since they
663 are displayed by their own widget classes.  To change the appearance of
664 the menus and menu bar, you must use X resources (@pxref{Resources X}).
665 @xref{Colors X}, regarding colors.  @xref{Font X}, regarding choice of
666 font.
668   For information on frame parameters and customization, see @ref{Frame
669 Parameters,,, elisp, The Emacs Lisp Reference Manual}.
671 @node Scroll Bars
672 @section Scroll Bars
673 @cindex Scroll Bar mode
674 @cindex mode, Scroll Bar
676   When using X, Emacs normally makes a @dfn{scroll bar} at the left of
677 each Emacs window.@footnote{Placing it at the left is usually more
678 useful with overlapping frames with text starting at the left margin.}
679 The scroll bar runs the height of the window, and shows a moving
680 rectangular inner box which represents the portion of the buffer
681 currently displayed.  The entire height of the scroll bar represents the
682 entire length of the buffer.
684   You can use @kbd{Mouse-2} (normally, the middle button) in the scroll
685 bar to move or drag the inner box up and down.  If you move it to the
686 top of the scroll bar, you see the top of the buffer.  If you move it to
687 the bottom of the scroll bar, you see the bottom of the buffer.
689   The left and right buttons in the scroll bar scroll by controlled
690 increments.  @kbd{Mouse-1} (normally, the left button) moves the line at
691 the level where you click up to the top of the window.  @kbd{Mouse-3}
692 (normally, the right button) moves the line at the top of the window
693 down to the level where you click.  By clicking repeatedly in the same
694 place, you can scroll by the same distance over and over.
696   If you are using Emacs's own implementation of scroll bars, as opposed
697 to scroll bars from an X toolkit, you can also click @kbd{C-Mouse-2} in
698 the scroll bar to split a window vertically.  The split occurs on the
699 line where you click.
701 @findex scroll-bar-mode
702 @vindex scroll-bar-mode
703   You can enable or disable Scroll Bar mode with the command @kbd{M-x
704 scroll-bar-mode}.  With no argument, it toggles the use of scroll bars.
705 With an argument, it turns use of scroll bars on if and only if the
706 argument is positive.  This command applies to all frames, including
707 frames yet to be created.  Customize the option @code{scroll-bar-mode}
708 to control the use of scroll bars at startup.  You can use it to specify
709 that they are placed at the right of windows if you prefer that.  You
710 can use the X resource @samp{verticalScrollBars} to control the initial
711 setting of Scroll Bar mode similarly.  @xref{Resources X}.
713 @findex toggle-scroll-bar
714   To enable or disable scroll bars for just the selected frame, use the
715 @kbd{M-x toggle-scroll-bar} command.
717 @node Wheeled Mice
718 @section Scrolling With `Wheeled' Mice
720 @cindex Mouse Wheel mode
721 @findex mouse-wheel-mode
722 @vindex mouse-wheel-mode
723 Some mice have a `wheel' instead of a third button.  You can usually
724 click the wheel to act as @kbd{mouse-2}.  You can also use the wheel
725 to scroll windows instead of using the scroll bar or keyboard
726 commands.  Use @kbd{M-x mouse-wheel-mode} to enable or disable
727 scrolling with the wheel, or customize the option
728 @code{mouse-wheel-mode}.  (Support for the wheel depends on the system
729 generating appropriate events for Emacs.)
731 @vindex mouse-wheel-follow-mouse
732 @vindex mouse-wheel-scroll-amount
733 The variables @code{mouse-wheel-follow-mouse} and
734 @code{mouse-wheel-scroll-amount} determine where and by how much
735 buffers are scrolled.
737 @node Menu Bars
738 @section Menu Bars
739 @cindex Menu Bar mode
740 @cindex mode, Menu Bar
742   You can turn display of menu bars on or off with @kbd{M-x
743 menu-bar-mode} or by customizing the option @code{menu-bar-mode}.
744 With no argument, this command toggles Menu Bar mode, a
745 minor mode.  With an argument, the command turns Menu Bar mode on if the
746 argument is positive, off if the argument is not positive.  You can use
747 the X resource @samp{menuBarLines} to control the initial setting of
748 Menu Bar mode.  @xref{Resources X}.
750 @kindex C-Mouse-3@r{, when menu bar is turned off}
751 Expert users often turn off the menu bar, especially on text-only
752 terminals, where this makes one additional line available for text.  If
753 the menu bar is off, you can still pop up a menu of its contents with
754 @kbd{C-mouse-3} on a display which supports popup menus.  @xref{Menu
755 Mouse Clicks}.
757   @xref{Menu Bar}, for information on how to invoke commands with the
758 menu bar.
760 @node Tool Bars
761 @section Tool Bars
762 @cindex Tool Bar mode
763 @cindex mode, Tool Bar
764 @cindex icons, tool bar
766 You can turn display of tool bars on or off with @kbd{M-x tool-bar-mode}
767 analogously to @code{menu-bar-mode}.  @xref{Menu Bars}.  This will only
768 work in an Emacs with appropriate image support for the available icons
769 on a graphic display.  (In particular, the MS-Windows version doesn't
770 support tool bars as of version 21.1.)  By default, monochrome (PBM or
771 XBM format) icons are used.  XPM format icons, which normally look
772 better, will normally be used if Emacs was built with XPM support.
774 There is a global tool bar with useful items and some modes define their
775 own tool bars to replace it.@footnote{We could provide more if suitable
776 icons are contributed.}  Some items are removed from the global bar in
777 `special' modes not designed for editing text.
779 @node Dialog Boxes
780 @section Using Dialog Boxes
781 @cindex dialog boxes
783 @vindex use-dialog-box
784 Certain operations invoked from menus will use a window system dialog
785 box to get information via the mouse if such dialog boxes are supported.
786 This includes yes/no questions and file selection under Motif/LessTif
787 and MS Windows.  Customize the option @code{use-dialog-box} to suppress
788 the use of dialog boxes.
790 @node Faces
791 @section Using Multiple Typefaces
792 @cindex faces
794   When using Emacs with X, you can set up multiple styles of displaying
795 characters.  The aspects of style that you can control are the type
796 font, the foreground color, the background color, and whether to
797 underline.  Emacs on MS-DOS supports faces partially by letting you
798 control the foreground and background colors of each face
799 (@pxref{MS-DOS}).  On non-windowed terminals faces are supported to the
800 extent the terminal can display them.
802   The way you control display style is by defining named @dfn{faces}.
803 Each face can specify a type font, a foreground color, a background
804 color, and an underline flag; but it does not have to specify all of
805 them.  Then by specifying the face or faces to use for a given part
806 of the text in the buffer, you control how that text appears.
808   The style of display used for a given character in the text is
809 determined by combining several faces.  Any aspect of the display style
810 that isn't specified by overlays or text properties comes from the frame
811 itself.
813   Enriched mode, the mode for editing formatted text, includes several
814 commands and menus for specifying faces.  @xref{Format Faces}, for how
815 to specify the font for text in the buffer.  @xref{Format Colors}, for
816 how to specify the foreground and background color.
818   To alter the appearance of a face, use the customization buffer.
819 @xref{Face Customization}.  You can also use X resources to specify
820 attributes of particular faces (@pxref{Resources X}).
822 @cindex face colors, setting
823 @findex set-face-foreground
824 @findex set-face-background
825   Alternatively, you could change the foreground and background colors
826 of a specific face with @kbd{M-x set-face-foreground} and @kbd{M-x
827 set-face-background}.  These commands prompt in the minibuffer for a
828 face name and a color name, with completion, and then setup that face to
829 use the specified color.
831 @findex list-faces-display
832   To see what faces are currently defined, and what they look like, type
833 @kbd{M-x list-faces-display}.  It's possible for a given face to look
834 different in different frames; this command shows the appearance in the
835 frame in which you type it.  Here's a list of the standardly defined
836 faces:
838 @table @code
839 @item default
840 This face is used for ordinary text that doesn't specify any other face.
841 @item modeline
842 This face is used for mode lines.  By default, it's drawn with shadows
843 for a `raised' effect under X and set up as the inverse of the default
844 face on non-windowed terminals.  @xref{Display Vars}.
845 @item header-line
846 Similar to @code{modeline} for a window's header line.
847 @item highlight
848 This face is used for highlighting portions of text, in various modes.
849 @item region
850 This face is used for displaying a selected region (when Transient Mark
851 mode is enabled---see below).
852 @item secondary-selection
853 This face is used for displaying a secondary selection (@pxref{Secondary
854 Selection}).
855 @item bold
856 This face uses a bold variant of the default font, if it has one.
857 @item italic
858 This face uses an italic variant of the default font, if it has one.
859 @item bold-italic
860 This face uses a bold italic variant of the default font, if it has one.
861 @item underline
862 This face underlines text.
863 @item fixed-pitch
864 The basic fixed-pitch face.
865 @item fringe
866 The face for the fringes to the left and right of windows under X.
867 @item scroll-bar
868 This face determines the colors of the scroll bar.
869 @item border
870 This face determines the color of the frame border.
871 @item cursor
872 This face determines the color of the cursor.
873 @item mouse
874 This face determines the color of the mouse pointer.
875 @item tool-bar
876 The basic tool-bar face.
877 @item menu
878 This face determines the colors and font of Emacs's menus.  Setting the
879 font of LessTif/Motif menus is currently not supported; attempts to set
880 the font are ignored in this case.
881 @item trailing-whitespace
882 The face for highlighting trailing whitespace when
883 @code{show-trailing-whitespace} is non-nil.
884 @item variable-pitch
885 The basic variable-pitch face.
886 @end table
888 @cindex @code{region} face
889   When Transient Mark mode is enabled, the text of the region is
890 highlighted when the mark is active.  This uses the face named
891 @code{region}; you can control the style of highlighting by changing the
892 style of this face (@pxref{Face Customization}).  @xref{Transient Mark},
893 for more information about Transient Mark mode and activation and
894 deactivation of the mark.
896   One easy way to use faces is to turn on Font Lock mode.  This minor
897 mode, which is always local to a particular buffer, arranges to
898 choose faces according to the syntax of the text you are editing.  It
899 can recognize comments and strings in most languages; in several
900 languages, it can also recognize and properly highlight various other
901 important constructs.  @xref{Font Lock}, for more information about
902 Font Lock mode and syntactic highlighting.
904   You can print out the buffer with the highlighting that appears
905 on your screen using the command @code{ps-print-buffer-with-faces}.
906 @xref{PostScript}.
908 @node Font Lock
909 @section Font Lock mode
910 @cindex Font Lock mode
911 @cindex mode, Font Lock
912 @cindex syntax highlighting
913 @cindex syntax coloring
915   Font Lock mode is a minor mode, always local to a particular
916 buffer, which highlights (or ``fontifies'') using various faces
917 according to the syntax of the text you are editing.  It can
918 recognize comments and strings in most languages; in several
919 languages, it can also recognize and properly highlight various other
920 important constructs---for example, names of functions being defined
921 or reserved keywords.
923 @findex font-lock-mode
924 @findex turn-on-font-lock
925   The command @kbd{M-x font-lock-mode} turns Font Lock mode on or off
926 according to the argument, and toggles the mode when it has no argument.
927 The function @code{turn-on-font-lock} unconditionally enables Font Lock
928 mode.  This is useful in mode-hook functions.  For example, to enable
929 Font Lock mode whenever you edit a C file, you can do this:
931 @example
932 (add-hook 'c-mode-hook 'turn-on-font-lock)
933 @end example
935 @findex global-font-lock-mode
936 @vindex global-font-lock-mode
937   To turn on Font Lock mode automatically in all modes which support it,
938 customize the user option @code{global-font-lock-mode} or use the
939 function @code{global-font-lock-mode}, like this:
941 @example
942 (global-font-lock-mode 1)
943 @end example
945   To change the colors or the fonts used by Font Lock mode to fontify
946 different parts of text, you can use one of the following:
948 @itemize @bullet
949 @item
950 Invoke @kbd{M-x set-face-foreground} or @kbd{M-x set-face-background} to
951 change the colors of a particular face, such as
952 @code{font-lock-variable-name-face}, used by Font Lock.  @xref{Faces}.
953 The command @kbd{M-x list-faces-display} displays all the faces
954 currently known to Emacs, including those used by Font Lock.
956 @item
957 Customize the faces interactively with @kbd{M-x customize-face}, as
958 described in @ref{Face Customization}.
959 @end itemize
961 @kindex M-g M-g
962 @findex font-lock-fontify-block
963   In Font Lock mode, when you edit the text, the highlighting updates
964 automatically in the line that you changed.  Most changes don't affect
965 the highlighting of subsequent lines, but occasionally they do.  To
966 rehighlight a range of lines, use the command @kbd{M-g M-g}
967 (@code{font-lock-fontify-block}).
969 @vindex font-lock-mark-block-function
970   In certain major modes, @kbd{M-g M-g} refontifies the entire current
971 function.  (The variable @code{font-lock-mark-block-function} controls
972 how to find the current function.)  In other major modes, @kbd{M-g M-g}
973 refontifies 16 lines above and below point.
975   With a prefix argument @var{n}, @kbd{M-g M-g} refontifies @var{n}
976 lines above and below point, regardless of the mode.
978   To get the full benefit of Font Lock mode, you need to choose a
979 default font which has bold, italic, and bold-italic variants; or else
980 you need to have a color or gray-scale screen.
982 @vindex font-lock-maximum-decoration
983   The variable @code{font-lock-maximum-decoration} specifies the
984 preferred level of fontification, for modes that provide multiple
985 levels.  Level 1 is the least amount of fontification; some modes
986 support levels as high as 3.  The normal default is ``as high as
987 possible.''  You can specify an integer, which applies to all modes, or
988 you can specify different numbers for particular major modes; for
989 example, to use level 1 for C/C++ modes, and the default level
990 otherwise, use this:
992 @example
993 (setq font-lock-maximum-decoration
994       '((c-mode . 1) (c++-mode . 1)))
995 @end example
997 @vindex font-lock-maximum-size
998   Fontification can be too slow for large buffers, so you can suppress
999 it.  The variable @code{font-lock-maximum-size} specifies a buffer size,
1000 beyond which buffer fontification is suppressed.
1002 @c @w is used below to prevent a bad page-break.
1003 @vindex font-lock-beginning-of-syntax-function
1004   Comment and string fontification (or ``syntactic'' fontification)
1005 relies on analysis of the syntactic structure of the buffer text.  For
1006 the purposes of speed, some modes including C mode and Lisp mode rely on
1007 a special convention: an open-parenthesis in the leftmost column always
1008 defines the @w{beginning} of a defun, and is thus always outside any string
1009 or comment.  (@xref{Defuns}.)  If you don't follow this convention,
1010 then Font Lock mode can misfontify the text after an open-parenthesis in
1011 the leftmost column that is inside a string or comment.
1013   The variable @code{font-lock-beginning-of-syntax-function} (always
1014 buffer-local) specifies how Font Lock mode can find a position
1015 guaranteed to be outside any comment or string.  In modes which use the
1016 leftmost column parenthesis convention, the default value of the variable
1017 is @code{beginning-of-defun}---that tells Font Lock mode to use the
1018 convention.  If you set this variable to @code{nil}, Font Lock no longer
1019 relies on the convention.  This avoids incorrect results, but the price
1020 is that, in some cases, fontification for a changed text must rescan
1021 buffer text from the beginning of the buffer.
1023 @findex font-lock-add-keywords
1024   Font Lock highlighting patterns already exist for many modes, but you
1025 may want to fontify additional patterns.  You can use the function
1026 @code{font-lock-add-keywords}, to add your own highlighting patterns for
1027 a particular mode.  For example, to highlight @samp{FIXME:} words in C
1028 comments, use this:
1030 @example
1031 (font-lock-add-keywords
1032  'c-mode
1033  '(("\\<\\(FIXME\\):" 1 font-lock-warning-face t)))
1034 @end example
1036 @node Support Modes
1037 @section Font Lock Support Modes
1039   Font Lock support modes make Font Lock mode faster for large buffers.
1040 There are two support modes: Fast Lock mode and Lazy Lock mode.  They
1041 use two different methods of speeding up Font Lock mode.
1043 @menu
1044 * Fast Lock Mode::      Saving font information in files.
1045 * Lazy Lock Mode::      Fontifying only text that is actually displayed.
1046 * JIT Lock Mode::       Like Lazy Lock, but generally faster.
1047 * Fast or Lazy::        Which support mode is best for you?
1048 @end menu
1050 @node Fast Lock Mode
1051 @subsection Fast Lock Mode
1053 @cindex Fast Lock mode
1054 @cindex mode, Fast Lock
1055   To make Font Lock mode faster for buffers visiting large files, you
1056 can use Fast Lock mode.  Fast Lock mode saves the font information for
1057 each file in a separate cache file; each time you visit the file, it
1058 rereads the font information from the cache file instead of refontifying
1059 the text from scratch.
1061 @findex fast-lock-mode
1062   The command @kbd{M-x fast-lock-mode} turns Fast Lock mode on or off,
1063 according to the argument (with no argument, it toggles).  You can also
1064 arrange to enable Fast Lock mode whenever you use Font Lock mode, like
1065 this:
1067 @example
1068 (setq font-lock-support-mode 'fast-lock-mode)
1069 @end example
1071 @vindex fast-lock-minimum-size
1072   It is not worth writing a cache file for small buffers.  Therefore,
1073 the variable @code{fast-lock-minimum-size} specifies a minimum file size
1074 for caching font information.
1076 @vindex fast-lock-cache-directories
1077   The variable @code{fast-lock-cache-directories} specifies where to put
1078 the cache files.  Its value is a list of directories to try; @code{"."}
1079 means the same directory as the file being edited.  The default value is
1080 @w{@code{("." "~/.emacs-flc")}}, which means to use the same directory if
1081 possible, and otherwise the directory @file{~/.emacs-flc}.
1083 @vindex fast-lock-save-others
1084   The variable @code{fast-lock-save-others} specifies whether Fast Lock
1085 mode should save cache files for files that you do not own.  A
1086 non-@code{nil} value means yes (and that is the default).
1088 @node Lazy Lock Mode
1089 @subsection Lazy Lock Mode
1090 @cindex Lazy Lock mode
1091 @cindex mode, Lazy Lock
1093   To make Font Lock mode faster for large buffers, you can use Lazy Lock
1094 mode to reduce the amount of text that is fontified.  In Lazy Lock mode,
1095 buffer fontification is demand-driven; it happens to portions of the
1096 buffer that are about to be displayed.  And fontification of your
1097 changes is deferred; it happens only when Emacs has been idle for a
1098 certain short period of time.
1100 @findex lazy-lock-mode
1101   The command @kbd{M-x lazy-lock-mode} turns Lazy Lock mode on or off,
1102 according to the argument (with no argument, it toggles).  You can also
1103 arrange to enable Lazy Lock mode whenever you use Font Lock mode, like
1104 this:
1106 @example
1107 (setq font-lock-support-mode 'lazy-lock-mode)
1108 @end example
1110 @vindex lazy-lock-minimum-size
1111   It is not worth avoiding buffer fontification for small buffers.
1112 Therefore, the variable @code{lazy-lock-minimum-size} specifies a
1113 minimum buffer size for demand-driven buffer fontification.  Buffers
1114 smaller than that are fontified all at once, as in plain Font Lock mode.
1116 @vindex lazy-lock-defer-time
1117   When you alter the buffer, Lazy Lock mode defers fontification of the
1118 text you changed.  The variable @code{lazy-lock-defer-time} specifies
1119 how many seconds Emacs must be idle before it starts fontifying your
1120 changes.  If the value is 0, then changes are fontified immediately, as
1121 in plain Font Lock mode.
1123 @vindex lazy-lock-defer-on-scrolling
1124   Lazy Lock mode normally fontifies newly visible portions of the buffer
1125 before they are first displayed.  However, if the value of
1126 @code{lazy-lock-defer-on-scrolling} is non-@code{nil}, newly visible
1127 text is fontified only when Emacs is idle for
1128 @code{lazy-lock-defer-time} seconds.
1130 @vindex lazy-lock-defer-contextually
1131   In some modes, including C mode and Emacs Lisp mode, changes in one
1132 line's contents can alter the context for subsequent lines, and thus
1133 change how they ought to be fontified.  Ordinarily, you must type
1134 @kbd{M-g M-g} to refontify the subsequent lines.  However, if you set
1135 the variable @code{lazy-lock-defer-contextually} to non-@code{nil}, Lazy
1136 Lock mode does this automatically, after @code{lazy-lock-defer-time}
1137 seconds.
1139 @cindex stealth fontification
1140   When Emacs is idle for a long time, Lazy Lock fontifies additional
1141 portions of the buffer, not yet displayed, in case you will display them
1142 later.  This is called @dfn{stealth fontification}.
1144 @vindex lazy-lock-stealth-time
1145 @vindex lazy-lock-stealth-lines
1146 @vindex lazy-lock-stealth-verbose
1147   The variable @code{lazy-lock-stealth-time} specifies how many seconds
1148 Emacs has to be idle before stealth fontification starts.  A value of
1149 @code{nil} means no stealth fontification.  The variables
1150 @code{lazy-lock-stealth-lines} and @code{lazy-lock-stealth-verbose}
1151 specify the granularity and verbosity of stealth fontification.
1153 @node JIT Lock Mode
1154 @subsection JIT Lock Mode
1156 @findex jit-lock-mode
1157 This Just-In-time support mode is roughly equivalent to Lazy Lock but is
1158 generally faster and more robust.  It supports stealth and deferred
1159 contextual fontification.
1161 Font-lock uses @code{jit-lock-mode} as default support mode, so you
1162 don't have to do anything to activate it.
1164 @node Fast or Lazy
1165 @subsection Fast Lock or Lazy Lock?
1167   Here is a simple guide to help you choose one of the Font Lock support
1168 modes.
1170 @itemize @bullet
1171 @item
1172 Fast Lock mode intervenes only during file visiting and buffer
1173 killing (and related events); therefore buffer editing and window
1174 scrolling are no faster or slower than in plain Font Lock mode.
1176 @item
1177 Fast Lock mode is slower at reading a cache file than Lazy Lock
1178 mode is at fontifying a window; therefore Fast Lock mode is slower at
1179 visiting a file than Lazy Lock mode.
1181 @item
1182 Lazy Lock mode intervenes during window scrolling to fontify text that
1183 scrolls onto the screen; therefore, scrolling is slower than in plain
1184 Font Lock mode.
1186 @item
1187 Lazy Lock mode doesn't fontify during buffer editing (it defers
1188 fontification of changes); therefore, editing is faster than in plain
1189 Font Lock mode.
1191 @item
1192 Fast Lock mode can be fooled by a file that is kept under version
1193 control software; therefore buffer fontification may occur even when
1194 a cache file exists for the file.
1196 @item
1197 Fast Lock mode only works with a buffer visiting a file; Lazy Lock
1198 mode works with any buffer.
1200 @item
1201 Fast Lock mode generates cache files; Lazy Lock mode does not.
1202 @end itemize
1204 @vindex font-lock-support-mode
1205   The variable @code{font-lock-support-mode} specifies which of these
1206 support modes to use; for example, to specify that Fast Lock mode is
1207 used for C/C++ modes, and Lazy Lock mode otherwise, set the variable
1208 like this:
1210 @example
1211 (setq font-lock-support-mode
1212       '((c-mode . fast-lock-mode) (c++-mode . fast-lock-mode)
1213         (t . lazy-lock-mode)))
1214 @end example
1216 @node Highlight Changes
1217 @section Highlight Changes Mode
1219 @findex highlight-changes-mode
1220   Use @kbd{M-x highlight-changes-mode} to enable a minor mode
1221 that uses faces (colors, typically) to indicate which parts of
1222 the buffer were changed most recently.
1224 @node Highlight Interactively
1225 @section Interactive Highlighting of Arbitrary Text
1227 @cindex highlighting, arbitrary text
1228 @cindex interactive highlighting
1229   Sometimes, you could need to highlight arbitrary strings in the
1230 buffer.  For example, you might wish to see all the references to a
1231 certain variable in a program source file or highlight certain parts in
1232 a voluminous output of some program, or make certain cliches stand out.
1234 @findex hi-lock-mode
1235   Use the @kbd{M-x hi-lock-mode} command to turn on a minor mode that
1236 allows you to specify regular expressions of the text to be highlighted.
1237 @code{hi-lock-mode} works like Font Lock (@pxref{Font Lock}), except
1238 that it lets you control what parts of text are highlighted.
1239 @code{hi-lock-mode} provides several functions:
1241 @table @kbd
1242 @item C-x w h
1243 @kindex C-x w i
1244 @findex highlight-regexp
1245 Specify the regular expression (@pxref{Regexps}) for the parts of buffer
1246 text that are to be highlighted (@code{highlight-regexp}).  It prompts
1247 for the regular expression, then for the name of the face with which to
1248 highlight the text that matches.
1250 @item C-x w r
1251 @kindex C-x w r
1252 @findex unhighlight-regexp
1253 Unhighlight @var{regexp} (@code{unhighlight-regexp}).  Prompts for the
1254 regular expression, and will accept only one of the regexps inserted by
1255 other @code{hi-lock} commands.
1257 @item C-x w l
1258 @kindex C-x w l
1259 @findex highlight-lines-matching-regexp
1260 @cindex lines, highlighting
1261 @cindex highlighting lines of text
1262 Specify the regular expression (@pxref{Regexps}) for the lines of buffer
1263 text that are to be highlighted
1264 (@code{highlight-lines-matching-regexp}).  It prompts for the regular
1265 expression, then for the name of the face with which to highlight the
1266 matching lines.
1268 @item C-x w b
1269 @kindex C-x w b
1270 @findex hi-lock-write-interactive-patterns
1271 This runs the @code{hi-lock-write-interactive-patterns} command which
1272 inserts the patterns added by @kbd{M-x highlight-regexp} and @kbd{M-x
1273 highlight-lines-matching-regexp} into the current buffer at point, as
1274 comments.  These patterns will be read the next time the file is
1275 visited, or when the @kbd{M-x hi-lock-find-patterns} command is issued.
1277 @item C-x w i
1278 @kindex C-x w i
1279 @findex hi-lock-find-patterns
1280 @vindex hi-lock-exclude-modes
1281 Re-read patterns stored in a buffer in the format produced by @kbd{M-x
1282 hi-lock-write-interactive-patterns}
1283 (@code{hi-lock-write-interactive-patterns}.  If you invoke this command
1284 in a buffer whose major mode is a member of the list that is the value
1285 of the variable @code{hi-lock-exclude-modes}, this command has no
1286 effect.
1287 @end table
1290 @node Trailing Whitespace
1291 @section Trailing Whitespace
1293 @cindex trailing whitespace
1294 @cindex whitespace, trailing
1295 @vindex show-trailing-whitespace
1296 The option @code{show-trailing-whitespace} can be customized so that
1297 Emacs displays trailing whitespace in the face
1298 @code{trailing-whitespace}.  Trailing whitespace is defined as spaces or
1299 tabs at the end of a line.  To avoid busy highlighting when entering new
1300 text, trailing whitespace is not displayed if point is at the end of the
1301 line containing the whitespace.
1303 @node Tooltips
1304 @section Tooltips (or `Balloon Help')
1306 @cindex balloon help
1307 @findex tooltip-mode
1308 Tooltips are small windows displaying a help string at the current
1309 mouse position, typically over text---including the mode line---which
1310 can be activated with the mouse or other keys.  (This facility is
1311 sometimes known as `balloon help'.)  Tooltips may be available for menu
1312 items too.
1314 To use tooltips, customize the user option @code{tooltip-mode}.  The
1315 customization group @code{tooltip} controls various aspects of their
1316 display.  If Tooltip mode is not activated, the help text is displayed
1317 in the echo area instead.
1319 As of version 21.1, tooltips are not supported in the MS-Windows port
1320 of Emacs.
1322 @node Mouse Avoidance
1323 @section Mouse Avoidance
1325 Mouse Avoidance mode keeps the window system mouse pointer away from
1326 point to avoid obscuring text.  Whenever the mouse is moved, the frame
1327 is also raised.  To use it, customize the option
1328 @code{mouse-avoidance-mode}.  You can set this to various values to move
1329 the mouse in several ways:
1331 @table @code
1332 @item banish
1333 Move the mouse to the upper-right corner on any keypress;
1334 @item exile
1335 Move the mouse to the corner only if the cursor gets too close,
1336 and allow it to return once the cursor is out of the way;
1337 @item jump
1338 If the cursor gets too close to the mouse, displace the mouse
1339 a random distance & direction;
1340 @item animate
1341 As @code{jump}, but shows steps along the way for illusion of motion;
1342 @item cat-and-mouse
1343 The same as @code{animate};
1344 @item proteus
1345 As @code{animate}, but changes the shape of the mouse pointer too.
1346 @end table
1348 You can also use the command @kbd{M-x mouse-avoidance-mode} to turn on
1349 the mode.
1351 @node Misc X
1352 @section Miscellaneous X Window Features
1354   The following commands let you create, delete and operate on frames:
1356 @table @kbd
1357 @item C-z
1358 @kindex C-z @r{(X windows)}
1359 @findex iconify-or-deiconify-frame
1360 Iconify the selected Emacs frame (@code{iconify-or-deiconify-frame}).
1361 The normal meaning of @kbd{C-z}, to suspend Emacs, is not useful under a
1362 window system, so it has a different binding in that case.
1364 If you type this command on an Emacs frame's icon, it deiconifies the frame.
1366 @item C-x 5 0
1367 @kindex C-x 5 0
1368 @findex delete-frame
1369 Delete the selected frame (@code{delete-frame}).  This is not allowed if
1370 there is only one frame.
1372 @item C-x 5 o
1373 @kindex C-x 5 o
1374 @findex other-frame
1375 Select another frame, raise it, and warp the mouse to it so that it
1376 stays selected.  If you repeat this command, it cycles through all the
1377 frames on your terminal.
1379 @item C-x 5 1
1380 @kindex C-x 5 1
1381 @findex delete-other-frames
1382 Delete all frames except the selected one.
1383 @end table
1385 @cindex busy-cursor display
1386 @vindex busy-cursor-delay
1387   Emacs can optionally display a busy cursor on X and other window
1388 systems.  To turn this on or off, customize the group @code{cursor}.
1389 You can also control the amount of time Emacs is busy before the
1390 busy-cursor is displayed, by customizing the value of the variable
1391 @code{busy-cursor-delay}.
1393 @vindex x-stretch-cursor
1394 @cindex wide block cursor
1395   Emacs on X can draw the block cursor as wide as the glyph under the
1396 cursor.  For example, if the cursor is on a TAB character, it is drawn
1397 as wide as that TAB is on the display.  To turn on this feature, set the
1398 variable @code{x-stretch-cursor} to a non-nil value.
1400 @vindex indicate-empty-lines
1401 @vindex default-indicate-empty-lines
1402 @cindex empty lines
1403   Empty display lines at the end of the buffer can be optionally marked
1404 with a special bitmap on the left fringe of the window.  This is
1405 activated by setting the buffer-local variable
1406 @code{indicate-empty-lines} to a non-nil value.  The default value of
1407 this variable is found in @code{default-indicate-empty-lines}.
1409 @node Non-Window Terminals
1410 @section Non-Window Terminals
1411 @cindex non-window terminals
1412 @cindex single-frame terminals
1414   If your terminal does not have a window system that Emacs supports,
1415 then it can display only one Emacs frame at a time.  However, you can
1416 still create multiple Emacs frames, and switch between them.  Switching
1417 frames on these terminals is much like switching between different
1418 window configurations.
1420   Use @kbd{C-x 5 2} to create a new frame and switch to it; use @kbd{C-x
1421 5 o} to cycle through the existing frames; use @kbd{C-x 5 0} to delete
1422 the current frame.
1424   Each frame has a number to distinguish it.  If your terminal can
1425 display only one frame at a time, the selected frame's number @var{n}
1426 appears near the beginning of the mode line, in the form
1427 @samp{F@var{n}}.
1429 @findex set-frame-name
1430 @findex select-frame-by-name
1431   @samp{F@var{n}} is actually the frame's name.  You can also specify a
1432 different name if you wish, and you can select a frame by its name.  Use
1433 the command @kbd{M-x set-frame-name @key{RET} @var{name} @key{RET}} to
1434 specify a new name for the selected frame, and use @kbd{M-x
1435 select-frame-by-name @key{RET} @var{name} @key{RET}} to select a frame
1436 according to its name.  The name you specify appears in the mode line
1437 when the frame is selected.
1439 @node XTerm Mouse
1440 @section Using a Mouse in Terminal Emulators
1441 @cindex xterm, mouse support
1442 @cindex terminal emulators, mouse support
1444 Some terminal emulators under X support mouse clicks in the terminal
1445 window.  In a terminal emulator which is compatible with @code{xterm},
1446 you can use @kbd{M-x xterm-mouse-mode} to enable simple use of the
1447 mouse---only single clicks are supported.  The normal @code{xterm} mouse
1448 functionality is still available by holding down the @kbd{SHIFT} key
1449 when you press the mouse button.