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