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