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