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