Add 2012 to FSF copyright years for Emacs files (do not merge to trunk)
[emacs.git] / doc / emacs / frames.texi
blobe77f93e39649b6e706b323d96908feff2caccf9e
1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1999, 2000,
3 @c   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
4 @c   Free Software Foundation, Inc.
5 @c See file emacs.texi for copying conditions.
6 @node Frames, International, Windows, Top
7 @chapter Frames and Graphical Displays
8 @cindex frames
10   When using a graphical display, you can create multiple system-level
11 ``windows'' in a single Emacs session.  We refer to these system-level
12 windows as @dfn{frames}.  A frame initially contains a single Emacs
13 window; however, you can subdivide this Emacs window into smaller
14 windows, all fitting into the same frame.  Each frame normally
15 contains its own echo area and minibuffer.
17   To avoid confusion, we reserve the word ``window'' for the
18 subdivisions that Emacs implements, and never use it to refer to a
19 frame.
21   Any editing you do in one frame affects the other frames.  For
22 instance, if you put text in the kill ring in one frame, you can yank
23 it in another frame.  If you exit Emacs through @kbd{C-x C-c} in one
24 frame, it terminates all the frames.  To delete just one frame, use
25 @kbd{C-x 5 0} (that is zero, not @kbd{o}).
27   Emacs compiled for MS-DOS emulates some windowing functionality,
28 so that you can use many of the features described in this chapter.
29 @iftex
30 @xref{MS-DOS Mouse,,,emacs-xtra,Specialized Emacs Features}.
31 @end iftex
32 @ifnottex
33 @xref{MS-DOS Mouse}.
34 @end ifnottex
36 @menu
37 * Cut and Paste::       Mouse commands for cut and paste.
38 * Mouse References::    Using the mouse to select an item from a list.
39 * Menu Mouse Clicks::   Mouse clicks that bring up menus.
40 * Mode Line Mouse::     Mouse clicks on the mode line.
41 * Creating Frames::     Creating additional Emacs frames with various contents.
42 * Frame Commands::      Iconifying, deleting, and switching frames.
43 * Fonts::               Changing the frame font.
44 * Speedbar::            How to make and use a speedbar frame.
45 * Multiple Displays::   How one Emacs job can talk to several displays.
46 * Special Buffer Frames::  You can make certain buffers have their own frames.
47 * Frame Parameters::    Changing the colors and other modes of frames.
48 * Scroll Bars::         How to enable and disable scroll bars; how to use them.
49 * Wheeled Mice::        Using mouse wheels for scrolling.
50 * Drag and Drop::       Using drag and drop to open files and insert text.
51 * Menu Bars::           Enabling and disabling the menu bar.
52 * Tool Bars::           Enabling and disabling the tool bar.
53 * Dialog Boxes::        Controlling use of dialog boxes.
54 * Tooltips::            Displaying information at the current mouse position.
55 * Mouse Avoidance::     Preventing the mouse pointer from obscuring text.
56 * Non-Window Terminals::  Multiple frames on terminals that show only one.
57 * Text-Only Mouse::     Using the mouse in text-only terminals.
58 @end menu
60 @node Cut and Paste
61 @section Cutting and Pasting on Graphical Displays
63   This section describes commands for selecting a region, cutting, and
64 pasting using the mouse.
66 @menu
67 * Mouse Commands::      Moving, cutting, and pasting, with the mouse.
68 * Word and Line Mouse:: Mouse commands for selecting whole words or lines.
69 * Cut/Paste Other App:: Transfering text between Emacs and other apps.
70 * Secondary Selection:: Cutting without altering point and mark.
71 * Clipboard::           Using the clipboard for selections.
72 @end menu
74 @node Mouse Commands
75 @subsection Mouse Commands for Editing
76 @cindex mouse buttons (what they do)
78 @kindex Mouse-1
79 @kindex Mouse-2
80 @kindex Mouse-3
81 @table @kbd
82 @item Mouse-1
83 Move point to where you click (@code{mouse-set-point}).
85 @item Drag-Mouse-1
86 Activate the region around the text selected by dragging, and copy it
87 to the kill ring (@code{mouse-set-region}).
89 @item Mouse-2
90 Yank the last killed text at the click position
91 (@code{mouse-yank-at-click}).
93 @item Mouse-3
94 If the region is active, move the nearer end of the region to the
95 click position; otherwise, set mark at the current value of point and
96 point at the click position.  Save the resulting region in the kill
97 ring; on a second click, kill it (@code{mouse-save-then-kill}).
98 @end table
100 @findex mouse-set-point
101   The most basic mouse command is @code{mouse-set-point}, which is
102 called by clicking with the left mouse button, @kbd{Mouse-1}, in the
103 text area of a window.  This moves point to the position where you
104 clicked.
106 @vindex x-mouse-click-focus-ignore-position
107   Normally, Emacs does not distinguish between ordinary mouse clicks
108 and clicks that select a frame.  When you click on a frame to select
109 it, that also changes the selected window and cursor position
110 according to the mouse click position.  On the X window system, you
111 can change this behavior by setting the variable
112 @code{x-mouse-click-focus-ignore-position} to @code{t}.  Then the
113 first click selects the frame, but does not affect the selected window
114 or cursor position.  If you click again in the same place, that click
115 will be in the selected frame, so it will change the window or cursor
116 position.
118 @findex mouse-set-region
119 @vindex mouse-drag-copy-region
120   Holding down @kbd{Mouse-1} and ``dragging'' the mouse over a stretch
121 of text activates the region around that text
122 (@code{mouse-set-region}).  @xref{Mark}.  Emacs places the mark where
123 you started holding down the mouse button, and point where you release
124 it.  In addition, the region is copied into the kill ring (@pxref{Kill
125 Ring}).  If you don't want Emacs to copy the region, change the
126 variable @code{mouse-drag-copy-region} to @code{nil}.
128 @vindex mouse-scroll-min-lines
129   If you move the mouse off the top or bottom of the window while
130 dragging, the window scrolls at a steady rate until you move the mouse
131 back into the window.  This way, you can select regions that don't fit
132 entirely on the screen.  The number of lines scrolled per step depends
133 on how far away from the window edge the mouse has gone; the variable
134 @code{mouse-scroll-min-lines} specifies a minimum step size.
136 @findex mouse-yank-at-click
137 @vindex mouse-yank-at-point
138   Clicking with the middle mouse button, @kbd{Mouse-2}, moves point to
139 the position where you clicked and performs a yank
140 (@code{mouse-yank-at-click}).  @xref{Yanking}.  If you change the
141 variable @code{mouse-yank-at-point} to a non-@code{nil} value,
142 @kbd{Mouse-2} does not move point.  Then it does not matter where you
143 click, or even which of the frame's windows you click on; the yank
144 occurs at the existing point.  This variable also affects yanking the
145 primary and secondary selections (@pxref{Cut/Paste Other App}).
147 @findex mouse-save-then-kill
148   Clicking with the right mouse button, @kbd{Mouse-3}, runs the
149 command @code{mouse-save-then-kill}.  This performs several actions
150 depending on where you click and the status of the region:
152 @itemize @bullet
153 @item
154 If no region is active, clicking @kbd{Mouse-3} activates the region,
155 placing the mark where point was and point at the clicked position.
156 In addition, the text in the region is copied to the kill ring.
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.
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, then adjusting the region with @kbd{Mouse-3} also
168 proceeds by entire words or lines.
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
180   Whenever you set the region using any of the mouse commands
181 described above, the mark will be deactivated by any subsequent
182 unshifted cursor motion command, in addition to the usual ways of
183 deactivating the mark.  @xref{Shift Selection}.  While the region
184 remains active, typing @key{Backspace} or @key{Delete} deletes the
185 text in that region and deactivates the mark; this behavior follows a
186 convention established by other graphical programs, and it does
187 @emph{not} apply when you set the region any other way, including
188 shift-selection (@pxref{Shift Selection}).
190 @cindex Delete Selection mode
191 @cindex mode, Delete Selection
192 @findex delete-selection-mode
193   Many graphical applications also follow the convention that
194 insertion while text is selected deletes the selected text.  You can
195 make Emacs behave this way by enabling Delete Selection mode.
196 @xref{Using Region}.
198 @node Word and Line Mouse
199 @subsection Mouse Commands for Words and Lines
201   These variants of @kbd{Mouse-1} select entire words or lines at a
202 time.  Emacs activates the region around the selected text, which is
203 also copied to the kill ring.
205 @table @kbd
206 @item Double-Mouse-1
207 Select the text around the word which you click on.
209 Double-clicking on a character with ``symbol'' syntax (such as
210 underscore, in C mode) selects the symbol surrounding that character.
211 Double-clicking on a character with open- or close-parenthesis syntax
212 selects the parenthetical grouping which that character starts or
213 ends.  Double-clicking on a character with string-delimiter syntax
214 (such as a singlequote or doublequote in C) selects the string
215 constant (Emacs uses heuristics to figure out whether that character
216 is the beginning or the end of it).
218 @item Double-Drag-Mouse-1
219 Select the text you drag across, in the form of whole words.
221 @item Triple-Mouse-1
222 Select the line you click on.
224 @item Triple-Drag-Mouse-1
225 Select the text you drag across, in the form of whole lines.
226 @end table
228 @node Cut/Paste Other App
229 @subsection Cut and Paste with Other Window Applications
231 @cindex X cutting and pasting
232 @cindex X selection
233 @cindex primary selection
234 @cindex selection, primary
235   When running Emacs under the X window system, you can easily
236 transfer text between Emacs and other X applications using the
237 @dfn{primary selection} (also called the @dfn{X selection}).  This is
238 @emph{not} the same thing as the @dfn{clipboard}, which is a separate
239 facility used on desktop environments such as Gnome, and on operating
240 systems such as Microsoft Windows (@pxref{Clipboard}).
242   Under X, whenever you select some text in Emacs by dragging or
243 clicking the mouse (@pxref{Mouse Commands}), it is also saved in the
244 primary selection.  You can then @dfn{paste} that text into any other
245 X application, usually by clicking @kbd{Mouse-2} in that application.
246 Unlike the Emacs kill ring (@pxref{Kill Ring}), the primary selection
247 has no ``memory'': each time you save something in the primary
248 selection, either in Emacs or in another X application, the previous
249 contents of the primary selection are lost.
251 @cindex MS-Windows, and primary selection
252   MS-Windows provides no primary selection, but Emacs emulates it
253 within a single Emacs session, by storing the selected text
254 internally.  Therefore, all the features and commands related to the
255 primary selection work on Windows as they do on X, for cutting and
256 pasting within the same session, but not across Emacs sessions or with
257 other applications.
259   Whenever you kill some text using a command such as @kbd{C-w}
260 (@code{kill-region}), or copy it into the kill ring using a command
261 such as @kbd{M-w} (@code{kill-ring-save}), that text is also saved in
262 the primary selection.  @xref{Killing}.
264 @vindex select-active-regions
265   If you set the region using the keyboard---for instance, by typing
266 @kbd{C-@key{SPC}} and moving point away from the mark---the text in
267 the region is not normally saved to the primary selection.  However,
268 if you change the variable @code{select-active-regions} to @code{t},
269 the region is saved to the primary selection whenever you activate the
270 mark.  Each change to the region also updates the primary selection.
272 @vindex yank-pop-change-selection
273   If you change @code{yank-pop-change-selection} to @code{t}, rotating
274 the kill ring with @kbd{M-y} (@code{yank-pop}) also saves the new yank
275 to the primary selection (@pxref{Yanking}).
277 @vindex save-interprogram-paste-before-kill
278   If you change @code{save-interprogram-paste-before-kill} to
279 @code{t}, each kill command first saves the existing selection onto
280 the kill ring.  This prevents you from losing the existing selection,
281 at the risk of large memory consumption if other applications generate
282 large selections.
284 @cindex cut buffer
285 @vindex x-cut-buffer-max
286   Whenever Emacs saves some text to the primary selection, it may also
287 save it to the @dfn{cut buffer}.  The cut buffer is an obsolete
288 predecessor to the primary selection; most modern applications do not
289 use it.  Saving text to the cut buffer is slow and inefficient, so
290 Emacs only does it if the text is shorter than the value of
291 @code{x-cut-buffer-max} (20000 characters by default).
293   You can yank the primary selection into Emacs using the usual yank
294 commands, such as @kbd{C-y} (@code{yank}) and @kbd{Mouse-2}
295 (@code{mouse-yank-at-click}).  These commands actually check the
296 primary selection before referring to the kill ring; if no primary
297 selection is available, the kill ring contents are used.  To prevent
298 yank commands from accessing the primary selection, set the variable
299 @code{x-select-enable-primary} to @code{nil}.
301   The standard coding system for the primary selection is
302 @code{compound-text-with-extensions}.  You may find that the pasted
303 text is not what you expected.  In such a case, you can specify
304 another coding system for the selection by typing @kbd{C-x @key{RET}
305 x} or @kbd{C-x @key{RET} X}.  Alternatively, you can request a
306 different data type by modifying the variable
307 @code{x-select-request-type}.  @xref{Communication Coding}.
309 @node Secondary Selection
310 @subsection Secondary Selection
311 @cindex secondary selection
313   In addition to the primary selection, the X Window System provides a
314 second similar facility known as the @dfn{secondary selection}.
315 Nowadays, few X applications make use of the secondary selection, but
316 you can access it using the following Emacs commands:
318 @table @kbd
319 @findex mouse-set-secondary
320 @kindex M-Drag-Mouse-1
321 @item M-Drag-Mouse-1
322 Set the secondary selection, with one end at the place where you press
323 down the button, and the other end at the place where you release it
324 (@code{mouse-set-secondary}).  The selected text is highlighted, using
325 the @code{secondary-selection} face, as you drag.  The window scrolls
326 automatically if you drag the mouse off the top or bottom of the
327 window, just like @code{mouse-set-region} (@pxref{Mouse Commands}).
329 This command does not alter the kill ring.
331 @findex mouse-start-secondary
332 @kindex M-Mouse-1
333 @item M-Mouse-1
334 Set one endpoint for the @dfn{secondary selection}
335 (@code{mouse-start-secondary}).
337 @findex mouse-secondary-save-then-kill
338 @kindex M-Mouse-3
339 @item M-Mouse-3
340 Set the secondary selection, with one end at the position clicked and
341 the other at the position specified with @kbd{M-Mouse-1}
342 (@code{mouse-secondary-save-then-kill}).  This also puts the selected
343 text in the kill ring.  A second @kbd{M-Mouse-3} at the same place
344 kills the secondary selection just made.
346 @findex mouse-yank-secondary
347 @kindex M-Mouse-2
348 @item M-Mouse-2
349 Insert the secondary selection where you click, placing point at the
350 end of the yanked text (@code{mouse-yank-secondary}).
351 @end table
353 Double or triple clicking of @kbd{M-Mouse-1} operates on words and
354 lines, much like @kbd{Mouse-1}.
356 If @code{mouse-yank-at-point} is non-@code{nil}, @kbd{M-Mouse-2} yanks
357 at point.  Then it does not matter precisely where you click, or even
358 which of the frame's windows you click on.  @xref{Mouse Commands}.
360 @node Clipboard
361 @subsection Using the Clipboard
362 @cindex clipboard
364   In desktop environments such as Gnome, and operating systems such as
365 Microsoft Windows and Mac OS X, you can transfer data (usually text)
366 between different applications using the @dfn{clipboard}.  The
367 clipboard is distinct from the primary selection and secondary
368 selection discussed earlier.  You can access the clipboard through the
369 @samp{Edit} menu of the menu bar (@pxref{Menu Bar}).
371 @cindex cut
372 @findex clipboard-kill-region
373   The command @code{clipboard-kill-region}, which is bound to the
374 @code{Cut} menu item, kills the region and saves it in the clipboard.
376 @cindex copy
377 @findex clipboard-kill-ring-save
378   The command @code{clipboard-kill-ring-save}, which is bound to the
379 @code{Copy} menu item, copies the region to the kill ring and saves it
380 in the clipboard.
382 @findex clipboard-yank
383 @cindex paste
384   The @code{Paste} menu item in the Edit menu yanks the contents of
385 the clipboard at point (@code{clipboard-yank}).
387 @vindex x-select-enable-clipboard
388   You can customize the variable @code{x-select-enable-clipboard} to
389 make the Emacs yank functions consult the clipboard before the primary
390 selection, and to make the kill functions to store in the clipboard as
391 well as the primary selection.  Otherwise, these commands do not
392 access the clipboard at all.  Using the clipboard is the default on
393 MS-Windows and Mac OS, but not on other systems.
395 @node Mouse References
396 @section Following References with the Mouse
397 @kindex Mouse-1 @r{(selection)}
398 @kindex Mouse-2 @r{(selection)}
400 @vindex mouse-highlight
401   Some Emacs buffers include @dfn{buttons}.  A button is a piece of
402 text that performs some action when you activate it, such as following
403 a reference.  Usually, a button's text is visually highlighted: it is
404 underlined, or a box is drawn around it.  If you move the mouse over a
405 button, the shape of the mouse cursor changes and the button lights up
406 (if you change the variable @code{mouse-highlight} to @code{nil},
407 Emacs disables this highlighting).
409   You can activate a button by moving point to it and typing
410 @key{RET}, or by clicking either @kbd{Mouse-1} or @kbd{Mouse-2} on the
411 button.  For example, typing @key{RET} or clicking on a file name in a
412 Dired buffer visits that file (@pxref{Dired}).  Doing it on an error
413 message in the @samp{*Compilation*} buffer goes to the source code for
414 that error message (@pxref{Compilation}).  Doing it on a completion in
415 the @samp{*Completions*} buffer chooses that completion
416 (@pxref{Completion}).
418   Although clicking @kbd{Mouse-1} on a button usually activates that
419 button, if you hold the mouse button down for a short period of time
420 before releasing it (specifically, for more than 450 milliseconds),
421 then Emacs moves point where you clicked instead.  This behavior
422 allows you to use the mouse to move point over a button without
423 following it.  Dragging---moving the mouse while it is held down---has
424 its usual behavior of setting the region, even if you drag from or
425 onto a button.
427 @vindex mouse-1-click-in-non-selected-windows
428   Normally, clicking @kbd{Mouse-1} on a button activates the button
429 even if it is in a nonselected window.  If you change the variable
430 @code{mouse-1-click-in-non-selected-windows} to @code{nil}, clicking
431 @kbd{Mouse-1} on a button in an un-selected window moves point to the
432 clicked position and selects that window, without activating the
433 button.
435 @vindex mouse-1-click-follows-link
436   In Emacs versions before 22, only @kbd{Mouse-2} activates buttons
437 and @kbd{Mouse-1} always sets point.  If you prefer this older
438 behavior, set the variable @code{mouse-1-click-follows-link} to
439 @code{nil}.  This variable also lets you choose various other
440 alternatives for following links with the mouse.  Type @kbd{C-h v
441 mouse-1-click-follows-link @key{RET}} for more details.
443 @node Menu Mouse Clicks
444 @section Mouse Clicks for Menus
446   Several mouse clicks with the @key{CTRL} and @key{SHIFT} modifiers
447 bring up menus.
449 @table @kbd
450 @item C-Mouse-1
451 @kindex C-Mouse-1
452 This menu is for selecting a buffer.
454 The MSB (``mouse select buffer'') global minor mode makes this
455 menu smarter and more customizable.  @xref{Buffer Menus}.
457 @item C-Mouse-2
458 @kindex C-Mouse-2
459 This menu is for specifying faces and other text properties
460 for editing formatted text.  @xref{Formatted Text}.
462 @item C-Mouse-3
463 @kindex C-Mouse-3
464 This menu is mode-specific.  For most modes if Menu-bar mode is on,
465 this menu has the same items as all the mode-specific menu-bar menus
466 put together.  Some modes may specify a different menu for this
467 button.@footnote{Some systems use @kbd{Mouse-3} for a mode-specific
468 menu.  We took a survey of users, and found they preferred to keep
469 @kbd{Mouse-3} for selecting and killing regions.  Hence the decision
470 to use @kbd{C-Mouse-3} for this menu.  To use @kbd{Mouse-3} instead,
471 do @code{(global-set-key [mouse-3] 'mouse-popup-menubar-stuff)}.}  If
472 Menu-bar mode is off, this menu contains all the items which would be
473 present in the menu bar---not just the mode-specific ones---so that
474 you can access them without having to display the menu bar.
476 @item S-Mouse-1
477 This menu is for changing the default face within the window's buffer.
478 @xref{Temporary Face Changes}.
479 @end table
481 @node Mode Line Mouse
482 @section Mode Line Mouse Commands
483 @cindex mode line, mouse
484 @cindex mouse on mode line
486   You can use mouse clicks on window mode lines to select and manipulate
487 windows.
489   Some areas of the mode line, such as the buffer name, and major and minor
490 mode names, have their own special mouse bindings.  These areas are
491 highlighted when you hold the mouse over them, and information about
492 the special bindings will be displayed (@pxref{Tooltips}).  This
493 section's commands do not apply in those areas.
495 @table @kbd
496 @item Mouse-1
497 @kindex Mouse-1 @r{(mode line)}
498 @kbd{Mouse-1} on a mode line selects the window it belongs to.  By
499 dragging @kbd{Mouse-1} on the mode line, you can move it, thus
500 changing the height of the windows above and below.  Changing heights
501 with the mouse in this way never deletes windows, it just refuses to
502 make any window smaller than the minimum height.
504 @item Mouse-2
505 @kindex Mouse-2 @r{(mode line)}
506 @kbd{Mouse-2} on a mode line expands that window to fill its frame.
508 @item Mouse-3
509 @kindex Mouse-3 @r{(mode line)}
510 @kbd{Mouse-3} on a mode line deletes the window it belongs to.  If the
511 frame has only one window, it buries the current buffer instead, and
512 switches to another buffer.
514 @item C-Mouse-2
515 @kindex C-mouse-2 @r{(mode line)}
516 @kbd{C-Mouse-2} on a mode line splits the window above
517 horizontally, above the place in the mode line where you click.
518 @end table
520 @kindex C-Mouse-2 @r{(scroll bar)}
521 @kindex Mouse-1 @r{(scroll bar)}
522   Using @kbd{Mouse-1} on the divider between two side-by-side mode
523 lines, you can move the vertical boundary left or right.  Using
524 @kbd{C-Mouse-2} on a scroll bar splits the corresponding window
525 vertically.  @xref{Split Window}.
527 @node Creating Frames
528 @section Creating Frames
529 @cindex creating frames
531 @kindex C-x 5
532   The prefix key @kbd{C-x 5} is analogous to @kbd{C-x 4}, with
533 parallel subcommands.  The difference is that @kbd{C-x 5} commands
534 create a new frame rather than just a new window in the selected frame
535 (@pxref{Pop Up Window}).  If an existing visible or iconified
536 (``minimized'') frame already displays the requested material, these
537 commands use the existing frame, after raising or deiconifying
538 (``un-minimizing'') as necessary.
540   The various @kbd{C-x 5} commands differ in how they find or create the
541 buffer to select:
543 @table @kbd
544 @item C-x 5 2
545 @kindex C-x 5 2
546 @findex make-frame-command
547 Create a new frame (@code{make-frame-command}).
548 @item C-x 5 b @var{bufname} @key{RET}
549 Select buffer @var{bufname} in another frame.  This runs
550 @code{switch-to-buffer-other-frame}.
551 @item C-x 5 f @var{filename} @key{RET}
552 Visit file @var{filename} and select its buffer in another frame.  This
553 runs @code{find-file-other-frame}.  @xref{Visiting}.
554 @item C-x 5 d @var{directory} @key{RET}
555 Select a Dired buffer for directory @var{directory} in another frame.
556 This runs @code{dired-other-frame}.  @xref{Dired}.
557 @item C-x 5 m
558 Start composing a mail message in another frame.  This runs
559 @code{mail-other-frame}.  It is the other-frame variant of @kbd{C-x m}.
560 @xref{Sending Mail}.
561 @item C-x 5 .
562 Find a tag in the current tag table in another frame.  This runs
563 @code{find-tag-other-frame}, the multiple-frame variant of @kbd{M-.}.
564 @xref{Tags}.
565 @item C-x 5 r @var{filename} @key{RET}
566 @kindex C-x 5 r
567 @findex find-file-read-only-other-frame
568 Visit file @var{filename} read-only, and select its buffer in another
569 frame.  This runs @code{find-file-read-only-other-frame}.
570 @xref{Visiting}.
571 @end table
573 @cindex default-frame-alist
574 @cindex initial-frame-alist
575 @cindex face customization, in init file
576 @cindex color customization, in init file
577   You can control the appearance of new frames you create by setting the
578 frame parameters in @code{default-frame-alist}.  You can use the
579 variable @code{initial-frame-alist} to specify parameters that affect
580 only the initial frame.  @xref{Initial Parameters,,, elisp, The Emacs
581 Lisp Reference Manual}, for more information.
583 @cindex font (default)
584   Here is an example of using @code{default-frame-alist} to specify
585 the default foreground color and font:
587 @example
588 (add-to-list 'default-frame-alist '(font . "10x20"))
589 (add-to-list 'default-frame-alist
590              '(foreground-color . "blue"))
591 @end example
593 @noindent
594 By putting such customizations in your init file, you can control the
595 appearance of all the frames Emacs creates, including the initial one
596 (@pxref{Init File}).  @xref{Fonts}, for other ways to set the default
597 font.
599 @node Frame Commands
600 @section Frame Commands
602   The following commands let you create, delete and operate on frames:
604 @table @kbd
605 @item C-z
606 @kindex C-z @r{(X windows)}
607 @findex suspend-frame
608 Minimize (or ``iconify) the selected Emacs frame
609 (@code{suspend-frame}).  @xref{Exiting}.
611 @item C-x 5 0
612 @kindex C-x 5 0
613 @findex delete-frame
614 Delete the selected frame (@code{delete-frame}).  This is not allowed
615 if there is only one frame.
617 @item C-x 5 o
618 @kindex C-x 5 o
619 @findex other-frame
620 Select another frame, raise it, and warp the mouse to it.  If you
621 repeat this command, it cycles through all the frames on your
622 terminal.
624 @item C-x 5 1
625 @kindex C-x 5 1
626 @findex delete-other-frames
627 Delete all frames except the selected one.
628 @end table
630   The @kbd{C-x 5 0} (@code{delete-frame}) command will never delete
631 the last frame, to prevent you from losing the ability to interact
632 with the Emacs process.  Note that when Emacs is run as a daemon
633 (@pxref{Emacs Server}), there is always a ``virtual frame'' that
634 remains after all the ordinary, interactive frames are deleted.  In
635 this case, @kbd{C-x 5 0} can delete the last interactive frame; you
636 can use @command{emacsclient} to reconnect to the Emacs session.
638 @vindex focus-follows-mouse
639   On X, you may have to tell Emacs how the system (or the window
640 manager) handles focus-switching between windows, in order for the
641 command @kbd{C-x 5 o} (@code{other-frame}) to work properly.
642 Unfortunately, there is no way for Emacs to detect this automatically,
643 so you should set the variable @code{focus-follows-mouse}.  If simply
644 moving the mouse onto a window selects it and gives it focus, the
645 variable should be @code{t}; if you have to click on the window to
646 select it, the variable should be @code{nil}.  The default is
647 @code{t}.
649   The window manager that is part of MS-Windows always gives focus to
650 a frame that raises, so this variable has no effect in the native
651 MS-Windows build of Emacs.
653 @node Fonts
654 @section Fonts
655 @cindex fonts
657   By default, Emacs displays text in X using a 12-point monospace
658 font.  There are several different ways to specify a different font:
660 @itemize
661 @item
662 Click on @samp{Set Default Font} in the @samp{Options} menu.  To save
663 this for future sessions, click on @samp{Save Options} in the
664 @samp{Options} menu.
666 @item
667 Add a line to your init file (@pxref{Init File}), modifying the
668 variable @code{default-frame-alist} to specify the @code{font}
669 parameter (@pxref{Creating Frames}), like this:
671 @smallexample
672 (add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-12"))
673 @end smallexample
675 @cindex X defaults file
676 @cindex X resources file
677 @item
678 Add an @samp{emacs.font} X resource setting to your X resource file,
679 like this:
681 @smallexample
682 emacs.font: DejaVu Sans Mono-12
683 @end smallexample
685 @noindent
686 You must restart X, or use the @command{xrdb} command, for the X
687 resources file to take effect.  @xref{Resources}.  When specifying a
688 font in your X resources file, you should not quote it.
690 @item
691 If you are running Emacs on the GNOME desktop, you can tell Emacs to
692 use the default system font by setting the variable
693 @code{font-use-system-font} to @code{t} (the default is @code{nil}).
694 For this to work, Emacs must be compiled with Gconf support; this is
695 done automatically if the libraries are present at compile time.
697 @item
698 Use the command line option @samp{-fn} (or @samp{--font}).  @xref{Font
700 @end itemize
702 @cindex fontconfig
703   On X, there are four different ways to express a ``font name''.  The
704 first is to use a @dfn{Fontconfig pattern}.  Fontconfig patterns have
705 the following form:
707 @smallexample
708 @var{fontname}[-@var{fontsize}][:@var{name1}=@var{values1}][:@var{name2}=@var{values2}]...
709 @end smallexample
711 @noindent
712 Within this format, any of the elements in braces may be omitted.
713 Here, @var{fontname} is the @dfn{family name} of the font, such as
714 @samp{Monospace} or @samp{DejaVu Serif}; @var{fontsize} is the
715 @dfn{point size} of the font (one @dfn{printer's point} is about 1/72
716 of an inch); and the @samp{@var{name}=@var{values}} entries specify
717 settings such as the slant and weight of the font.  Each @var{values}
718 may be a single value, or a list of values separated by commas.  In
719 addition, some property values are valid with only one kind of
720 property name, in which case the @samp{@var{name}=} part may be
721 omitted.
723 Here is a list of common font properties:
725 @table @samp
726 @item slant
727 One of @samp{italic}, @samp{oblique} or @samp{roman}.
729 @item weight
730 One of @samp{light}, @samp{medium}, @samp{demibold}, @samp{bold} or
731 @samp{black}.
733 @item style
734 Some fonts define special styles which are a combination of slant and
735 weight.  For instance, @samp{Dejavu Sans} defines the @samp{book}
736 style, which overrides the slant and weight properties.
738 @item width
739 One of @samp{condensed}, @samp{normal}, or @samp{expanded}.
741 @item spacing
742 One of @samp{monospace}, @samp{proportional}, @samp{dual-width}, or
743 @samp{charcell}.
744 @end table
746 @noindent
747 Here are some examples of Fontconfig patterns:
749 @smallexample
750 Monospace
751 Monospace-12
752 Monospace-12:bold
753 DejaVu Sans Mono:bold:italic
754 Monospace-12:weight=bold:slant=italic
755 @end smallexample
757 For a more detailed description of Fontconfig patterns, see the
758 Fontconfig manual, which is distributed with Fontconfig and available
759 online at @url{http://fontconfig.org/fontconfig-user.html}.
761   The second way to specify a font is to use a @dfn{GTK font
762 description}.  These have the syntax
764 @smallexample
765 @var{fontname} [@var{properties}] [@var{fontsize}]
766 @end smallexample
768 @noindent
769 where @var{fontname} is the family name, @var{properties} is a list of
770 property values separated by spaces, and @var{fontsize} is the point
771 size.  The properties that you may specify are as follows:
773 @table @samp
774 @item style
775 One of @samp{roman}, @samp{italic} or @samp{oblique}.  If omitted, the
776 @samp{roman} style is used.
777 @item weight
778 One of @samp{medium}, @samp{ultra-light}, @samp{light},
779 @samp{semi-bold}, or @samp{bold}.  If omitted, @samp{medium} weight is
780 used.
781 @end table
783 @noindent
784 Here are some examples of GTK font descriptions:
786 @smallexample
787 Monospace 12
788 Monospace Bold Italic 12
789 @end smallexample
791 @cindex XLFD
792 @cindex X Logical Font Description
793   The third way to specify a font is to use an @dfn{XLFD} (@dfn{X
794 Logical Font Description}).  This is the traditional method for
795 specifying fonts under X.  Each XLFD consists of fourteen words or
796 numbers, separated by dashes, like this:
798 @smallexample
799 -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1
800 @end smallexample
802 @noindent
803 A wildcard character (@samp{*}) in an XLFD matches any sequence of
804 characters (including none), and @samp{?} matches any single
805 character.  However, matching is implementation-dependent, and can be
806 inaccurate when wildcards match dashes in a long name.  For reliable
807 results, supply all 14 dashes and use wildcards only within a field.
808 Case is insignificant in an XLFD.  The syntax for an XLFD is as
809 follows:
811 @smallexample
812 -@var{maker}-@var{family}-@var{weight}-@var{slant}-@var{widthtype}-@var{style}@dots{}
813 @dots{}-@var{pixels}-@var{height}-@var{horiz}-@var{vert}-@var{spacing}-@var{width}-@var{registry}-@var{encoding}
814 @end smallexample
816 @noindent
817 The entries have the following meanings:
819 @table @var
820 @item maker
821 The name of the font manufacturer.
822 @item family
823 The name of the font family (e.g. @samp{courier}).
824 @item weight
825 The font weight---normally either @samp{bold}, @samp{medium} or
826 @samp{light}.  Some font names support other values.
827 @item slant
828 The font slant---normally @samp{r} (roman), @samp{i} (italic),
829 @samp{o} (oblique), @samp{ri} (reverse italic), or @samp{ot} (other).
830 Some font names support other values.
831 @item widthtype
832 The font width---normally @samp{normal}, @samp{condensed},
833 @samp{extended}, or @samp{semicondensed} (some font names support
834 other values).
835 @item style
836 An optional additional style name.  Usually it is empty---most long
837 font names have two hyphens in a row at this point.
838 @item pixels
839 The font height, in pixels.
840 @item height
841 The font height on the screen, measured in tenths of a printer's
842 point.  This is the point size of the font, times ten.  For a given
843 vertical resolution, @var{height} and @var{pixels} are proportional;
844 therefore, it is common to specify just one of them and use @samp{*}
845 for the other.
846 @item horiz
847 The horizontal resolution, in pixels per inch, of the screen for which
848 the font is intended.
849 @item vert
850 The vertical resolution, in pixels per inch, of the screen for which
851 the font is intended.  Normally the resolution of the fonts on your
852 system is the right value for your screen; therefore, you normally
853 specify @samp{*} for this and @var{horiz}.
854 @item spacing
855 This is @samp{m} (monospace), @samp{p} (proportional) or @samp{c}
856 (character cell).
857 @item width
858 The average character width, in pixels, multiplied by ten.
859 @item registry
860 @itemx encoding
861 The X font character set that the font depicts.  (X font character
862 sets are not the same as Emacs character sets, but they are similar.)
863 You can use the @command{xfontsel} program to check which choices you
864 have.  Normally you should use @samp{iso8859} for @var{registry} and
865 @samp{1} for @var{encoding}.
866 @end table
868   The fourth and final method of specifying a font is to use a ``font
869 nickname''.  Certain fonts have shorter nicknames, which you can use
870 instead of a normal font specification.  For instance, @samp{6x13} is
871 equivalent to
873 @smallexample
874 -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1
875 @end smallexample
877 @cindex client-side fonts
878 @cindex server-side fonts
879   On X, Emacs recognizes two types of fonts: @dfn{client-side} fonts,
880 which are provided by the Xft and Fontconfig libraries, and
881 @dfn{server-side} fonts, which are provided by the X server itself.
882 Most client-side fonts support advanced font features such as
883 antialiasing and subpixel hinting, while server-side fonts do not.
884 Fontconfig and GTK patterns match only client-side fonts.
886 @cindex listing system fonts
887   You will probably want to use a fixed-width default font---that is,
888 a font in which all characters have the same width.  For Xft and
889 Fontconfig fonts, you can use the @command{fc-list} command to list
890 the available fixed-width fonts, like this:
892 @example
893 fc-list :spacing=mono fc-list :spacing=charcell
894 @end example
896 @noindent
897 For server-side X fonts, you can use the @command{xlsfonts} program to
898 list the available fixed-width fonts, like this:
900 @example
901 xlsfonts -fn '*x*' | egrep "^[0-9]+x[0-9]+"
902 xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-m*'
903 xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-c*'
904 @end example
906 @noindent
907 Any font with @samp{m} or @samp{c} in the @var{spacing} field of the
908 XLFD is a fixed-width font.  To see what a particular font looks like,
909 use the @command{xfd} command.  For example:
911 @example
912 xfd -fn 6x13
913 @end example
915 @noindent
916 displays the entire font @samp{6x13}.
918   While running Emacs, you can also set the font of a specific kind of
919 text (@pxref{Faces}), or a particular frame (@pxref{Frame
920 Parameters}).
922 @node Speedbar
923 @section Speedbar Frames
924 @cindex speedbar
926 @cindex attached frame (of speedbar)
927   The @dfn{speedbar} is a special frame for conveniently navigating in
928 or operating on another frame.  The speedbar, when it exists, is
929 always associated with a specific frame, called its @dfn{attached
930 frame}; all speedbar operations act on that frame.
932   Type @kbd{M-x speedbar} to create the speedbar and associate it with
933 the current frame.  To dismiss the speedbar, type @kbd{M-x speedbar}
934 again, or select the speedbar and type @kbd{q}.  (You can also delete
935 the speedbar frame like any other Emacs frame.)  If you wish to
936 associate the speedbar with a different frame, dismiss it and call
937 @kbd{M-x speedbar} from that frame.
939   The speedbar can operate in various modes.  Its default mode is
940 @dfn{File Display} mode, which shows the files in the current
941 directory of the selected window of the attached frame, one file per
942 line.  Clicking on a file name visits that file in the selected window
943 of the attached frame, and clicking on a directory name shows that
944 directory in the speedbar (@pxref{Mouse References}).  Each line also
945 has a box, @samp{[+]} or @samp{<+>}, that you can click on to
946 @dfn{expand} the contents of that item.  Expanding a directory adds
947 the contents of that directory to the speedbar display, underneath the
948 directory's own line.  Expanding an ordinary file adds a list of the
949 tags in that file to the speedbar display; you can click on a tag name
950 to jump to that tag in the selected window of the attached frame.
951 When a file or directory is expanded, the @samp{[+]} changes to
952 @samp{[-]}; you can click on that box to @dfn{contract} the item,
953 hiding its contents.
955   You navigate through the speedbar using the keyboard, too.  Typing
956 @kbd{RET} while point is on a line in the speedbar is equivalent to
957 clicking the item on the current line, and @kbd{SPC} expands or
958 contracts the item.  @kbd{U} displays the parent directory of the
959 current directory.  To copy, delete, or rename the file on the current
960 line, type @kbd{C}, @kbd{D}, and @kbd{R} respectively.  To create a
961 new directory, type @kbd{M}.
963   Another general-purpose speedbar mode is @dfn{Buffer Display} mode;
964 in this mode, the speedbar displays a list of Emacs buffers.  To
965 switch to this mode, type @kbd{b} in the speedbar.  To return to File
966 Display mode, type @kbd{f}.  You can also change the display mode by
967 clicking @kbd{mouse-3} anywhere in the speedbar window (or
968 @kbd{mouse-1} on the mode-line) and selecting @samp{Displays} in the
969 pop-up menu.
971   Some major modes, including Rmail mode, Info, and GUD, have
972 specialized ways of putting useful items into the speedbar for you to
973 select.  For example, in Rmail mode, the speedbar shows a list of Rmail
974 files, and lets you move the current message to another Rmail file by
975 clicking on its @samp{<M>} box.
977   For more details on using and programming the speedbar, @xref{Top,
978 Speedbar,,speedbar, Speedbar Manual}.
980 @node Multiple Displays
981 @section Multiple Displays
982 @cindex multiple displays
984   A single Emacs can talk to more than one X display.  Initially, Emacs
985 uses just one display---the one specified with the @env{DISPLAY}
986 environment variable or with the @samp{--display} option (@pxref{Initial
987 Options}).  To connect to another display, use the command
988 @code{make-frame-on-display}:
990 @findex make-frame-on-display
991 @table @kbd
992 @item M-x make-frame-on-display @key{RET} @var{display} @key{RET}
993 Create a new frame on display @var{display}.
994 @end table
996   A single X server can handle more than one screen.  When you open
997 frames on two screens belonging to one server, Emacs knows they share a
998 single keyboard, and it treats all the commands arriving from these
999 screens as a single stream of input.
1001   When you open frames on different X servers, Emacs makes a separate
1002 input stream for each server.  Each server also has its own selected
1003 frame.  The commands you enter with a particular X server apply to
1004 that server's selected frame.
1006   It is even possible to use this feature to let two or more users
1007 type simultaneously on the two displays, within the same Emacs job.
1008 In practice, however, the different users can easily interfere with
1009 each others' edits if they are not careful.
1011 @node Special Buffer Frames
1012 @section Special Buffer Frames
1014 @vindex special-display-buffer-names
1015   You can make certain chosen buffers, which Emacs normally displays
1016 in ``another window,'' appear in special frames of their own.  To do
1017 this, set the variable @code{special-display-buffer-names} to a list
1018 of buffer names; any buffer whose name is in that list automatically
1019 gets a special frame, when an Emacs command wants to display it ``in
1020 another window.''
1022   For example, if you set the variable this way,
1024 @example
1025 (setq special-display-buffer-names
1026       '("*Completions*" "*grep*" "*tex-shell*"))
1027 @end example
1029 @noindent
1030 then completion lists, @code{grep} output and the @TeX{} mode shell
1031 buffer get individual frames of their own.  These frames, and the
1032 windows in them, are never automatically split or reused for any other
1033 buffers.  They continue to show the buffers they were created for,
1034 unless you alter them by hand.  Killing the special buffer deletes its
1035 frame automatically.
1037 @vindex special-display-regexps
1038   More generally, you can set @code{special-display-regexps} to a list
1039 of regular expressions; then a buffer gets its own frame if its name
1040 matches any of those regular expressions.  (Once again, this applies only
1041 to buffers that normally get displayed for you in ``another window.'')
1043 @vindex special-display-frame-alist
1044   The variable @code{special-display-frame-alist} specifies the frame
1045 parameters for these frames.  It has a default value, so you don't need
1046 to set it.
1048   For those who know Lisp, an element of
1049 @code{special-display-buffer-names} or @code{special-display-regexps}
1050 can also be a list.  Then the first element is the buffer name or
1051 regular expression; the rest of the list specifies how to create the
1052 frame.  It can be an association list specifying frame parameter
1053 values; these values take precedence over parameter values specified
1054 in @code{special-display-frame-alist}.  If you specify the symbol
1055 @code{same-window} as a ``frame parameter'' in this list, with a
1056 non-@code{nil} value, that means to use the selected window if
1057 possible.  If you use the symbol @code{same-frame} as a ``frame
1058 parameter'' in this list, with a non-@code{nil} value, that means to
1059 use the selected frame if possible.
1061   Alternatively, the value can have this form:
1063 @example
1064 (@var{function} @var{args}...)
1065 @end example
1067 @noindent
1068 where @var{function} is a symbol.  Then the frame is constructed by
1069 calling @var{function}; its first argument is the buffer, and its
1070 remaining arguments are @var{args}.
1072    An analogous feature lets you specify buffers which should be
1073 displayed in the selected window.  @xref{Force Same Window}.  The
1074 same-window feature takes precedence over the special-frame feature;
1075 therefore, if you add a buffer name to
1076 @code{special-display-buffer-names} and it has no effect, check to see
1077 whether that feature is also in use for the same buffer name.
1079 @node Frame Parameters
1080 @section Setting Frame Parameters
1081 @cindex Auto-Raise mode
1082 @cindex Auto-Lower mode
1084   These commands are available for controlling the window management
1085 behavior of the selected frame:
1087 @table @kbd
1088 @findex auto-raise-mode
1089 @item M-x auto-raise-mode
1090 Toggle whether or not the selected frame should auto-raise.  Auto-raise
1091 means that every time you move the mouse onto the frame, it raises the
1092 frame.
1094 Some window managers also implement auto-raise.  If you enable
1095 auto-raise for Emacs frames in your window manager, it will work, but
1096 it is beyond Emacs' control, so @code{auto-raise-mode} has no effect
1097 on it.
1099 @findex auto-lower-mode
1100 @item M-x auto-lower-mode
1101 Toggle whether or not the selected frame should auto-lower.
1102 Auto-lower means that every time you move the mouse off the frame,
1103 the frame moves to the bottom of the stack on the screen.
1105 The command @code{auto-lower-mode} has no effect on auto-lower
1106 implemented by the window manager.  To control that, you must use the
1107 appropriate window manager features.
1108 @end table
1110   In Emacs versions that use an X toolkit, the color-setting and
1111 font-setting functions don't affect menus and the menu bar, since they
1112 are displayed by their own widget classes.  To change the appearance of
1113 the menus and menu bar, you must use X resources (@pxref{Resources}).
1114 @xref{Colors}, regarding colors.  @xref{Font X}, regarding choice of
1115 font.
1117   Colors, fonts, and other attributes of the frame's display can also
1118 be customized by setting frame parameters in the variable
1119 @code{default-frame-alist} (@pxref{Creating Frames}).  For a detailed
1120 description of frame parameters and customization, see @ref{Frame
1121 Parameters,,, elisp, The Emacs Lisp Reference Manual}.
1123 @node Scroll Bars
1124 @section Scroll Bars
1125 @cindex Scroll Bar mode
1126 @cindex mode, Scroll Bar
1128   On graphical displays, Emacs normally makes a @dfn{scroll bar} at
1129 the left of each Emacs window, running the height of the
1130 window.@footnote{Placing it at the left is usually more useful with
1131 overlapping frames with text starting at the left margin.}
1133   When Emacs is compiled with GTK+ support on the X window system, or
1134 in operating systems such as Microsoft Windows or Mac OS, you can use
1135 the scroll bar as you do in other graphical applications.  If you
1136 click @kbd{Mouse-1} on the scroll bar's up and down buttons, that
1137 scrolls the window by one line at a time.  Clicking @kbd{Mouse-1}
1138 above or below the scroll bar's inner box scrolls the window by nearly
1139 the entire height of the window, like @kbd{M-v} and @kbd{C-v}
1140 respectively (@pxref{Moving Point}).  Dragging the inner box with
1141 @kbd{Mouse-1} scrolls the window continuously.
1143   If Emacs is compiled without GTK+ support on the X window system,
1144 the scroll bar behaves differently.  The scroll bar's inner box is
1145 drawn to represent the portion of the buffer currently displayed, with
1146 the entire height of the scroll bar representing the entire length of
1147 the buffer.  @kbd{Mouse-1} anywhere on the scroll bar scrolls forward
1148 like @kbd{C-v}, and @kbd{Mouse-3} scrolls backward like @kbd{M-v}.
1149 Clicking @kbd{Mouse-2} in the scroll bar lets you move or drag the
1150 inner box up and down.
1152   You can also click @kbd{C-Mouse-2} in the scroll bar to split a
1153 window vertically.  The split occurs on the line where you click.
1155 @findex scroll-bar-mode
1156 @vindex scroll-bar-mode
1157   You can toggle the use of the scroll bar with the command @kbd{M-x
1158 scroll-bar-mode}.  With a prefix argument, this command turns use of
1159 scroll bars on if and only if the argument is positive.  This command
1160 applies to all frames, including frames yet to be created.  Customize
1161 the variable @code{scroll-bar-mode} to control the use of scroll bars
1162 at startup.  You can use it to specify that they are placed at the
1163 right of windows if you prefer that.  You have to set this variable
1164 through the @samp{Customize} interface (@pxref{Easy Customization}),
1165 or it will not work properly.  You can also use the X resource
1166 @samp{verticalScrollBars} to control the initial setting of Scroll Bar
1167 mode.  @xref{Resources}.
1169 @findex toggle-scroll-bar
1170   To enable or disable scroll bars for just the selected frame, use the
1171 command @kbd{M-x toggle-scroll-bar}.
1173 @vindex scroll-bar-width
1174 @cindex width of the scroll bar
1175   You can control the scroll bar width by changing the value of the
1176 @code{scroll-bar-width} frame parameter.
1178 @node Wheeled Mice
1179 @section Scrolling With ``Wheeled'' Mice
1181 @cindex mouse wheel
1182 @cindex wheel, mouse
1183 @findex mouse-wheel-mode
1184 @cindex Mouse Wheel minor mode
1185 @cindex mode, Mouse Wheel
1186   Some mice have a ``wheel'' instead of a third button.  You can
1187 usually click the wheel to act as either @kbd{Mouse-2} or
1188 @kbd{Mouse-3}, depending on the setup.  You can also use the wheel to
1189 scroll windows instead of using the scroll bar or keyboard commands.
1190 Mouse wheel support only works if the system generates appropriate
1191 events; whenever possible, it is turned on by default.  To toggle this
1192 feature, use @kbd{M-x mouse-wheel-mode}.
1194 @vindex mouse-wheel-follow-mouse
1195 @vindex mouse-wheel-scroll-amount
1196 @vindex mouse-wheel-progressive-speed
1197   The two variables @code{mouse-wheel-follow-mouse} and
1198 @code{mouse-wheel-scroll-amount} determine where and by how much
1199 buffers are scrolled.  The variable
1200 @code{mouse-wheel-progressive-speed} determines whether the scroll
1201 speed is linked to how fast you move the wheel.
1203 @node Drag and Drop
1204 @section Drag and Drop
1205 @cindex drag and drop
1207   Emacs supports @dfn{drag and drop} using the mouse.  For instance,
1208 dropping text onto an Emacs frame inserts the text where it is dropped.
1209 Dropping a file onto an Emacs frame visits that file.  As a special
1210 case, dropping the file on a Dired buffer moves or copies the file
1211 (according to the conventions of the application it came from) into the
1212 directory displayed in that buffer.
1214 @vindex dnd-open-file-other-window
1215   Dropping a file normally visits it in the window you drop it on.  If
1216 you prefer to visit the file in a new window in such cases, customize
1217 the variable @code{dnd-open-file-other-window}.
1219   The XDND and Motif drag and drop protocols, and the old KDE 1.x
1220 protocol, are currently supported.
1222 @node Menu Bars
1223 @section Menu Bars
1224 @cindex Menu Bar mode
1225 @cindex mode, Menu Bar
1226 @findex menu-bar-mode
1227 @vindex menu-bar-mode
1229   You can turn display of menu bars on or off with @kbd{M-x
1230 menu-bar-mode} or by customizing the variable @code{menu-bar-mode}.
1231 With no argument, this command toggles Menu Bar mode, a
1232 minor mode.  With an argument, the command turns Menu Bar mode on if the
1233 argument is positive, off if the argument is not positive.  You can use
1234 the X resource @samp{menuBar} to control the initial setting of
1235 Menu Bar mode.  @xref{Resources}.
1237 @kindex C-Mouse-3 @r{(when menu bar is disabled)}
1238   Expert users often turn off the menu bar, especially on text-only
1239 terminals, where this makes one additional line available for text.
1240 If the menu bar is off, you can still pop up a menu of its contents
1241 with @kbd{C-Mouse-3} on a display which supports pop-up menus.
1242 @xref{Menu Mouse Clicks}.
1244   @xref{Menu Bar}, for information on how to invoke commands with the
1245 menu bar.  @xref{X Resources}, for how to customize the menu bar
1246 menus' visual appearance.
1248 @node Tool Bars
1249 @section Tool Bars
1250 @cindex Tool Bar mode
1251 @cindex mode, Tool Bar
1252 @cindex icons, toolbar
1254   The @dfn{tool bar} is a line (or lines) of icons at the top of the
1255 Emacs window, just below the menu bar.  You can click on these icons
1256 with the mouse to do various jobs.
1258   The global tool bar contains general commands.  Some major modes
1259 define their own tool bars to replace it.  A few ``special'' modes
1260 that are not designed for ordinary editing remove some items from the
1261 global tool bar.
1263   Tool bars work only on a graphical display.  The tool bar uses colored
1264 XPM icons if Emacs was built with XPM support.  Otherwise, the tool
1265 bar uses monochrome icons (PBM or XBM format).
1267 @findex tool-bar-mode
1268 @vindex tool-bar-mode
1269   You can turn display of tool bars on or off with @kbd{M-x
1270 tool-bar-mode} or by customizing the option @code{tool-bar-mode}.
1272 @node Dialog Boxes
1273 @section Using Dialog Boxes
1274 @cindex dialog boxes
1276 @vindex use-dialog-box
1277   A dialog box is a special kind of menu for asking you a yes-or-no
1278 question or some other special question.  Many Emacs commands use a
1279 dialog box to ask a yes-or-no question, if you used the mouse to
1280 invoke the command that led to the question.
1282   To disable the use of dialog boxes, change the variable
1283 @code{use-dialog-box} to @code{nil}.  In that case, Emacs always
1284 performs yes-or-no prompts using the echo area and keyboard input.
1285 This variable also controls whether to use file selection windows (but
1286 those are not supported on all platforms).
1288 @vindex use-file-dialog
1289 @cindex file selection dialog, how to disable
1290   A file selection window is a special kind of dialog box for asking
1291 for file names.  You can customize the variable @code{use-file-dialog}
1292 to suppress the use of file selection windows, even if you still want
1293 other kinds of dialogs.  This variable has no effect if you have
1294 suppressed all dialog boxes with the variable @code{use-dialog-box}.
1296 @vindex x-gtk-show-hidden-files
1297 @vindex x-gtk-file-dialog-help-text
1298 @cindex hidden files, in GTK+ file chooser
1299 @cindex help text, in GTK+ file chooser
1300   When Emacs is compiled with GTK+ support, it uses the GTK+ ``file
1301 chooser'' dialog.  Emacs adds an additional toggle button to this
1302 dialog, which you can use to enable or disable the display of hidden
1303 files (files starting with a dot) in that dialog.  If you want this
1304 toggle to be activated by default, change the variable
1305 @code{x-gtk-show-hidden-files} to @code{t}.  In addition, Emacs adds
1306 help text to the GTK+ file chooser dialog; to disable this help text,
1307 change the variable @code{x-gtk-file-dialog-help-text} to @code{nil}.
1309 @vindex x-gtk-use-old-file-dialog
1310   In GTK+ versions 2.4 through 2.10, you can choose to use an older
1311 version of the GTK+ file dialog by setting the variable
1312 @code{x-gtk-use-old-file-dialog} to a non-@code{nil} value.  If Emacs
1313 is built with a GTK+ version that has only one file dialog, this
1314 variable has no effect.
1316 @node Tooltips
1317 @section Tooltips
1318 @cindex tooltips
1320   @dfn{Tooltips} are small windows that display text information at the
1321 current mouse position.  They activate when there is a pause in mouse
1322 movement.  There are two types of tooltip: help tooltips and GUD
1323 tooltips.
1325   @dfn{Help tooltips} typically display over text---including the mode
1326 line---but are also available for other parts of the Emacs frame, such
1327 as the tool bar and menu items.
1329 @findex tooltip-mode
1330   You can toggle display of help tooltips (Tooltip mode) with the
1331 command @kbd{M-x tooltip-mode}.  When Tooltip mode is disabled, the
1332 help text is displayed in the echo area instead.
1334   @dfn{GUD tooltips} show values of variables.  They are useful when
1335 you are debugging a program.  @xref{Debugger Operation}.
1337 @vindex tooltip-delay
1338   The variables @code{tooltip-delay} specifies how long Emacs should
1339 wait before displaying a tooltip.  For additional customization
1340 options for displaying tooltips, use @kbd{M-x customize-group
1341 @key{RET} tooltip @key{RET}}.  @xref{X Resources}, for information on
1342 customizing the windows that display tooltips.
1344 @node Mouse Avoidance
1345 @section Mouse Avoidance
1346 @cindex avoiding mouse in the way of your typing
1347 @cindex mouse avoidance
1349   On graphical terminals, the mouse pointer may obscure the text in
1350 the Emacs frame.  Emacs provides two methods to avoid this problem.
1352 @vindex make-pointer-invisible
1353   Firstly, Emacs hides the mouse pointer each time you type a
1354 self-inserting character, if the pointer lies inside an Emacs frame;
1355 moving the mouse pointer makes it visible again.  To disable this
1356 feature, set the variable @code{make-pointer-invisible} to @code{nil}.
1358 @vindex mouse-avoidance-mode
1359   Secondly, you can use Mouse Avoidance mode, a minor mode, to keep
1360 the mouse pointer away from point.  To use Mouse Avoidance mode,
1361 customize the variable @code{mouse-avoidance-mode}.  You can set this
1362 to various values to move the mouse in several ways:
1364 @table @code
1365 @item banish
1366 Move the mouse to the upper-right corner on any key-press;
1367 @item exile
1368 Move the mouse to the corner only if the cursor gets too close,
1369 and allow it to return once the cursor is out of the way;
1370 @item jump
1371 If the cursor gets too close to the mouse, displace the mouse
1372 a random distance & direction;
1373 @item animate
1374 As @code{jump}, but shows steps along the way for illusion of motion;
1375 @item cat-and-mouse
1376 The same as @code{animate};
1377 @item proteus
1378 As @code{animate}, but changes the shape of the mouse pointer too.
1379 @end table
1381 @findex mouse-avoidance-mode
1382 You can also use the command @kbd{M-x mouse-avoidance-mode} to enable
1383 the mode.  Whenever Mouse Avoidance mode moves the mouse, it also
1384 raises the frame.
1386 @node Non-Window Terminals
1387 @section Non-Window Terminals
1388 @cindex non-window terminals
1389 @cindex single-frame terminals
1391   On a text-only terminal, Emacs can display only one Emacs frame at a
1392 time.  However, you can still create multiple Emacs frames, and switch
1393 between them.  Switching frames on these terminals is much like
1394 switching between different window configurations.
1396   Use @kbd{C-x 5 2} to create a new frame and switch to it; use @kbd{C-x
1397 5 o} to cycle through the existing frames; use @kbd{C-x 5 0} to delete
1398 the current frame.
1400   Each frame has a number to distinguish it.  If your terminal can
1401 display only one frame at a time, the selected frame's number @var{n}
1402 appears near the beginning of the mode line, in the form
1403 @samp{F@var{n}}.
1405 @findex set-frame-name
1406 @findex select-frame-by-name
1407   @samp{F@var{n}} is in fact the frame's initial name.  You can give
1408 frames more meaningful names if you wish, and you can select a frame
1409 by its name.  Use the command @kbd{M-x set-frame-name @key{RET}
1410 @var{name} @key{RET}} to specify a new name for the selected frame,
1411 and use @kbd{M-x select-frame-by-name @key{RET} @var{name} @key{RET}}
1412 to select a frame according to its name.  The name you specify appears
1413 in the mode line when the frame is selected.
1415 @node Text-Only Mouse
1416 @section Using a Mouse in Terminal Emulators
1417 @cindex mouse support
1418 @cindex terminal emulators, mouse support
1420 Some text-only terminals support mouse clicks in the terminal window.
1422 @cindex xterm
1423 In a terminal emulator which is compatible with @code{xterm},
1424 you can use @kbd{M-x xterm-mouse-mode} to give Emacs control over
1425 simple use of the mouse---basically, only non-modified single clicks
1426 are supported.  The normal @code{xterm} mouse functionality for such
1427 clicks is still available by holding down the @kbd{SHIFT} key when you
1428 press the mouse button.  Xterm Mouse mode is a global minor mode
1429 (@pxref{Minor Modes}).  Repeating the command turns the mode off
1430 again.
1432 @findex gpm-mouse-mode
1433 In the console on GNU/Linux, you can use @kbd{M-x gpm-mouse-mode} to
1434 enable terminal mouse support.  You must have the gpm package
1435 installed and running on your system in order for this to work.
1437 @ignore
1438    arch-tag: 7dcf3a31-a43b-45d4-a900-445b10d77e49
1439 @end ignore