1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2011
3 @c Free Software Foundation, Inc.
4 @c See file emacs.texi for copying conditions.
5 @node Frames, International, Windows, Top
6 @chapter Frames and Graphical Displays
9 When Emacs is started on a graphical display, e.g.@: on the X Window
10 System, it occupies a graphical system-level ``window''. 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
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.
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}).
28 This chapter describes Emacs features specific to graphical displays
29 (particularly mouse commands), and features for managing multiple
30 frames. On text-only terminals, many of these features are
31 unavailable. However, it is still possible to create multiple
32 ``frames'' on text-only terminals; such frames are displayed one at a
33 time, filling the entire terminal screen (@pxref{Non-Window
34 Terminals}). It is also possible to use the mouse on some text-only
35 terminals (@pxref{Text-Only Mouse}, for doing so on GNU and Unix
38 @pxref{MS-DOS Mouse,,,emacs-xtra,Specialized Emacs Features},
43 for doing so on MS-DOS).
46 * Mouse Commands:: Moving, cutting, and pasting, with the mouse.
47 * Word and Line Mouse:: Mouse commands for selecting whole words or lines.
48 * Mouse References:: Using the mouse to select an item from a list.
49 * Menu Mouse Clicks:: Mouse clicks that bring up menus.
50 * Mode Line Mouse:: Mouse clicks on the mode line.
51 * Creating Frames:: Creating additional Emacs frames with various contents.
52 * Frame Commands:: Iconifying, deleting, and switching frames.
53 * Fonts:: Changing the frame font.
54 * Speedbar:: How to make and use a speedbar frame.
55 * Multiple Displays:: How one Emacs job can talk to several displays.
56 * Frame Parameters:: Changing the colors and other modes of frames.
57 * Scroll Bars:: How to enable and disable scroll bars; how to use them.
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-only terminals.
69 @section Mouse Commands for Editing
70 @cindex mouse buttons (what they do)
77 Move point to where you click (@code{mouse-set-point}).
80 Activate the region around the text selected by dragging, and copy it
81 to the kill ring (@code{mouse-set-region}).
84 Yank the last killed text at the click position
85 (@code{mouse-yank-at-click}).
88 If the region is active, move the nearer end of the region to the
89 click position; otherwise, set mark at the current value of point and
90 point at the click position. Save the resulting region in the kill
91 ring; on a second click, kill it (@code{mouse-save-then-kill}).
94 @findex mouse-set-point
95 The most basic mouse command is @code{mouse-set-point}, which is
96 invoked by clicking with the left mouse button, @kbd{Mouse-1}, in the
97 text area of a window. This moves point to the position where you
98 clicked. If that window was not the selected window, it becomes the
101 @vindex x-mouse-click-focus-ignore-position
102 Normally, if the frame you clicked in was not the selected frame, it
103 is made the selected frame, in addition to selecting the window and
104 setting the cursor. On the X Window System, you can change this by
105 setting the variable @code{x-mouse-click-focus-ignore-position} to
106 @code{t}. In that case, the initial click on an unselected frame just
107 selects the frame, without doing anything else; clicking again selects
108 the window and sets the cursor position.
110 @findex mouse-set-region
111 Holding down @kbd{Mouse-1} and ``dragging'' the mouse over a stretch
112 of text activates the region around that text
113 (@code{mouse-set-region}), placing the mark where you started holding
114 down the mouse button, and point where you release it (@pxref{Mark}).
115 In addition, the text in the region becomes the primary selection
116 (@pxref{Primary Selection}).
118 @vindex mouse-drag-copy-region
119 If you change the variable @code{mouse-drag-copy-region} to a
120 non-@code{nil} value, dragging the mouse over a stretch of text also
121 adds the text to the kill ring. The default is @code{nil}.
123 @vindex mouse-scroll-min-lines
124 If you move the mouse off the top or bottom of the window while
125 dragging, the window scrolls at a steady rate until you move the mouse
126 back into the window. This way, you can select regions that don't fit
127 entirely on the screen. The number of lines scrolled per step depends
128 on how far away from the window edge the mouse has gone; the variable
129 @code{mouse-scroll-min-lines} specifies a minimum step size.
131 @findex mouse-yank-primary
132 @findex mouse-yank-at-click
133 Clicking with the middle mouse button, @kbd{Mouse-2}, moves point to
134 the position where you clicked and inserts the contents of the primary
135 selection (@code{mouse-yank-primary}). @xref{Primary Selection}.
136 This behavior is consistent with other X applications. Alternatively,
137 you can rebind @kbd{Mouse-2} to @code{mouse-yank-at-click}, which
138 performs a yank at point.
140 @vindex mouse-yank-at-point
141 If you change the variable @code{mouse-yank-at-point} to a
142 non-@code{nil} value, @kbd{Mouse-2} does not move point; it inserts
143 the text at point, regardless of where you clicked or even which of
144 the frame's windows you clicked on. This variable affects both
145 @code{mouse-yank-primary} and @code{mouse-yank-at-click}.
147 @findex mouse-save-then-kill
148 Clicking with the right mouse button, @kbd{Mouse-3}, runs the
149 command @code{mouse-save-then-kill}. This performs several actions
150 depending on where you click and the status of the region:
154 If no region is active, clicking @kbd{Mouse-3} activates the region,
155 placing the mark where point was and point at the clicked position.
158 If a region is active, clicking @kbd{Mouse-3} adjusts the nearer end
159 of the region by moving it to the clicked position. The adjusted
160 region's text is copied to the kill ring; if the text in the original
161 region was already on the kill ring, it replaces it there.
164 If you originally specified the region using a double or triple
165 @kbd{Mouse-1}, so that the region is defined to consist of entire
166 words or lines (@pxref{Word and Line Mouse}), then adjusting the
167 region with @kbd{Mouse-3} also proceeds by entire words or lines.
170 If you use @kbd{Mouse-3} a second time consecutively, at the same
171 place, that kills the region already selected. Thus, the simplest way
172 to kill text with the mouse is to click @kbd{Mouse-1} at one end, then
173 click @kbd{Mouse-3} twice at the other end. To copy the text into the
174 kill ring without deleting it from the buffer, press @kbd{Mouse-3}
175 just once---or just drag across the text with @kbd{Mouse-1}. Then you
176 can copy it elsewhere by yanking it.
179 The @code{mouse-save-then-kill} command also obeys the variable
180 @code{mouse-drag-copy-region} (described above). If the value is
181 non-@code{nil}, then whenever the command sets or adjusts the active
182 region, the text in the region is also added to the kill ring. If the
183 latest kill ring entry had been added the same way, that entry is
184 replaced rather than making a new entry.
186 Whenever you set the region using any of the mouse commands
187 described above, the mark will be deactivated by any subsequent
188 unshifted cursor motion command, in addition to the usual ways of
189 deactivating the mark. @xref{Shift Selection}.
192 @findex mouse-wheel-mode
193 @cindex Mouse Wheel minor mode
194 @cindex mode, Mouse Wheel
195 @vindex mouse-wheel-follow-mouse
196 @vindex mouse-wheel-scroll-amount
197 @vindex mouse-wheel-progressive-speed
198 Some mice have a ``wheel'' which can be used for scrolling. Emacs
199 supports scrolling windows with the mouse wheel, by default, on most
200 graphical displays. To toggle this feature, use @kbd{M-x
201 mouse-wheel-mode}. The variables @code{mouse-wheel-follow-mouse} and
202 @code{mouse-wheel-scroll-amount} determine where and by how much
203 buffers are scrolled. The variable
204 @code{mouse-wheel-progressive-speed} determines whether the scroll
205 speed is linked to how fast you move the wheel.
207 @node Word and Line Mouse
208 @section Mouse Commands for Words and Lines
210 These variants of @kbd{Mouse-1} select entire words or lines at a
211 time. Emacs activates the region around the selected text, which is
212 also copied to the kill ring.
216 Select the text around the word which you click on.
218 Double-clicking on a character with ``symbol'' syntax (such as
219 underscore, in C mode) selects the symbol surrounding that character.
220 Double-clicking on a character with open- or close-parenthesis syntax
221 selects the parenthetical grouping which that character starts or
222 ends. Double-clicking on a character with string-delimiter syntax
223 (such as a single-quote or double-quote in C) selects the string
224 constant (Emacs uses heuristics to figure out whether that character
225 is the beginning or the end of it).
227 @item Double-Drag-Mouse-1
228 Select the text you drag across, in the form of whole words.
231 Select the line you click on.
233 @item Triple-Drag-Mouse-1
234 Select the text you drag across, in the form of whole lines.
237 @node Mouse References
238 @section Following References with the Mouse
239 @kindex Mouse-1 @r{(selection)}
240 @kindex Mouse-2 @r{(selection)}
246 @vindex mouse-highlight
247 Some Emacs buffers include @dfn{buttons}, or @dfn{hyperlinks}:
248 pieces of text that perform some action (e.g.@: following a reference)
249 when activated (e.g.@: by clicking on them). Usually, a button's text
250 is visually highlighted: it is underlined, or a box is drawn around
251 it. If you move the mouse over a button, the shape of the mouse
252 cursor changes and the button lights up. If you change the variable
253 @code{mouse-highlight} to @code{nil}, Emacs disables this
256 You can activate a button by moving point to it and typing
257 @key{RET}, or by clicking either @kbd{Mouse-1} or @kbd{Mouse-2} on the
258 button. For example, in a Dired buffer, each file name is a button;
259 activating it causes Emacs to visit that file (@pxref{Dired}). In a
260 @samp{*Compilation*} buffer, each error message is a button, and
261 activating it visits the source code for that error
262 (@pxref{Compilation}).
264 Although clicking @kbd{Mouse-1} on a button usually activates the
265 button, if you hold the mouse button down for a period of time before
266 releasing it (specifically, for more than 450 milliseconds), then
267 Emacs moves point where you clicked, without activating the button.
268 In this way, you can use the mouse to move point over a button without
269 activating it. Dragging the mouse over or onto a button has its usual
270 behavior of setting the region, and does not activate the button.
272 You can change how @kbd{Mouse-1} applies to buttons by customizing
273 the variable @code{mouse-1-click-follows-link}. If the value is a
274 positive integer, that determines how long you need to hold the mouse
275 button down for, in milliseconds, to cancel button activation; the
276 default is 450, as described in the previous paragraph. If the value
277 is @code{nil}, @kbd{Mouse-1} just sets point where you clicked, and
278 does not activate buttons. If the value is @code{double}, double
279 clicks activate buttons but single clicks just set point.
281 @vindex mouse-1-click-in-non-selected-windows
282 Normally, @kbd{Mouse-1} on a button activates the button even if it
283 is in a non-selected window. If you change the variable
284 @code{mouse-1-click-in-non-selected-windows} to @code{nil},
285 @kbd{Mouse-1} on a button in an unselected window moves point to the
286 clicked position and selects that window, without activating the
289 @node Menu Mouse Clicks
290 @section Mouse Clicks for Menus
292 Several mouse clicks with the @key{CTRL} and @key{SHIFT} modifiers
298 This menu is for selecting a buffer.
300 The MSB (``mouse select buffer'') global minor mode makes this
301 menu smarter and more customizable. @xref{Buffer Menus}.
305 This menu contains entries for examining faces and other text
306 properties, and well as for setting them (the latter is mainly useful
307 when editing enriched text; @pxref{Enriched Text}).
311 This menu is mode-specific. For most modes if Menu-bar mode is on,
312 this menu has the same items as all the mode-specific menu-bar menus
313 put together. Some modes may specify a different menu for this
314 button. If Menu Bar mode is off, this menu contains all the items
315 which would be present in the menu bar---not just the mode-specific
316 ones---so that you can access them without having to display the menu
320 This menu is for changing the default face within the window's buffer.
324 Some graphical applications use @kbd{Mouse-3} for a mode-specific
325 menu. If you prefer @kbd{Mouse-3} in Emacs to bring up such a menu
326 instead of running the @code{mouse-save-then-kill} command, rebind
327 @kbd{Mouse-3} by adding the following line to your init file
328 (@pxref{Init Rebinding}):
331 (global-set-key [mouse-3] 'mouse-popup-menubar-stuff)
334 @node Mode Line Mouse
335 @section Mode Line Mouse Commands
336 @cindex mode line, mouse
337 @cindex mouse on mode line
339 You can use mouse clicks on window mode lines to select and manipulate
342 Some areas of the mode line, such as the buffer name, and major and minor
343 mode names, have their own special mouse bindings. These areas are
344 highlighted when you hold the mouse over them, and information about
345 the special bindings will be displayed (@pxref{Tooltips}). This
346 section's commands do not apply in those areas.
350 @kindex Mouse-1 @r{(mode line)}
351 @kbd{Mouse-1} on a mode line selects the window it belongs to. By
352 dragging @kbd{Mouse-1} on the mode line, you can move it, thus
353 changing the height of the windows above and below. Changing heights
354 with the mouse in this way never deletes windows, it just refuses to
355 make any window smaller than the minimum height.
358 @kindex Mouse-2 @r{(mode line)}
359 @kbd{Mouse-2} on a mode line expands that window to fill its frame.
362 @kindex Mouse-3 @r{(mode line)}
363 @kbd{Mouse-3} on a mode line deletes the window it belongs to. If the
364 frame has only one window, it does nothing.
367 @kindex C-mouse-2 @r{(mode line)}
368 @kbd{C-Mouse-2} on a mode line splits that window, producing two
369 side-by-side windows with the boundary running through the click
370 position (@pxref{Split Window}).
373 @kindex C-Mouse-2 @r{(scroll bar)}
374 @kindex Mouse-1 @r{(scroll bar)}
375 Furthermore, by clicking and dragging @kbd{Mouse-1} on the divider
376 between two side-by-side mode lines, you can move the vertical
377 boundary to the left or right.
379 @node Creating Frames
380 @section Creating Frames
381 @cindex creating frames
384 The prefix key @kbd{C-x 5} is analogous to @kbd{C-x 4}. Whereas
385 each @kbd{C-x 4} command pops up a buffer in a different window in the
386 selected frame (@pxref{Pop Up Window}), the @kbd{C-x 5} commands use a
387 different frame. If an existing visible or iconified (``minimized'')
388 frame already displays the requested buffer, that frame is raised and
389 deiconified (``un-minimized''); otherwise, a new frame is created on
390 the current display terminal.
392 The various @kbd{C-x 5} commands differ in how they find or create the
398 @findex make-frame-command
399 Create a new frame (@code{make-frame-command}).
400 @item C-x 5 b @var{bufname} @key{RET}
401 Select buffer @var{bufname} in another frame. This runs
402 @code{switch-to-buffer-other-frame}.
403 @item C-x 5 f @var{filename} @key{RET}
404 Visit file @var{filename} and select its buffer in another frame. This
405 runs @code{find-file-other-frame}. @xref{Visiting}.
406 @item C-x 5 d @var{directory} @key{RET}
407 Select a Dired buffer for directory @var{directory} in another frame.
408 This runs @code{dired-other-frame}. @xref{Dired}.
410 Start composing a mail message in another frame. This runs
411 @code{mail-other-frame}. It is the other-frame variant of @kbd{C-x m}.
414 Find a tag in the current tag table in another frame. This runs
415 @code{find-tag-other-frame}, the multiple-frame variant of @kbd{M-.}.
417 @item C-x 5 r @var{filename} @key{RET}
419 @findex find-file-read-only-other-frame
420 Visit file @var{filename} read-only, and select its buffer in another
421 frame. This runs @code{find-file-read-only-other-frame}.
425 You can control the appearance and behavior of the newly-created
426 frames by specifying @dfn{frame parameters}. @xref{Frame Parameters}.
429 @section Frame Commands
431 The following commands are used to delete and operate on frames:
437 Delete the selected frame (@code{delete-frame}). This signals an
438 error if there is only one frame.
441 @kindex C-z @r{(X windows)}
442 @findex suspend-frame
443 Minimize (or ``iconify) the selected Emacs frame
444 (@code{suspend-frame}). @xref{Exiting}.
449 Select another frame, and raise it. If you repeat this command, it
450 cycles through all the frames on your terminal.
454 @findex delete-other-frames
455 Delete all frames on the current terminal, except the selected one.
458 The @kbd{C-x 5 0} (@code{delete-frame}) command deletes the selected
459 frame. However, it will refuse to delete the last frame in an Emacs
460 session, to prevent you from losing the ability to interact with the
461 Emacs session. Note that when Emacs is run as a daemon (@pxref{Emacs
462 Server}), there is always a ``virtual frame'' that remains after all
463 the ordinary, interactive frames are deleted. In this case, @kbd{C-x
464 5 0} can delete the last interactive frame; you can use
465 @command{emacsclient} to reconnect to the Emacs session.
467 The @kbd{C-x 5 1} (@code{delete-other-frames}) command deletes all
468 other frames on the current terminal (this terminal refers to either a
469 graphical display, or a text-only terminal; @pxref{Non-Window
470 Terminals}). If the Emacs session has frames open on other graphical
471 displays or text terminals, those are not deleted.
473 @vindex focus-follows-mouse
474 The @kbd{C-x 5 o} (@code{other-frame}) command selects the next
475 frame on the current terminal. If you are using Emacs on the X Window
476 System with a window manager that selects (or @dfn{gives focus to})
477 whatever frame the mouse cursor is over, you have to change the
478 variable @code{focus-follows-mouse} to @code{t} in order for this
479 command to work properly. Then invoking @kbd{C-x 5 o} will also warp
480 the mouse cursor to the chosen frame.
486 By default, Emacs displays text on graphical displays using a
487 12-point monospace font. There are several different ways to specify
492 Click on @samp{Set Default Font} in the @samp{Options} menu. To save
493 this for future sessions, click on @samp{Save Options} in the
497 Add a line to your init file (@pxref{Init File}), modifying the
498 variable @code{default-frame-alist} to specify the @code{font}
499 parameter (@pxref{Creating Frames}), like this:
502 (add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-10"))
505 @cindex X defaults file
506 @cindex X resources file
508 Add an @samp{emacs.font} X resource setting to your X resource file,
512 emacs.font: DejaVu Sans Mono-12
516 You must restart X, or use the @command{xrdb} command, for the X
517 resources file to take effect. @xref{Resources}. When specifying a
518 font in your X resources file, you should not quote it.
521 If you are running Emacs on the GNOME desktop, you can tell Emacs to
522 use the default system font by setting the variable
523 @code{font-use-system-font} to @code{t} (the default is @code{nil}).
524 For this to work, Emacs must have been compiled with Gconf support.
527 Use the command line option @samp{-fn} (or @samp{--font}). @xref{Font
531 To check what font you're currently using, the @kbd{C-u C-x =}
532 command can be helpful. It describes the character at point, and
533 names the font that it's rendered in.
536 On X, there are four different ways to express a ``font name''. The
537 first is to use a @dfn{Fontconfig pattern}. Fontconfig patterns have
541 @var{fontname}[-@var{fontsize}][:@var{name1}=@var{values1}][:@var{name2}=@var{values2}]...
545 Within this format, any of the elements in braces may be omitted.
546 Here, @var{fontname} is the @dfn{family name} of the font, such as
547 @samp{Monospace} or @samp{DejaVu Sans Mono}; @var{fontsize} is the
548 @dfn{point size} of the font (one @dfn{printer's point} is about 1/72
549 of an inch); and the @samp{@var{name}=@var{values}} entries specify
550 settings such as the slant and weight of the font. Each @var{values}
551 may be a single value, or a list of values separated by commas. In
552 addition, some property values are valid with only one kind of
553 property name, in which case the @samp{@var{name}=} part may be
556 Here is a list of common font properties:
560 One of @samp{italic}, @samp{oblique}, or @samp{roman}.
563 One of @samp{light}, @samp{medium}, @samp{demibold}, @samp{bold} or
567 Some fonts define special styles which are a combination of slant and
568 weight. For instance, @samp{Dejavu Sans} defines the @samp{book}
569 style, which overrides the slant and weight properties.
572 One of @samp{condensed}, @samp{normal}, or @samp{expanded}.
575 One of @samp{monospace}, @samp{proportional}, @samp{dual-width}, or
580 Here are some examples of Fontconfig patterns:
586 DejaVu Sans Mono:bold:italic
587 Monospace-12:weight=bold:slant=italic
590 For a more detailed description of Fontconfig patterns, see the
591 Fontconfig manual, which is distributed with Fontconfig and available
592 online at @url{http://fontconfig.org/fontconfig-user.html}.
594 @cindex GTK font pattern
595 The second way to specify a font is to use a @dfn{GTK font pattern}.
596 These have the syntax
599 @var{fontname} [@var{properties}] [@var{fontsize}]
603 where @var{fontname} is the family name, @var{properties} is a list of
604 property values separated by spaces, and @var{fontsize} is the point
605 size. The properties that you may specify for GTK font patterns are
610 Slant properties: @samp{Italic} or @samp{Oblique}. If omitted, the
611 default (roman) slant is implied.
613 Weight properties: @samp{Bold}, @samp{Book}, @samp{Light},
614 @samp{Medium}, @samp{Semi-bold}, or @samp{Ultra-light}. If omitted,
615 @samp{Medium} weight is implied.
617 Width properties: @samp{Semi-Condensed} or @samp{Condensed}. If
618 omitted, a default width is used.
622 Here are some examples of GTK font patterns:
626 Monospace Bold Italic 12
630 @cindex X Logical Font Description
631 The third way to specify a font is to use an @dfn{XLFD} (@dfn{X
632 Logical Font Description}). This is the traditional method for
633 specifying fonts under X. Each XLFD consists of fourteen words or
634 numbers, separated by dashes, like this:
637 -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1
641 A wildcard character (@samp{*}) in an XLFD matches any sequence of
642 characters (including none), and @samp{?} matches any single
643 character. However, matching is implementation-dependent, and can be
644 inaccurate when wildcards match dashes in a long name. For reliable
645 results, supply all 14 dashes and use wildcards only within a field.
646 Case is insignificant in an XLFD. The syntax for an XLFD is as
650 -@var{maker}-@var{family}-@var{weight}-@var{slant}-@var{widthtype}-@var{style}@dots{}
651 @dots{}-@var{pixels}-@var{height}-@var{horiz}-@var{vert}-@var{spacing}-@var{width}-@var{registry}-@var{encoding}
655 The entries have the following meanings:
659 The name of the font manufacturer.
661 The name of the font family (e.g.@: @samp{courier}).
663 The font weight---normally either @samp{bold}, @samp{medium} or
664 @samp{light}. Some font names support other values.
666 The font slant---normally @samp{r} (roman), @samp{i} (italic),
667 @samp{o} (oblique), @samp{ri} (reverse italic), or @samp{ot} (other).
668 Some font names support other values.
670 The font width---normally @samp{normal}, @samp{condensed},
671 @samp{extended}, or @samp{semicondensed} (some font names support
674 An optional additional style name. Usually it is empty---most XLFDs
675 have two hyphens in a row at this point.
677 The font height, in pixels.
679 The font height on the screen, measured in tenths of a printer's
680 point. This is the point size of the font, times ten. For a given
681 vertical resolution, @var{height} and @var{pixels} are proportional;
682 therefore, it is common to specify just one of them and use @samp{*}
685 The horizontal resolution, in pixels per inch, of the screen for which
686 the font is intended.
688 The vertical resolution, in pixels per inch, of the screen for which
689 the font is intended. Normally the resolution of the fonts on your
690 system is the right value for your screen; therefore, you normally
691 specify @samp{*} for this and @var{horiz}.
693 This is @samp{m} (monospace), @samp{p} (proportional) or @samp{c}
696 The average character width, in pixels, multiplied by ten.
699 The X font character set that the font depicts. (X font character
700 sets are not the same as Emacs character sets, but they are similar.)
701 You can use the @command{xfontsel} program to check which choices you
702 have. Normally you should use @samp{iso8859} for @var{registry} and
703 @samp{1} for @var{encoding}.
706 The fourth and final method of specifying a font is to use a ``font
707 nickname''. Certain fonts have shorter nicknames, which you can use
708 instead of a normal font specification. For instance, @samp{6x13} is
712 -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1
715 @cindex client-side fonts
716 @cindex server-side fonts
717 On X, Emacs recognizes two types of fonts: @dfn{client-side} fonts,
718 which are provided by the Xft and Fontconfig libraries, and
719 @dfn{server-side} fonts, which are provided by the X server itself.
720 Most client-side fonts support advanced font features such as
721 antialiasing and subpixel hinting, while server-side fonts do not.
722 Fontconfig and GTK patterns match only client-side fonts.
724 @cindex listing system fonts
725 You will probably want to use a fixed-width default font---that is,
726 a font in which all characters have the same width. For Xft and
727 Fontconfig fonts, you can use the @command{fc-list} command to list
728 the available fixed-width fonts, like this:
731 fc-list :spacing=mono fc-list :spacing=charcell
735 For server-side X fonts, you can use the @command{xlsfonts} program to
736 list the available fixed-width fonts, like this:
739 xlsfonts -fn '*x*' | egrep "^[0-9]+x[0-9]+"
740 xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-m*'
741 xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-c*'
745 Any font with @samp{m} or @samp{c} in the @var{spacing} field of the
746 XLFD is a fixed-width font. To see what a particular font looks like,
747 use the @command{xfd} command. For example:
754 displays the entire font @samp{6x13}.
756 While running Emacs, you can also set the font of a specific kind of
757 text (@pxref{Faces}), or a particular frame (@pxref{Frame
761 @section Speedbar Frames
764 @cindex attached frame (of speedbar)
765 The @dfn{speedbar} is a special frame for conveniently navigating in
766 or operating on another frame. The speedbar, when it exists, is
767 always associated with a specific frame, called its @dfn{attached
768 frame}; all speedbar operations act on that frame.
770 Type @kbd{M-x speedbar} to create the speedbar and associate it with
771 the current frame. To dismiss the speedbar, type @kbd{M-x speedbar}
772 again, or select the speedbar and type @kbd{q}. (You can also delete
773 the speedbar frame like any other Emacs frame.) If you wish to
774 associate the speedbar with a different frame, dismiss it and call
775 @kbd{M-x speedbar} from that frame.
777 The speedbar can operate in various modes. Its default mode is
778 @dfn{File Display} mode, which shows the files in the current
779 directory of the selected window of the attached frame, one file per
780 line. Clicking on a file name visits that file in the selected window
781 of the attached frame, and clicking on a directory name shows that
782 directory in the speedbar (@pxref{Mouse References}). Each line also
783 has a box, @samp{[+]} or @samp{<+>}, that you can click on to
784 @dfn{expand} the contents of that item. Expanding a directory adds
785 the contents of that directory to the speedbar display, underneath the
786 directory's own line. Expanding an ordinary file adds a list of the
787 tags in that file to the speedbar display; you can click on a tag name
788 to jump to that tag in the selected window of the attached frame.
789 When a file or directory is expanded, the @samp{[+]} changes to
790 @samp{[-]}; you can click on that box to @dfn{contract} the item,
793 You navigate through the speedbar using the keyboard, too. Typing
794 @kbd{RET} while point is on a line in the speedbar is equivalent to
795 clicking the item on the current line, and @kbd{SPC} expands or
796 contracts the item. @kbd{U} displays the parent directory of the
797 current directory. To copy, delete, or rename the file on the current
798 line, type @kbd{C}, @kbd{D}, and @kbd{R} respectively. To create a
799 new directory, type @kbd{M}.
801 Another general-purpose speedbar mode is @dfn{Buffer Display} mode;
802 in this mode, the speedbar displays a list of Emacs buffers. To
803 switch to this mode, type @kbd{b} in the speedbar. To return to File
804 Display mode, type @kbd{f}. You can also change the display mode by
805 clicking @kbd{mouse-3} anywhere in the speedbar window (or
806 @kbd{mouse-1} on the mode-line) and selecting @samp{Displays} in the
809 Some major modes, including Rmail mode, Info, and GUD, have
810 specialized ways of putting useful items into the speedbar for you to
811 select. For example, in Rmail mode, the speedbar shows a list of Rmail
812 files, and lets you move the current message to another Rmail file by
813 clicking on its @samp{<M>} box.
815 For more details on using and programming the speedbar, @xref{Top,
816 Speedbar,,speedbar, Speedbar Manual}.
818 @node Multiple Displays
819 @section Multiple Displays
820 @cindex multiple displays
822 A single Emacs can talk to more than one X display. Initially, Emacs
823 uses just one display---the one specified with the @env{DISPLAY}
824 environment variable or with the @samp{--display} option (@pxref{Initial
825 Options}). To connect to another display, use the command
826 @code{make-frame-on-display}:
828 @findex make-frame-on-display
830 @item M-x make-frame-on-display @key{RET} @var{display} @key{RET}
831 Create a new frame on display @var{display}.
834 A single X server can handle more than one screen. When you open
835 frames on two screens belonging to one server, Emacs knows they share a
836 single keyboard, and it treats all the commands arriving from these
837 screens as a single stream of input.
839 When you open frames on different X servers, Emacs makes a separate
840 input stream for each server. Each server also has its own selected
841 frame. The commands you enter with a particular X server apply to
842 that server's selected frame.
844 @node Frame Parameters
845 @section Frame Parameters
846 @cindex default-frame-alist
848 You can control the default appearance and behavior of all frames by
849 specifying a default list of @dfn{frame parameters} in the variable
850 @code{default-frame-alist}. Its value should be a list of entries,
851 each specifying a parameter name and a value for that parameter.
852 These entries take effect whenever Emacs creates a new frame,
853 including the initial frame.
855 @cindex frame size, specifying default
856 For example, you can add the following lines to your init file
857 (@pxref{Init File}) to set the default frame width to 90 character
858 columns, the default frame height to 40 character rows, and the
859 default font to @samp{Monospace-10}:
862 (add-to-list 'default-frame-alist '(width . 90))
863 (add-to-list 'default-frame-alist '(height . 40))
864 (add-to-list 'default-frame-alist '(font . "Monospace-10"))
867 For a list of frame parameters and their effects, see @ref{Frame
868 Parameters,,, elisp, The Emacs Lisp Reference Manual}.
870 @cindex initial-frame-alist
871 You can also specify a list of frame parameters which apply to just
872 the initial frame, by customizing the variable
873 @code{initial-frame-alist}.
875 If Emacs is compiled to use an X toolkit, frame parameters that
876 specify colors and fonts don't affect menus and the menu bar, since
877 those are drawn by the toolkit and not directly by Emacs.
881 @cindex Scroll Bar mode
882 @cindex mode, Scroll Bar
884 On graphical displays, there is a @dfn{scroll bar} on the side of
885 each Emacs window. Clicking @kbd{Mouse-1} on the scroll bar's up and
886 down buttons scrolls the window by one line at a time. Clicking
887 @kbd{Mouse-1} above or below the scroll bar's inner box scrolls the
888 window by nearly the entire height of the window, like @kbd{M-v} and
889 @kbd{C-v} respectively (@pxref{Moving Point}). Dragging the inner box
890 scrolls continuously.
892 If Emacs is compiled on the X Window System without X toolkit
893 support, the scroll bar behaves differently. Clicking @kbd{Mouse-1}
894 anywhere on the scroll bar scrolls forward like @kbd{C-v}, while
895 @kbd{Mouse-3} scrolls backward like @kbd{M-v}. Clicking @kbd{Mouse-2}
896 in the scroll bar lets you drag the inner box up and down.
898 @findex scroll-bar-mode
899 @findex toggle-scroll-bar
900 To toggle the use of scroll bars, type @kbd{M-x scroll-bar-mode}.
901 This command applies to all frames, including frames yet to be
902 created. To toggle scroll bars for just the selected frame, use the
903 command @kbd{M-x toggle-scroll-bar}.
905 @vindex scroll-bar-mode
906 To control the use of scroll bars at startup, customize the variable
907 @code{scroll-bar-mode}. Its value should be either @code{right} (put
908 scroll bars on the right side of windows), @code{left} (put them on
909 the left), or @code{nil} (disable scroll bars). By default, Emacs
910 puts scroll bars on the right if it was compiled with GTK+ support on
911 the X Window System, and on MS-Windows or Mac OS; Emacs puts scroll
912 bars on the left if compiled on the X Window system without GTK+
913 support (following the old convention for X applications).
915 @vindex scroll-bar-width
916 @cindex width of the scroll bar
917 You can also use the X resource @samp{verticalScrollBars} to enable
918 or disable the scroll bars (@pxref{Resources}). To control the scroll
919 bar width, change the @code{scroll-bar-width} frame parameter
920 (@pxref{Frame Parameters,,, elisp, The Emacs Lisp Reference Manual}).
923 @section Drag and Drop
924 @cindex drag and drop
926 In most graphical desktop environments, Emacs has basic support for
927 @dfn{drag and drop} operations. For instance, dropping text onto an
928 Emacs frame inserts the text where it is dropped. Dropping a file
929 onto an Emacs frame visits that file. As a special case, dropping the
930 file on a Dired buffer moves or copies the file (according to the
931 conventions of the application it came from) into the directory
932 displayed in that buffer.
934 @vindex dnd-open-file-other-window
935 Dropping a file normally visits it in the window you drop it on. If
936 you prefer to visit the file in a new window in such cases, customize
937 the variable @code{dnd-open-file-other-window}.
939 The XDND and Motif drag and drop protocols, and the old KDE 1.x
940 protocol, are currently supported.
944 @cindex Menu Bar mode
945 @cindex mode, Menu Bar
946 @findex menu-bar-mode
947 @vindex menu-bar-mode
949 You can toggle the use of menu bars with @kbd{M-x menu-bar-mode}.
950 With no argument, this command toggles Menu Bar mode, a global minor
951 mode. With an argument, the command turns Menu Bar mode on if the
952 argument is positive, off if the argument is not positive. To control
953 the use of menu bars at startup, customize the variable
954 @code{menu-bar-mode}.
956 @kindex C-Mouse-3 @r{(when menu bar is disabled)}
957 Expert users often turn off the menu bar, especially on text-only
958 terminals, where this makes one additional line available for text.
959 If the menu bar is off, you can still pop up a menu of its contents
960 with @kbd{C-Mouse-3} on a display which supports pop-up menus.
961 @xref{Menu Mouse Clicks}.
963 @xref{Menu Bar}, for information on how to invoke commands with the
964 menu bar. @xref{X Resources}, for how to customize the menu bar
965 menus' visual appearance.
969 @cindex Tool Bar mode
970 @cindex mode, Tool Bar
971 @cindex icons, toolbar
973 On graphical displays, Emacs puts a @dfn{tool bar} at the top of
974 each frame, just below the menu bar. This is a row of icons which you
975 can click on with the mouse to invoke various commands.
977 The global (default) tool bar contains general commands. Some major
978 modes define their own tool bars; whenever a buffer with such a major
979 mode is current, the mode's tool bar replaces the global tool bar.
981 @findex tool-bar-mode
982 @vindex tool-bar-mode
983 To toggle the use of tool bars, type @kbd{M-x tool-bar-mode}. This
984 command applies to all frames, including frames yet to be created. To
985 control the use of tool bars at startup, customize the variable
986 @code{tool-bar-mode}.
988 @vindex tool-bar-style
989 @cindex Tool Bar style
990 When Emacs is compiled with GTK+ support, each tool bar item can
991 consist of an image, or a text label, or both. By default, Emacs
992 follows the Gnome desktop's tool bar style setting; if none is
993 defined, it displays tool bar items as just images. To impose a
994 specific tool bar style, customize the variable @code{tool-bar-style}.
996 @cindex Tool Bar position
997 You can also control the placement of the tool bar for the GTK+ tool
998 bar with the frame parameter @code{tool-bar-position}. @xref{Frame
999 Parameters,,, elisp, The Emacs Lisp Reference Manual}.
1002 @section Using Dialog Boxes
1003 @cindex dialog boxes
1005 @vindex use-dialog-box
1006 A dialog box is a special kind of menu for asking you a yes-or-no
1007 question or some other special question. Many Emacs commands use a
1008 dialog box to ask a yes-or-no question, if you used the mouse to
1009 invoke the command that led to the question.
1011 To disable the use of dialog boxes, change the variable
1012 @code{use-dialog-box} to @code{nil}. In that case, Emacs always
1013 performs yes-or-no prompts using the echo area and keyboard input.
1014 This variable also controls whether to use file selection windows (but
1015 those are not supported on all platforms).
1017 @vindex use-file-dialog
1018 @cindex file selection dialog, how to disable
1019 A file selection window is a special kind of dialog box for asking
1020 for file names. You can customize the variable @code{use-file-dialog}
1021 to suppress the use of file selection windows, even if you still want
1022 other kinds of dialogs. This variable has no effect if you have
1023 suppressed all dialog boxes with the variable @code{use-dialog-box}.
1025 @vindex x-gtk-show-hidden-files
1026 @vindex x-gtk-file-dialog-help-text
1027 @cindex hidden files, in GTK+ file chooser
1028 @cindex help text, in GTK+ file chooser
1029 When Emacs is compiled with GTK+ support, it uses the GTK+ ``file
1030 chooser'' dialog. Emacs adds an additional toggle button to this
1031 dialog, which you can use to enable or disable the display of hidden
1032 files (files starting with a dot) in that dialog. If you want this
1033 toggle to be activated by default, change the variable
1034 @code{x-gtk-show-hidden-files} to @code{t}. In addition, Emacs adds
1035 help text to the GTK+ file chooser dialog; to disable this help text,
1036 change the variable @code{x-gtk-file-dialog-help-text} to @code{nil}.
1042 @dfn{Tooltips} are small windows that display text information at
1043 the current mouse position. They activate when there is a pause in
1044 mouse movement over some significant piece of text in a window, or the
1045 mode line, or some other part of the Emacs frame such as a tool bar
1046 button or menu item.
1048 @findex tooltip-mode
1049 You can toggle the use of tooltips with the command @kbd{M-x
1050 tooltip-mode}. When Tooltip mode is disabled, the help text is
1051 displayed in the echo area instead. To control the use of tooltips at
1052 startup, customize the variable @code{tooltip-mode}.
1054 @vindex tooltip-delay
1055 The variables @code{tooltip-delay} specifies how long Emacs should
1056 wait before displaying a tooltip. For additional customization
1057 options for displaying tooltips, use @kbd{M-x customize-group
1058 @key{RET} tooltip @key{RET}}.
1060 @vindex x-gtk-use-system-tooltips
1061 If Emacs is built with GTK+ support, it displays tooltips via GTK+,
1062 using the default appearance of GTK+ tooltips. To disable this,
1063 change the variable @code{x-gtk-use-system-tooltips} to @code{nil}.
1064 If you do this, or if Emacs is built without GTK+ support, most
1065 attributes of the tooltip text are specified by the @code{tooltip}
1066 face, and by X resources (@pxref{X Resources}).
1068 @dfn{GUD tooltips} are special tooltips that show the values of
1069 variables when debugging a program with GUD. @xref{Debugger
1072 @node Mouse Avoidance
1073 @section Mouse Avoidance
1074 @cindex avoiding mouse in the way of your typing
1075 @cindex mouse avoidance
1077 On graphical terminals, the mouse pointer may obscure the text in
1078 the Emacs frame. Emacs provides two methods to avoid this problem.
1080 @vindex make-pointer-invisible
1081 Firstly, Emacs hides the mouse pointer each time you type a
1082 self-inserting character, if the pointer lies inside an Emacs frame;
1083 moving the mouse pointer makes it visible again. To disable this
1084 feature, set the variable @code{make-pointer-invisible} to @code{nil}.
1086 @vindex mouse-avoidance-mode
1087 Secondly, you can use Mouse Avoidance mode, a minor mode, to keep
1088 the mouse pointer away from point. To use Mouse Avoidance mode,
1089 customize the variable @code{mouse-avoidance-mode}. You can set this
1090 to various values to move the mouse in several ways:
1094 Move the mouse to the upper-right corner on any key-press;
1096 Move the mouse to the corner only if the cursor gets too close,
1097 and allow it to return once the cursor is out of the way;
1099 If the cursor gets too close to the mouse, displace the mouse
1100 a random distance & direction;
1102 As @code{jump}, but shows steps along the way for illusion of motion;
1104 The same as @code{animate};
1106 As @code{animate}, but changes the shape of the mouse pointer too.
1109 @findex mouse-avoidance-mode
1110 You can also use the command @kbd{M-x mouse-avoidance-mode} to enable
1111 the mode. Whenever Mouse Avoidance mode moves the mouse, it also
1114 @node Non-Window Terminals
1115 @section Non-Window Terminals
1116 @cindex text-only terminal
1118 On a text-only terminal, Emacs can display only one Emacs frame at a
1119 time. However, you can still create multiple Emacs frames, and switch
1120 between them. Switching frames on these terminals is much like
1121 switching between different window configurations.
1123 Use @kbd{C-x 5 2} to create a new frame and switch to it; use @kbd{C-x
1124 5 o} to cycle through the existing frames; use @kbd{C-x 5 0} to delete
1127 Each frame has a number to distinguish it. If your terminal can
1128 display only one frame at a time, the selected frame's number @var{n}
1129 appears near the beginning of the mode line, in the form
1132 @findex set-frame-name
1133 @findex select-frame-by-name
1134 @samp{F@var{n}} is in fact the frame's initial name. You can give
1135 frames more meaningful names if you wish, and you can select a frame
1136 by its name. Use the command @kbd{M-x set-frame-name @key{RET}
1137 @var{name} @key{RET}} to specify a new name for the selected frame,
1138 and use @kbd{M-x select-frame-by-name @key{RET} @var{name} @key{RET}}
1139 to select a frame according to its name. The name you specify appears
1140 in the mode line when the frame is selected.
1142 @node Text-Only Mouse
1143 @section Using a Mouse in Text-only Terminals
1144 @cindex mouse support
1145 @cindex terminal emulators, mouse support
1147 Some text-only terminals support mouse clicks in the terminal window.
1150 In a terminal emulator which is compatible with @command{xterm}, you
1151 can use @kbd{M-x xterm-mouse-mode} to give Emacs control over simple
1152 uses of the mouse---basically, only non-modified single clicks are
1153 supported. The normal @command{xterm} mouse functionality for such
1154 clicks is still available by holding down the @kbd{SHIFT} key when you
1155 press the mouse button. Xterm Mouse mode is a global minor mode
1156 (@pxref{Minor Modes}). Repeating the command turns the mode off
1159 @findex gpm-mouse-mode
1160 In the console on GNU/Linux, you can use @kbd{M-x gpm-mouse-mode} to
1161 enable mouse support. You must have the gpm server installed and
1162 running on your system in order for this to work.
1165 @pxref{MS-DOS Mouse,,,emacs-xtra,Specialized Emacs Features},
1168 @pxref{MS-DOS Mouse},
1170 for information about mouse support on MS-DOS.