]> code.delx.au - gnu-emacs/blob - doc/emacs/frames.texi
Update copyright year to 2015
[gnu-emacs] / doc / emacs / frames.texi
1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2015 Free Software
3 @c Foundation, Inc.
4 @c See file emacs.texi for copying conditions.
5 @node Frames
6 @chapter Frames and Graphical Displays
7 @cindex frames
8
9 When Emacs is started on a graphical display, e.g., on the X Window
10 System, it occupies a graphical system-level ``window''. In this
11 manual, we call this a @dfn{frame}, reserving the word ``window'' for
12 the part of the frame used for displaying a buffer. A frame initially
13 contains one window, but it can be subdivided into multiple windows
14 (@pxref{Windows}). A frame normally also contains a menu bar, tool
15 bar, and echo area.
16
17 You can also create additional frames (@pxref{Creating Frames}).
18 All frames created in the same Emacs session have access to the same
19 underlying buffers and other data. For instance, if a buffer is being
20 shown in more than one frame, any changes made to it in one frame show
21 up immediately in the other frames too.
22
23 Typing @kbd{C-x C-c} closes all the frames on the current display,
24 and ends the Emacs session if it has no frames open on any other
25 displays (@pxref{Exiting}). To close just the selected frame, type
26 @kbd{C-x 5 0} (that is zero, not @kbd{o}).
27
28 This chapter describes Emacs features specific to graphical displays
29 (particularly mouse commands), and features for managing multiple
30 frames. On text terminals, many of these features are unavailable.
31 However, it is still possible to create multiple ``frames'' on text
32 terminals; such frames are displayed one at a time, filling the entire
33 terminal screen (@pxref{Non-Window Terminals}). It is also possible
34 to use the mouse on some text terminals (@pxref{Text-Only Mouse}, for
35 doing so on GNU and Unix systems; and
36 @iftex
37 @pxref{MS-DOS Mouse,,,emacs-xtra,Specialized Emacs Features},
38 @end iftex
39 @ifnottex
40 @pxref{MS-DOS Mouse},
41 @end ifnottex
42 for doing so on MS-DOS). Menus are supported on all text terminals.
43
44 @menu
45 * Mouse Commands:: Moving, cutting, and pasting, with the mouse.
46 * Word and Line Mouse:: Mouse commands for selecting whole words or lines.
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 * Creating Frames:: Creating additional Emacs frames with various contents.
51 * Frame Commands:: Iconifying, deleting, and switching frames.
52 * Fonts:: Changing the frame font.
53 * Speedbar:: How to make and use a speedbar frame.
54 * Multiple Displays:: How one Emacs instance can talk to several displays.
55 * Frame Parameters:: Changing the colors and other modes of frames.
56 * Scroll Bars:: How to enable and disable scroll bars; how to use them.
57 * Drag and Drop:: Using drag and drop to open files and insert text.
58 * Menu Bars:: Enabling and disabling the menu bar.
59 * Tool Bars:: Enabling and disabling the tool bar.
60 * Dialog Boxes:: Controlling use of dialog boxes.
61 * Tooltips:: Displaying information at the current mouse position.
62 * Mouse Avoidance:: Preventing the mouse pointer from obscuring text.
63 * Non-Window Terminals:: Multiple frames on terminals that show only one.
64 * Text-Only Mouse:: Using the mouse in text terminals.
65 @end menu
66
67 @node Mouse Commands
68 @section Mouse Commands for Editing
69 @cindex mouse buttons (what they do)
70 @cindex mouse, selecting text using
71
72 @kindex Mouse-1
73 @kindex Mouse-2
74 @kindex Mouse-3
75 @table @kbd
76 @item Mouse-1
77 Move point to where you click (@code{mouse-set-point}).
78
79 @item Drag-Mouse-1
80 Activate the region around the text selected by dragging, and put the
81 text in the primary selection (@code{mouse-set-region}).
82
83 @item Mouse-2
84 Move point to where you click, and insert the contents of the primary
85 selection there (@code{mouse-yank-primary}).
86
87 @item Mouse-3
88 If the region is active, move the nearer end of the region to the
89 click position; otherwise, set mark at the current value of point and
90 point at the click position. Save the resulting region in the kill
91 ring; on a second click, kill it (@code{mouse-save-then-kill}).
92 @end table
93
94 @findex mouse-set-point
95 The most basic mouse command is @code{mouse-set-point}, which is
96 invoked by clicking with the left mouse button, @kbd{Mouse-1}, in the
97 text area of a window. This moves point to the position where you
98 clicked. If that window was not the selected window, it becomes the
99 selected window.
100
101 @vindex x-mouse-click-focus-ignore-position
102 Normally, if the frame you clicked in was not the selected frame, it
103 is made the selected frame, in addition to selecting the window and
104 setting the cursor. On the X Window System, you can change this by
105 setting the variable @code{x-mouse-click-focus-ignore-position} to
106 @code{t}. In that case, the initial click on an unselected frame just
107 selects the frame, without doing anything else; clicking again selects
108 the window and sets the cursor position.
109
110 @cindex mouse, dragging
111 @findex mouse-set-region
112 Holding down @kbd{Mouse-1} and ``dragging'' the mouse over a stretch
113 of text activates the region around that text
114 (@code{mouse-set-region}), placing the mark where you started holding
115 down the mouse button, and point where you release it (@pxref{Mark}).
116 In addition, the text in the region becomes the primary selection
117 (@pxref{Primary Selection}).
118
119 @vindex mouse-drag-copy-region
120 If you change the variable @code{mouse-drag-copy-region} to a
121 non-@code{nil} value, dragging the mouse over a stretch of text also
122 adds the text to the kill ring. The default is @code{nil}.
123
124 @vindex mouse-scroll-min-lines
125 If you move the mouse off the top or bottom of the window while
126 dragging, the window scrolls at a steady rate until you move the mouse
127 back into the window. This way, you can select regions that don't fit
128 entirely on the screen. The number of lines scrolled per step depends
129 on how far away from the window edge the mouse has gone; the variable
130 @code{mouse-scroll-min-lines} specifies a minimum step size.
131
132 @findex mouse-yank-primary
133 @findex mouse-yank-at-click
134 Clicking with the middle mouse button, @kbd{Mouse-2}, moves point to
135 the position where you clicked and inserts the contents of the primary
136 selection (@code{mouse-yank-primary}). @xref{Primary Selection}.
137 This behavior is consistent with other X applications. Alternatively,
138 you can rebind @kbd{Mouse-2} to @code{mouse-yank-at-click}, which
139 performs a yank at the position you click.
140
141 @vindex mouse-yank-at-point
142 If you change the variable @code{mouse-yank-at-point} to a
143 non-@code{nil} value, @kbd{Mouse-2} does not move point; it inserts
144 the text at point, regardless of where you clicked or even which of
145 the frame's windows you clicked on. This variable affects both
146 @code{mouse-yank-primary} and @code{mouse-yank-at-click}.
147
148 @findex mouse-save-then-kill
149 Clicking with the right mouse button, @kbd{Mouse-3}, runs the
150 command @code{mouse-save-then-kill}. This performs several actions
151 depending on where you click and the status of the region:
152
153 @itemize @bullet
154 @item
155 If no region is active, clicking @kbd{Mouse-3} activates the region,
156 placing the mark where point was and point at the clicked position.
157
158 @item
159 If a region is active, clicking @kbd{Mouse-3} adjusts the nearer end
160 of the region by moving it to the clicked position. The adjusted
161 region's text is copied to the kill ring; if the text in the original
162 region was already on the kill ring, it replaces it there.
163
164 @item
165 If you originally specified the region using a double or triple
166 @kbd{Mouse-1}, so that the region is defined to consist of entire
167 words or lines (@pxref{Word and Line Mouse}), then adjusting the
168 region with @kbd{Mouse-3} also proceeds by entire words or lines.
169
170 @item
171 If you use @kbd{Mouse-3} a second time consecutively, at the same
172 place, that kills the region already selected. Thus, the simplest way
173 to kill text with the mouse is to click @kbd{Mouse-1} at one end, then
174 click @kbd{Mouse-3} twice at the other end. To copy the text into the
175 kill ring without deleting it from the buffer, press @kbd{Mouse-3}
176 just once---or just drag across the text with @kbd{Mouse-1}. Then you
177 can copy it elsewhere by yanking it.
178 @end itemize
179
180 The @code{mouse-save-then-kill} command also obeys the variable
181 @code{mouse-drag-copy-region} (described above). If the value is
182 non-@code{nil}, then whenever the command sets or adjusts the active
183 region, the text in the region is also added to the kill ring. If the
184 latest kill ring entry had been added the same way, that entry is
185 replaced rather than making a new entry.
186
187 Whenever you set the region using any of the mouse commands
188 described above, the mark will be deactivated by any subsequent
189 unshifted cursor motion command, in addition to the usual ways of
190 deactivating the mark. @xref{Shift Selection}.
191
192 @cindex mouse wheel
193 @findex mouse-wheel-mode
194 @cindex Mouse Wheel minor mode
195 @cindex mode, Mouse Wheel
196 @vindex mouse-wheel-follow-mouse
197 @vindex mouse-wheel-scroll-amount
198 @vindex mouse-wheel-progressive-speed
199 Some mice have a ``wheel'' which can be used for scrolling. Emacs
200 supports scrolling windows with the mouse wheel, by default, on most
201 graphical displays. To toggle this feature, use @kbd{M-x
202 mouse-wheel-mode}. The variables @code{mouse-wheel-follow-mouse} and
203 @code{mouse-wheel-scroll-amount} determine where and by how much
204 buffers are scrolled. The variable
205 @code{mouse-wheel-progressive-speed} determines whether the scroll
206 speed is linked to how fast you move the wheel.
207
208 @node Word and Line Mouse
209 @section Mouse Commands for Words and Lines
210
211 These variants of @kbd{Mouse-1} select entire words or lines at a
212 time. Emacs activates the region around the selected text, which is
213 also copied to the kill ring.
214
215 @table @kbd
216 @item Double-Mouse-1
217 Select the text around the word which you click on.
218
219 Double-clicking on a character with ``symbol'' syntax (such as
220 underscore, in C mode) selects the symbol surrounding that character.
221 Double-clicking on a character with open- or close-parenthesis syntax
222 selects the parenthetical grouping which that character starts or
223 ends. Double-clicking on a character with string-delimiter syntax
224 (such as a single-quote or double-quote in C) selects the string
225 constant (Emacs uses heuristics to figure out whether that character
226 is the beginning or the end of it).
227
228 @item Double-Drag-Mouse-1
229 Select the text you drag across, in the form of whole words.
230
231 @item Triple-Mouse-1
232 Select the line you click on.
233
234 @item Triple-Drag-Mouse-1
235 Select the text you drag across, in the form of whole lines.
236 @end table
237
238 @node Mouse References
239 @section Following References with the Mouse
240 @kindex Mouse-1 @r{(on buttons)}
241 @kindex Mouse-2 @r{(on buttons)}
242 @cindex hyperlinks
243 @cindex links
244 @cindex text buttons
245 @cindex buttons
246
247 @vindex mouse-highlight
248 Some Emacs buffers include @dfn{buttons}, or @dfn{hyperlinks}:
249 pieces of text that perform some action (e.g., following a reference)
250 when activated (e.g., by clicking on them). Usually, a button's text
251 is visually highlighted: it is underlined, or a box is drawn around
252 it. If you move the mouse over a button, the shape of the mouse
253 cursor changes and the button lights up. If you change the variable
254 @code{mouse-highlight} to @code{nil}, Emacs disables this
255 highlighting.
256
257 You can activate a button by moving point to it and typing
258 @key{RET}, or by clicking either @kbd{Mouse-1} or @kbd{Mouse-2} on the
259 button. For example, in a Dired buffer, each file name is a button;
260 activating it causes Emacs to visit that file (@pxref{Dired}). In a
261 @file{*Compilation*} buffer, each error message is a button, and
262 activating it visits the source code for that error
263 (@pxref{Compilation}).
264
265 Although clicking @kbd{Mouse-1} on a button usually activates the
266 button, if you hold the mouse button down for a period of time before
267 releasing it (specifically, for more than 450 milliseconds), then
268 Emacs moves point where you clicked, without activating the button.
269 In this way, you can use the mouse to move point over a button without
270 activating it. Dragging the mouse over or onto a button has its usual
271 behavior of setting the region, and does not activate the button.
272
273 You can change how @kbd{Mouse-1} applies to buttons by customizing
274 the variable @code{mouse-1-click-follows-link}. If the value is a
275 positive integer, that determines how long you need to hold the mouse
276 button down for, in milliseconds, to cancel button activation; the
277 default is 450, as described in the previous paragraph. If the value
278 is @code{nil}, @kbd{Mouse-1} just sets point where you clicked, and
279 does not activate buttons. If the value is @code{double}, double
280 clicks activate buttons but single clicks just set point.
281
282 @vindex mouse-1-click-in-non-selected-windows
283 Normally, @kbd{Mouse-1} on a button activates the button even if it
284 is in a non-selected window. If you change the variable
285 @code{mouse-1-click-in-non-selected-windows} to @code{nil},
286 @kbd{Mouse-1} on a button in an unselected window moves point to the
287 clicked position and selects that window, without activating the
288 button.
289
290 @node Menu Mouse Clicks
291 @section Mouse Clicks for Menus
292
293 Several mouse clicks with the @key{CTRL} and @key{SHIFT} modifiers
294 bring up menus.
295
296 @table @kbd
297 @item C-Mouse-1
298 @kindex C-Mouse-1
299 This menu is for selecting a buffer.
300
301 The MSB (``mouse select buffer'') global minor mode makes this
302 menu smarter and more customizable. @xref{Buffer Menus}.
303
304 @item C-Mouse-2
305 @kindex C-Mouse-2
306 This menu contains entries for examining faces and other text
307 properties, and well as for setting them (the latter is mainly useful
308 when editing enriched text; @pxref{Enriched Text}).
309
310 @item C-Mouse-3
311 @kindex C-Mouse-3
312 This menu is mode-specific. For most modes if Menu-bar mode is on,
313 this menu has the same items as all the mode-specific menu-bar menus
314 put together. Some modes may specify a different menu for this
315 button. If Menu Bar mode is off, this menu contains all the items
316 which would be present in the menu bar---not just the mode-specific
317 ones---so that you can access them without having to display the menu
318 bar.
319
320 @item S-Mouse-1
321 This menu is for changing the default face within the window's buffer.
322 @xref{Text Scale}.
323 @end table
324
325 Some graphical applications use @kbd{Mouse-3} for a mode-specific
326 menu. If you prefer @kbd{Mouse-3} in Emacs to bring up such a menu
327 instead of running the @code{mouse-save-then-kill} command, rebind
328 @kbd{Mouse-3} by adding the following line to your init file
329 (@pxref{Init Rebinding}):
330
331 @smallexample
332 (global-set-key [mouse-3] 'mouse-popup-menubar-stuff)
333 @end smallexample
334
335 @node Mode Line Mouse
336 @section Mode Line Mouse Commands
337 @cindex mode line, mouse
338 @cindex mouse on mode line
339
340 You can use mouse clicks on window mode lines to select and manipulate
341 windows.
342
343 Some areas of the mode line, such as the buffer name, and major and minor
344 mode names, have their own special mouse bindings. These areas are
345 highlighted when you hold the mouse over them, and information about
346 the special bindings will be displayed (@pxref{Tooltips}). This
347 section's commands do not apply in those areas.
348
349 @table @kbd
350 @item Mouse-1
351 @kindex Mouse-1 @r{(mode line)}
352 @kbd{Mouse-1} on a mode line selects the window it belongs to. By
353 dragging @kbd{Mouse-1} on the mode line, you can move it, thus
354 changing the height of the windows above and below. Changing heights
355 with the mouse in this way never deletes windows, it just refuses to
356 make any window smaller than the minimum height.
357
358 @item Mouse-2
359 @kindex Mouse-2 @r{(mode line)}
360 @kbd{Mouse-2} on a mode line expands that window to fill its frame.
361
362 @item Mouse-3
363 @kindex Mouse-3 @r{(mode line)}
364 @kbd{Mouse-3} on a mode line deletes the window it belongs to. If the
365 frame has only one window, it does nothing.
366
367 @item C-Mouse-2
368 @kindex C-mouse-2 @r{(mode line)}
369 @kbd{C-Mouse-2} on a mode line splits that window, producing two
370 side-by-side windows with the boundary running through the click
371 position (@pxref{Split Window}).
372 @end table
373
374 @kindex Mouse-1 @r{(scroll bar)}
375 Furthermore, by clicking and dragging @kbd{Mouse-1} on the divider
376 between two side-by-side mode lines, you can move the vertical
377 boundary to the left or right.
378
379 Note that resizing windows is affected by the value of
380 @code{window-resize-pixelwise}, see @ref{Split Window}.
381
382 @node Creating Frames
383 @section Creating Frames
384 @cindex creating frames
385
386 @kindex C-x 5
387 The prefix key @kbd{C-x 5} is analogous to @kbd{C-x 4}. Whereas
388 each @kbd{C-x 4} command pops up a buffer in a different window in the
389 selected frame (@pxref{Pop Up Window}), the @kbd{C-x 5} commands use a
390 different frame. If an existing visible or iconified (``minimized'')
391 frame already displays the requested buffer, that frame is raised and
392 deiconified (``un-minimized''); otherwise, a new frame is created on
393 the current display terminal.
394
395 The various @kbd{C-x 5} commands differ in how they find or create the
396 buffer to select:
397
398 @table @kbd
399 @item C-x 5 2
400 @kindex C-x 5 2
401 @findex make-frame-command
402 Create a new frame (@code{make-frame-command}).
403 @item C-x 5 b @var{bufname} @key{RET}
404 Select buffer @var{bufname} in another frame. This runs
405 @code{switch-to-buffer-other-frame}.
406 @item C-x 5 f @var{filename} @key{RET}
407 Visit file @var{filename} and select its buffer in another frame. This
408 runs @code{find-file-other-frame}. @xref{Visiting}.
409 @item C-x 5 d @var{directory} @key{RET}
410 Select a Dired buffer for directory @var{directory} in another frame.
411 This runs @code{dired-other-frame}. @xref{Dired}.
412 @item C-x 5 m
413 Start composing a mail message in another frame. This runs
414 @code{mail-other-frame}. It is the other-frame variant of @kbd{C-x m}.
415 @xref{Sending Mail}.
416 @item C-x 5 .
417 Find a tag in the current tag table in another frame. This runs
418 @code{find-tag-other-frame}, the multiple-frame variant of @kbd{M-.}.
419 @xref{Tags}.
420 @item C-x 5 r @var{filename} @key{RET}
421 @kindex C-x 5 r
422 @findex find-file-read-only-other-frame
423 Visit file @var{filename} read-only, and select its buffer in another
424 frame. This runs @code{find-file-read-only-other-frame}.
425 @xref{Visiting}.
426 @end table
427
428 You can control the appearance and behavior of the newly-created
429 frames by specifying @dfn{frame parameters}. @xref{Frame Parameters}.
430
431 @node Frame Commands
432 @section Frame Commands
433
434 The following commands are used to delete and operate on frames:
435
436 @table @kbd
437 @item C-x 5 0
438 @kindex C-x 5 0
439 @findex delete-frame
440 Delete the selected frame (@code{delete-frame}). This signals an
441 error if there is only one frame.
442
443 @item C-z
444 @kindex C-z @r{(X windows)}
445 @findex suspend-frame
446 Minimize (or ``iconify) the selected Emacs frame
447 (@code{suspend-frame}). @xref{Exiting}.
448
449 @item C-x 5 o
450 @kindex C-x 5 o
451 @findex other-frame
452 Select another frame, and raise it. If you repeat this command, it
453 cycles through all the frames on your terminal.
454
455 @item C-x 5 1
456 @kindex C-x 5 1
457 @findex delete-other-frames
458 Delete all frames on the current terminal, except the selected one.
459
460 @item M-<F10>
461 @kindex M-<F10>
462 @findex toggle-frame-maximized
463 Toggle the maximization state of the current frame. When a frame is
464 maximized, it fills the screen.
465
466 @item <F11>
467 @kindex <F11>
468 @findex toggle-frame-fullscreen
469 Toggle fullscreen mode for the current frame. (The difference
470 between ``fullscreen'' and ``maximized'' is normally that the former
471 hides window manager decorations, giving slightly more screen space to
472 Emacs itself.)
473 @end table
474
475 @vindex frame-resize-pixelwise
476 Note that with some window managers you may have to customize the
477 variable @code{frame-resize-pixelwise} to a non-@code{nil} value in
478 order to make a frame truly ``maximized'' or ``fullscreen''. This
479 variable, when set to a non-@code{nil} value, in general allows
480 resizing frames at pixel resolution, rather than in integral multiples
481 of lines and columns.
482
483 The @kbd{C-x 5 0} (@code{delete-frame}) command deletes the selected
484 frame. However, it will refuse to delete the last frame in an Emacs
485 session, to prevent you from losing the ability to interact with the
486 Emacs session. Note that when Emacs is run as a daemon (@pxref{Emacs
487 Server}), there is always a ``virtual frame'' that remains after all
488 the ordinary, interactive frames are deleted. In this case, @kbd{C-x
489 5 0} can delete the last interactive frame; you can use
490 @command{emacsclient} to reconnect to the Emacs session.
491
492 The @kbd{C-x 5 1} (@code{delete-other-frames}) command deletes all
493 other frames on the current terminal (this terminal refers to either a
494 graphical display, or a text terminal; @pxref{Non-Window Terminals}).
495 If the Emacs session has frames open on other graphical displays or
496 text terminals, those are not deleted.
497
498 @vindex focus-follows-mouse
499 The @kbd{C-x 5 o} (@code{other-frame}) command selects the next
500 frame on the current terminal. If you are using Emacs on the X Window
501 System with a window manager that selects (or @dfn{gives focus to})
502 whatever frame the mouse cursor is over, you have to change the
503 variable @code{focus-follows-mouse} to @code{t} in order for this
504 command to work properly. Then invoking @kbd{C-x 5 o} will also warp
505 the mouse cursor to the chosen frame.
506
507 @node Fonts
508 @section Fonts
509 @cindex fonts
510
511 By default, Emacs displays text on graphical displays using a
512 10-point monospace font. There are several different ways to specify
513 a different font:
514
515 @itemize
516 @item
517 Click on @samp{Set Default Font} in the @samp{Options} menu. This
518 makes the selected font the default on all existing graphical frames.
519 To save this for future sessions, click on @samp{Save Options} in the
520 @samp{Options} menu.
521
522 @item
523 Add a line to your init file, modifying the variable
524 @code{default-frame-alist} to specify the @code{font} parameter
525 (@pxref{Frame Parameters}), like this:
526
527 @example
528 (add-to-list 'default-frame-alist
529 '(font . "DejaVu Sans Mono-10"))
530 @end example
531
532 @noindent
533 This makes the font the default on all graphical frames created after
534 restarting Emacs with that init file.
535
536 @cindex X defaults file
537 @cindex X resources file
538 @item
539 Add an @samp{emacs.font} X resource setting to your X resource file,
540 like this:
541
542 @example
543 emacs.font: DejaVu Sans Mono-12
544 @end example
545
546 @noindent
547 You must restart X, or use the @command{xrdb} command, for the X
548 resources file to take effect. @xref{Resources}. Do not quote
549 font names in X resource files.
550
551 @item
552 If you are running Emacs on the GNOME desktop, you can tell Emacs to
553 use the default system font by setting the variable
554 @code{font-use-system-font} to @code{t} (the default is @code{nil}).
555 For this to work, Emacs must have been compiled with Gconf support.
556
557 @item
558 Use the command line option @samp{-fn} (or @samp{--font}). @xref{Font
559 X}.
560 @end itemize
561
562 To check what font you're currently using, the @kbd{C-u C-x =}
563 command can be helpful. It describes the character at point, and
564 names the font that it's rendered in.
565
566 @cindex fontconfig
567 On X, there are four different ways to express a ``font name''. The
568 first is to use a @dfn{Fontconfig pattern}. Fontconfig patterns have
569 the following form:
570
571 @example
572 @var{fontname}[-@var{fontsize}][:@var{name1}=@var{values1}][:@var{name2}=@var{values2}]...
573 @end example
574
575 @noindent
576 Within this format, any of the elements in braces may be omitted.
577 Here, @var{fontname} is the @dfn{family name} of the font, such as
578 @samp{Monospace} or @samp{DejaVu Sans Mono}; @var{fontsize} is the
579 @dfn{point size} of the font (one @dfn{printer's point} is about 1/72
580 of an inch); and the @samp{@var{name}=@var{values}} entries specify
581 settings such as the slant and weight of the font. Each @var{values}
582 may be a single value, or a list of values separated by commas. In
583 addition, some property values are valid with only one kind of
584 property name, in which case the @samp{@var{name}=} part may be
585 omitted.
586
587 Here is a list of common font properties:
588
589 @table @samp
590 @item slant
591 One of @samp{italic}, @samp{oblique}, or @samp{roman}.
592
593 @item weight
594 One of @samp{light}, @samp{medium}, @samp{demibold}, @samp{bold} or
595 @samp{black}.
596
597 @item style
598 Some fonts define special styles which are a combination of slant and
599 weight. For instance, @samp{Dejavu Sans} defines the @samp{book}
600 style, which overrides the slant and weight properties.
601
602 @item width
603 One of @samp{condensed}, @samp{normal}, or @samp{expanded}.
604
605 @item spacing
606 One of @samp{monospace}, @samp{proportional}, @samp{dual-width}, or
607 @samp{charcell}.
608 @end table
609
610 @noindent
611 Here are some examples of Fontconfig patterns:
612
613 @example
614 Monospace
615 Monospace-12
616 Monospace-12:bold
617 DejaVu Sans Mono:bold:italic
618 Monospace-12:weight=bold:slant=italic
619 @end example
620
621 For a more detailed description of Fontconfig patterns, see the
622 Fontconfig manual, which is distributed with Fontconfig and available
623 online at @url{http://fontconfig.org/fontconfig-user.html}.
624
625 @cindex GTK font pattern
626 The second way to specify a font is to use a @dfn{GTK font pattern}.
627 These have the syntax
628
629 @example
630 @var{fontname} [@var{properties}] [@var{fontsize}]
631 @end example
632
633 @noindent
634 where @var{fontname} is the family name, @var{properties} is a list of
635 property values separated by spaces, and @var{fontsize} is the point
636 size. The properties that you may specify for GTK font patterns are
637 as follows:
638
639 @itemize
640 @item
641 Slant properties: @samp{Italic} or @samp{Oblique}. If omitted, the
642 default (roman) slant is implied.
643 @item
644 Weight properties: @samp{Bold}, @samp{Book}, @samp{Light},
645 @samp{Medium}, @samp{Semi-bold}, or @samp{Ultra-light}. If omitted,
646 @samp{Medium} weight is implied.
647 @item
648 Width properties: @samp{Semi-Condensed} or @samp{Condensed}. If
649 omitted, a default width is used.
650 @end itemize
651
652 @noindent
653 Here are some examples of GTK font patterns:
654
655 @example
656 Monospace 12
657 Monospace Bold Italic 12
658 @end example
659
660 @cindex XLFD
661 @cindex X Logical Font Description
662 The third way to specify a font is to use an @dfn{XLFD} (@dfn{X
663 Logical Font Description}). This is the traditional method for
664 specifying fonts under X@. Each XLFD consists of fourteen words or
665 numbers, separated by dashes, like this:
666
667 @example
668 -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1
669 @end example
670
671 @noindent
672 A wildcard character (@samp{*}) in an XLFD matches any sequence of
673 characters (including none), and @samp{?} matches any single
674 character. However, matching is implementation-dependent, and can be
675 inaccurate when wildcards match dashes in a long name. For reliable
676 results, supply all 14 dashes and use wildcards only within a field.
677 Case is insignificant in an XLFD@. The syntax for an XLFD is as
678 follows:
679
680 @example
681 -@var{maker}-@var{family}-@var{weight}-@var{slant}-@var{widthtype}-@var{style}@dots{}
682 @dots{}-@var{pixels}-@var{height}-@var{horiz}-@var{vert}-@var{spacing}-@var{width}-@var{registry}-@var{encoding}
683 @end example
684
685 @noindent
686 The entries have the following meanings:
687
688 @table @var
689 @item maker
690 The name of the font manufacturer.
691 @item family
692 The name of the font family (e.g., @samp{courier}).
693 @item weight
694 The font weight---normally either @samp{bold}, @samp{medium} or
695 @samp{light}. Some font names support other values.
696 @item slant
697 The font slant---normally @samp{r} (roman), @samp{i} (italic),
698 @samp{o} (oblique), @samp{ri} (reverse italic), or @samp{ot} (other).
699 Some font names support other values.
700 @item widthtype
701 The font width---normally @samp{normal}, @samp{condensed},
702 @samp{semicondensed}, or @samp{extended}. Some font names support
703 other values.
704 @item style
705 An optional additional style name. Usually it is empty---most XLFDs
706 have two hyphens in a row at this point.
707 @item pixels
708 The font height, in pixels.
709 @item height
710 The font height on the screen, measured in tenths of a printer's
711 point. This is the point size of the font, times ten. For a given
712 vertical resolution, @var{height} and @var{pixels} are proportional;
713 therefore, it is common to specify just one of them and use @samp{*}
714 for the other.
715 @item horiz
716 The horizontal resolution, in pixels per inch, of the screen for which
717 the font is intended.
718 @item vert
719 The vertical resolution, in pixels per inch, of the screen for which
720 the font is intended. Normally the resolution of the fonts on your
721 system is the right value for your screen; therefore, you normally
722 specify @samp{*} for this and @var{horiz}.
723 @item spacing
724 This is @samp{m} (monospace), @samp{p} (proportional) or @samp{c}
725 (character cell).
726 @item width
727 The average character width, in pixels, multiplied by ten.
728 @item registry
729 @itemx encoding
730 The X font character set that the font depicts. (X font character
731 sets are not the same as Emacs character sets, but they are similar.)
732 You can use the @command{xfontsel} program to check which choices you
733 have. Normally you should use @samp{iso8859} for @var{registry} and
734 @samp{1} for @var{encoding}.
735 @end table
736
737 The fourth and final method of specifying a font is to use a ``font
738 nickname''. Certain fonts have shorter nicknames, which you can use
739 instead of a normal font specification. For instance, @samp{6x13} is
740 equivalent to
741
742 @example
743 -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1
744 @end example
745
746 @cindex client-side fonts
747 @cindex server-side fonts
748 On X, Emacs recognizes two types of fonts: @dfn{client-side} fonts,
749 which are provided by the Xft and Fontconfig libraries, and
750 @dfn{server-side} fonts, which are provided by the X server itself.
751 Most client-side fonts support advanced font features such as
752 antialiasing and subpixel hinting, while server-side fonts do not.
753 Fontconfig and GTK patterns match only client-side fonts.
754
755 @cindex listing system fonts
756 You will probably want to use a fixed-width default font---that is,
757 a font in which all characters have the same width. For Xft and
758 Fontconfig fonts, you can use the @command{fc-list} command to list
759 the available fixed-width fonts, like this:
760
761 @example
762 fc-list :spacing=mono fc-list :spacing=charcell
763 @end example
764
765 @noindent
766 For server-side X fonts, you can use the @command{xlsfonts} program to
767 list the available fixed-width fonts, like this:
768
769 @example
770 xlsfonts -fn '*x*' | egrep "^[0-9]+x[0-9]+"
771 xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-m*'
772 xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-c*'
773 @end example
774
775 @noindent
776 Any font with @samp{m} or @samp{c} in the @var{spacing} field of the
777 XLFD is a fixed-width font. To see what a particular font looks like,
778 use the @command{xfd} command. For example:
779
780 @example
781 xfd -fn 6x13
782 @end example
783
784 @noindent
785 displays the entire font @samp{6x13}.
786
787 While running Emacs, you can also set the font of a specific kind of
788 text (@pxref{Faces}), or a particular frame (@pxref{Frame
789 Parameters}).
790
791 @node Speedbar
792 @section Speedbar Frames
793 @cindex speedbar
794
795 @cindex attached frame (of speedbar)
796 The @dfn{speedbar} is a special frame for conveniently navigating in
797 or operating on another frame. The speedbar, when it exists, is
798 always associated with a specific frame, called its @dfn{attached
799 frame}; all speedbar operations act on that frame.
800
801 Type @kbd{M-x speedbar} to create the speedbar and associate it with
802 the current frame. To dismiss the speedbar, type @kbd{M-x speedbar}
803 again, or select the speedbar and type @kbd{q}. (You can also delete
804 the speedbar frame like any other Emacs frame.) If you wish to
805 associate the speedbar with a different frame, dismiss it and call
806 @kbd{M-x speedbar} from that frame.
807
808 The speedbar can operate in various modes. Its default mode is
809 @dfn{File Display} mode, which shows the files in the current
810 directory of the selected window of the attached frame, one file per
811 line. Clicking on a file name visits that file in the selected window
812 of the attached frame, and clicking on a directory name shows that
813 directory in the speedbar (@pxref{Mouse References}). Each line also
814 has a box, @samp{[+]} or @samp{<+>}, that you can click on to
815 @dfn{expand} the contents of that item. Expanding a directory adds
816 the contents of that directory to the speedbar display, underneath the
817 directory's own line. Expanding an ordinary file adds a list of the
818 tags in that file to the speedbar display; you can click on a tag name
819 to jump to that tag in the selected window of the attached frame.
820 When a file or directory is expanded, the @samp{[+]} changes to
821 @samp{[-]}; you can click on that box to @dfn{contract} the item,
822 hiding its contents.
823
824 You navigate through the speedbar using the keyboard, too. Typing
825 @key{RET} while point is on a line in the speedbar is equivalent to
826 clicking the item on the current line, and @key{SPC} expands or
827 contracts the item. @kbd{U} displays the parent directory of the
828 current directory. To copy, delete, or rename the file on the current
829 line, type @kbd{C}, @kbd{D}, and @kbd{R} respectively. To create a
830 new directory, type @kbd{M}.
831
832 Another general-purpose speedbar mode is @dfn{Buffer Display} mode;
833 in this mode, the speedbar displays a list of Emacs buffers. To
834 switch to this mode, type @kbd{b} in the speedbar. To return to File
835 Display mode, type @kbd{f}. You can also change the display mode by
836 clicking @kbd{mouse-3} anywhere in the speedbar window (or
837 @kbd{mouse-1} on the mode-line) and selecting @samp{Displays} in the
838 pop-up menu.
839
840 Some major modes, including Rmail mode, Info, and GUD, have
841 specialized ways of putting useful items into the speedbar for you to
842 select. For example, in Rmail mode, the speedbar shows a list of Rmail
843 files, and lets you move the current message to another Rmail file by
844 clicking on its @samp{<M>} box.
845
846 For more details on using and programming the speedbar, @xref{Top,
847 Speedbar,,speedbar, Speedbar Manual}.
848
849 @node Multiple Displays
850 @section Multiple Displays
851 @cindex multiple displays
852
853 A single Emacs can talk to more than one X display. Initially, Emacs
854 uses just one display---the one specified with the @env{DISPLAY}
855 environment variable or with the @samp{--display} option (@pxref{Initial
856 Options}). To connect to another display, use the command
857 @code{make-frame-on-display}:
858
859 @findex make-frame-on-display
860 @table @kbd
861 @item M-x make-frame-on-display @key{RET} @var{display} @key{RET}
862 Create a new frame on display @var{display}.
863 @end table
864
865 A single X server can handle more than one screen. When you open
866 frames on two screens belonging to one server, Emacs knows they share a
867 single keyboard, and it treats all the commands arriving from these
868 screens as a single stream of input.
869
870 When you open frames on different X servers, Emacs makes a separate
871 input stream for each server. Each server also has its own selected
872 frame. The commands you enter with a particular X server apply to
873 that server's selected frame.
874
875 @node Frame Parameters
876 @section Frame Parameters
877 @cindex default-frame-alist
878
879 You can control the default appearance and behavior of all frames by
880 specifying a default list of @dfn{frame parameters} in the variable
881 @code{default-frame-alist}. Its value should be a list of entries,
882 each specifying a parameter name and a value for that parameter.
883 These entries take effect whenever Emacs creates a new frame,
884 including the initial frame.
885
886 @cindex frame size, specifying default
887 For example, you can add the following lines to your init file
888 (@pxref{Init File}) to set the default frame width to 90 character
889 columns, the default frame height to 40 character rows, and the
890 default font to @samp{Monospace-10}:
891
892 @example
893 (add-to-list 'default-frame-alist '(width . 90))
894 (add-to-list 'default-frame-alist '(height . 40))
895 (add-to-list 'default-frame-alist '(font . "Monospace-10"))
896 @end example
897
898 For a list of frame parameters and their effects, see @ref{Frame
899 Parameters,,, elisp, The Emacs Lisp Reference Manual}.
900
901 @cindex initial-frame-alist
902 You can also specify a list of frame parameters which apply to just
903 the initial frame, by customizing the variable
904 @code{initial-frame-alist}.
905
906 If Emacs is compiled to use an X toolkit, frame parameters that
907 specify colors and fonts don't affect menus and the menu bar, since
908 those are drawn by the toolkit and not directly by Emacs.
909
910 @node Scroll Bars
911 @section Scroll Bars
912 @cindex Scroll Bar mode
913 @cindex mode, Scroll Bar
914 @cindex Vertical Scroll Bar
915
916 On graphical displays, there is a @dfn{vertical scroll bar} on the
917 side of each Emacs window. Clicking @kbd{Mouse-1} on the scroll bar's
918 up and down buttons scrolls the window by one line at a time. Clicking
919 @kbd{Mouse-1} above or below the scroll bar's inner box scrolls the
920 window by nearly the entire height of the window, like @kbd{M-v} and
921 @kbd{C-v} respectively (@pxref{Moving Point}). Dragging the inner box
922 scrolls continuously.
923
924 If Emacs is compiled on the X Window System without X toolkit
925 support, the scroll bar behaves differently. Clicking @kbd{Mouse-1}
926 anywhere on the scroll bar scrolls forward like @kbd{C-v}, while
927 @kbd{Mouse-3} scrolls backward like @kbd{M-v}. Clicking @kbd{Mouse-2}
928 in the scroll bar lets you drag the inner box up and down.
929
930 @findex scroll-bar-mode
931 @findex toggle-scroll-bar
932 To toggle the use of vertical scroll bars, type @kbd{M-x
933 scroll-bar-mode}. This command applies to all frames, including frames
934 yet to be created. To toggle vertical scroll bars for just the selected
935 frame, use the command @kbd{M-x toggle-scroll-bar}.
936
937 @vindex scroll-bar-mode
938 To control the use of vertical scroll bars at startup, customize the
939 variable @code{scroll-bar-mode}. Its value should be either
940 @code{right} (put scroll bars on the right side of windows), @code{left}
941 (put them on the left), or @code{nil} (disable vertical scroll bars).
942 By default, Emacs puts scroll bars on the right if it was compiled with
943 GTK+ support on the X Window System, and on MS-Windows or Mac OS; Emacs
944 puts scroll bars on the left if compiled on the X Window System without
945 GTK+ support (following the old convention for X applications).
946
947 @vindex scroll-bar-width
948 @cindex width of the vertical scroll bar
949 You can also use the X resource @samp{verticalScrollBars} to enable
950 or disable the scroll bars (@pxref{Resources}). To control the scroll
951 bar width, change the @code{scroll-bar-width} frame parameter
952 (@pxref{Frame Parameters,,, elisp, The Emacs Lisp Reference Manual}).
953
954 @vindex scroll-bar-adjust-thumb-portion
955 @cindex overscrolling
956 If you're using Emacs on X (with GTK+ or Motif), you can customize the
957 variable @code{scroll-bar-adjust-thumb-portion} to control
958 @dfn{overscrolling} of the scroll bar, i.e. dragging the thumb down even
959 when the end of the buffer is visible. If its value is
960 non-@code{nil}, the scroll bar can be dragged downwards even if the
961 end of the buffer is shown; if @code{nil}, the thumb will be at the
962 bottom when the end of the buffer is shown. You can not over-scroll
963 when the entire buffer is visible.
964
965 @cindex scroll-bar face
966 The visual appearance of the scroll bars is controlled by the
967 @code{scroll-bar} face.
968
969 @cindex Horizontal Scroll Bar
970 @cindex Horizontal Scroll Bar mode
971 On graphical displays with toolkit support, Emacs may also supply a
972 @dfn{horizontal scroll bar} on the bottom of each window. Clicking
973 @kbd{Mouse-1} on the that scroll bar's left and right buttons scrolls
974 the window horizontally by one column at a time. Clicking @kbd{Mouse-1}
975 on the left or right of the scroll bar's inner box scrolls the window by
976 four columns. Dragging the inner box scrolls the window continuously.
977
978 Note that such horizontal scrolling can make the window's position of
979 point disappear on the left or the right. Typing a character to insert
980 text or moving point with a keyboard command will usually bring it back
981 into view.
982
983 @findex horizontal-scroll-bar-mode
984 To toggle the use of horizontal scroll bars, type @kbd{M-x
985 horizontal-scroll-bar-mode}. This command applies to all frames,
986 including frames yet to be created. To toggle horizontal scroll bars
987 for just the selected frame, use the command @kbd{M-x
988 toggle-horizontal-scroll-bar}.
989
990 @vindex horizontal-scroll-bar-mode
991 To control the use of horizontal scroll bars at startup, customize the
992 variable @code{horizontal-scroll-bar-mode}.
993
994 @vindex scroll-bar-height
995 @cindex height of the horizontal scroll bar
996 You can also use the X resource @samp{horizontalScrollBars} to enable
997 or disable horizontal scroll bars (@pxref{Resources}). To control the
998 scroll bar height, change the @code{scroll-bar-height} frame parameter
999 (@pxref{Frame Parameters,,, elisp, The Emacs Lisp Reference Manual}).
1000
1001 @node Drag and Drop
1002 @section Drag and Drop
1003 @cindex drag and drop
1004
1005 In most graphical desktop environments, Emacs has basic support for
1006 @dfn{drag and drop} operations. For instance, dropping text onto an
1007 Emacs frame inserts the text where it is dropped. Dropping a file
1008 onto an Emacs frame visits that file. As a special case, dropping the
1009 file on a Dired buffer moves or copies the file (according to the
1010 conventions of the application it came from) into the directory
1011 displayed in that buffer.
1012
1013 @vindex dnd-open-file-other-window
1014 Dropping a file normally visits it in the window you drop it on. If
1015 you prefer to visit the file in a new window in such cases, customize
1016 the variable @code{dnd-open-file-other-window}.
1017
1018 The XDND and Motif drag and drop protocols, and the old KDE 1.x
1019 protocol, are currently supported.
1020
1021 @node Menu Bars
1022 @section Menu Bars
1023 @cindex Menu Bar mode
1024 @cindex mode, Menu Bar
1025 @findex menu-bar-mode
1026 @vindex menu-bar-mode
1027
1028 You can toggle the use of menu bars with @kbd{M-x menu-bar-mode}.
1029 With no argument, this command toggles Menu Bar mode, a global minor
1030 mode. With an argument, the command turns Menu Bar mode on if the
1031 argument is positive, off if the argument is not positive. To control
1032 the use of menu bars at startup, customize the variable
1033 @code{menu-bar-mode}.
1034
1035 @kindex C-Mouse-3 @r{(when menu bar is disabled)}
1036 Expert users often turn off the menu bar, especially on text
1037 terminals, where this makes one additional line available for text.
1038 If the menu bar is off, you can still pop up a menu of its contents
1039 with @kbd{C-Mouse-3} on a display which supports pop-up menus.
1040 @xref{Menu Mouse Clicks}.
1041
1042 @xref{Menu Bar}, for information on how to invoke commands with the
1043 menu bar. @xref{X Resources}, for how to customize the menu bar
1044 menus' visual appearance.
1045
1046 @node Tool Bars
1047 @section Tool Bars
1048 @cindex Tool Bar mode
1049 @cindex mode, Tool Bar
1050 @cindex icons, toolbar
1051
1052 On graphical displays, Emacs puts a @dfn{tool bar} at the top of
1053 each frame, just below the menu bar. This is a row of icons which you
1054 can click on with the mouse to invoke various commands.
1055
1056 The global (default) tool bar contains general commands. Some major
1057 modes define their own tool bars; whenever a buffer with such a major
1058 mode is current, the mode's tool bar replaces the global tool bar.
1059
1060 @findex tool-bar-mode
1061 @vindex tool-bar-mode
1062 To toggle the use of tool bars, type @kbd{M-x tool-bar-mode}. This
1063 command applies to all frames, including frames yet to be created. To
1064 control the use of tool bars at startup, customize the variable
1065 @code{tool-bar-mode}.
1066
1067 @vindex tool-bar-style
1068 @cindex Tool Bar style
1069 When Emacs is compiled with GTK+ support, each tool bar item can
1070 consist of an image, or a text label, or both. By default, Emacs
1071 follows the Gnome desktop's tool bar style setting; if none is
1072 defined, it displays tool bar items as just images. To impose a
1073 specific tool bar style, customize the variable @code{tool-bar-style}.
1074
1075 @cindex Tool Bar position
1076 You can also control the placement of the tool bar for the GTK+ tool
1077 bar with the frame parameter @code{tool-bar-position}. @xref{Frame
1078 Parameters,,, elisp, The Emacs Lisp Reference Manual}.
1079
1080 @node Dialog Boxes
1081 @section Using Dialog Boxes
1082 @cindex dialog boxes
1083
1084 @vindex use-dialog-box
1085 A dialog box is a special kind of menu for asking you a yes-or-no
1086 question or some other special question. Many Emacs commands use a
1087 dialog box to ask a yes-or-no question, if you used the mouse to
1088 invoke the command that led to the question.
1089
1090 To disable the use of dialog boxes, change the variable
1091 @code{use-dialog-box} to @code{nil}. In that case, Emacs always
1092 performs yes-or-no prompts using the echo area and keyboard input.
1093 This variable also controls whether to use file selection windows (but
1094 those are not supported on all platforms).
1095
1096 @vindex use-file-dialog
1097 @cindex file selection dialog, how to disable
1098 A file selection window is a special kind of dialog box for asking
1099 for file names. You can customize the variable @code{use-file-dialog}
1100 to suppress the use of file selection windows, even if you still want
1101 other kinds of dialogs. This variable has no effect if you have
1102 suppressed all dialog boxes with the variable @code{use-dialog-box}.
1103
1104 @vindex x-gtk-show-hidden-files
1105 @vindex x-gtk-file-dialog-help-text
1106 @cindex hidden files, in GTK+ file chooser
1107 @cindex help text, in GTK+ file chooser
1108 When Emacs is compiled with GTK+ support, it uses the GTK+ ``file
1109 chooser'' dialog. Emacs adds an additional toggle button to this
1110 dialog, which you can use to enable or disable the display of hidden
1111 files (files starting with a dot) in that dialog. If you want this
1112 toggle to be activated by default, change the variable
1113 @code{x-gtk-show-hidden-files} to @code{t}. In addition, Emacs adds
1114 help text to the GTK+ file chooser dialog; to disable this help text,
1115 change the variable @code{x-gtk-file-dialog-help-text} to @code{nil}.
1116
1117 @node Tooltips
1118 @section Tooltips
1119 @cindex tooltips
1120
1121 @dfn{Tooltips} are small windows that display text information at
1122 the current mouse position. They activate when there is a pause in
1123 mouse movement over some significant piece of text in a window, or the
1124 mode line, or some other part of the Emacs frame such as a tool bar
1125 button or menu item.
1126
1127 @findex tooltip-mode
1128 You can toggle the use of tooltips with the command @kbd{M-x
1129 tooltip-mode}. When Tooltip mode is disabled, the help text is
1130 displayed in the echo area instead. To control the use of tooltips at
1131 startup, customize the variable @code{tooltip-mode}.
1132
1133 @vindex tooltip-delay
1134 The variables @code{tooltip-delay} specifies how long Emacs should
1135 wait before displaying a tooltip. For additional customization
1136 options for displaying tooltips, use @kbd{M-x customize-group
1137 @key{RET} tooltip @key{RET}}.
1138
1139 @vindex x-gtk-use-system-tooltips
1140 If Emacs is built with GTK+ support, it displays tooltips via GTK+,
1141 using the default appearance of GTK+ tooltips. To disable this,
1142 change the variable @code{x-gtk-use-system-tooltips} to @code{nil}.
1143 If you do this, or if Emacs is built without GTK+ support, most
1144 attributes of the tooltip text are specified by the @code{tooltip}
1145 face, and by X resources (@pxref{X Resources}).
1146
1147 @dfn{GUD tooltips} are special tooltips that show the values of
1148 variables when debugging a program with GUD@. @xref{Debugger
1149 Operation}.
1150
1151 @node Mouse Avoidance
1152 @section Mouse Avoidance
1153 @cindex avoiding mouse in the way of your typing
1154 @cindex mouse avoidance
1155
1156 On graphical terminals, the mouse pointer may obscure the text in
1157 the Emacs frame. Emacs provides two methods to avoid this problem.
1158
1159 @vindex make-pointer-invisible
1160 Firstly, Emacs hides the mouse pointer each time you type a
1161 self-inserting character, if the pointer lies inside an Emacs frame;
1162 moving the mouse pointer makes it visible again. To disable this
1163 feature, set the variable @code{make-pointer-invisible} to @code{nil}.
1164
1165 @vindex mouse-avoidance-mode
1166 Secondly, you can use Mouse Avoidance mode, a minor mode, to keep
1167 the mouse pointer away from point. To use Mouse Avoidance mode,
1168 customize the variable @code{mouse-avoidance-mode}. You can set this
1169 to various values to move the mouse in several ways:
1170
1171 @table @code
1172 @item banish
1173 Move the pointer to a corner of the frame on any key-press. You can
1174 customize the variable @code{mouse-avoidance-banish-position} to
1175 specify where the pointer goes when it is banished.
1176 @item exile
1177 Banish the pointer only if the cursor gets too close, and allow it to
1178 return once the cursor is out of the way.
1179 @item jump
1180 If the cursor gets too close to the pointer, displace the pointer by a
1181 random distance and direction.
1182 @item animate
1183 As @code{jump}, but shows steps along the way for illusion of motion.
1184 @item cat-and-mouse
1185 The same as @code{animate}.
1186 @item proteus
1187 As @code{animate}, but changes the shape of the mouse pointer too.
1188 @end table
1189
1190 @findex mouse-avoidance-mode
1191 You can also use the command @kbd{M-x mouse-avoidance-mode} to enable
1192 the mode. Whenever Mouse Avoidance mode moves the mouse, it also
1193 raises the frame.
1194
1195 @node Non-Window Terminals
1196 @section Non-Window Terminals
1197 @cindex text terminal
1198
1199 On a text terminal, Emacs can display only one Emacs frame at a
1200 time. However, you can still create multiple Emacs frames, and switch
1201 between them. Switching frames on these terminals is much like
1202 switching between different window configurations.
1203
1204 Use @kbd{C-x 5 2} to create a new frame and switch to it; use @kbd{C-x
1205 5 o} to cycle through the existing frames; use @kbd{C-x 5 0} to delete
1206 the current frame.
1207
1208 Each frame has a number to distinguish it. If your terminal can
1209 display only one frame at a time, the selected frame's number @var{n}
1210 appears near the beginning of the mode line, in the form
1211 @samp{F@var{n}}.
1212
1213 @findex set-frame-name
1214 @findex select-frame-by-name
1215 @samp{F@var{n}} is in fact the frame's initial name. You can give
1216 frames more meaningful names if you wish, and you can select a frame
1217 by its name. Use the command @kbd{M-x set-frame-name @key{RET}
1218 @var{name} @key{RET}} to specify a new name for the selected frame,
1219 and use @kbd{M-x select-frame-by-name @key{RET} @var{name} @key{RET}}
1220 to select a frame according to its name. The name you specify appears
1221 in the mode line when the frame is selected.
1222
1223 @node Text-Only Mouse
1224 @section Using a Mouse in Text Terminals
1225 @cindex mouse support
1226 @cindex terminal emulators, mouse support
1227
1228 Some text terminals support mouse clicks in the terminal window.
1229
1230 @cindex xterm
1231 In a terminal emulator which is compatible with @command{xterm}, you
1232 can use @kbd{M-x xterm-mouse-mode} to give Emacs control over simple
1233 uses of the mouse---basically, only non-modified single clicks are
1234 supported. The normal @command{xterm} mouse functionality for such
1235 clicks is still available by holding down the @kbd{SHIFT} key when you
1236 press the mouse button. Xterm Mouse mode is a global minor mode
1237 (@pxref{Minor Modes}). Repeating the command turns the mode off
1238 again.
1239
1240 @findex gpm-mouse-mode
1241 In the console on GNU/Linux, you can use @kbd{M-x gpm-mouse-mode} to
1242 enable mouse support. You must have the gpm server installed and
1243 running on your system in order for this to work.
1244
1245 @iftex
1246 @xref{MS-DOS Mouse,,,emacs-xtra,Specialized Emacs Features},
1247 @end iftex
1248 @ifnottex
1249 @xref{MS-DOS Mouse},
1250 @end ifnottex
1251 for information about mouse support on MS-DOS.