Another set of improvements in the Emacs manual
[emacs.git] / doc / emacs / frames.texi
blobb2ec5746a0e4d2d7c3a6acbbd80a5146358a0323
1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2018 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
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.
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 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.
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
68 @node Mouse Commands
69 @section Mouse Commands for Editing
70 @cindex mouse buttons (what they do)
71 @cindex mouse, selecting text using
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}).
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}).
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}).
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
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 @kbd{mouse-1} (@pxref{Word and Line Mouse}).
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.
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}).
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}.
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.
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.
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}.
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:
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.
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.
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.
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
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.
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}.
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.
210 @vindex mwheel-tilt-scroll-p
211 @vindex mwheel-flip-direction
212 Emacs can also support horizontal scrolling if your mouse's wheel can
213 be tilted.  This feature is off by default; the variable
214 @code{mwheel-tilt-scroll-p} turns it on.  If you'd like to reverse the
215 direction of horizontal scrolling, customize the variable
216 @code{mwheel-flip-direction} to a non-@code{nil} value.
219 @node Word and Line Mouse
220 @section Mouse Commands for Words and Lines
222   These variants of @kbd{mouse-1} select entire words or lines at a
223 time.  Emacs activates the region around the selected text, which is
224 also copied to the kill ring.
226 @table @kbd
227 @item Double-mouse-1
228 Select the text around the word or character which you click on.
230 Double-clicking on a character with symbol syntax (such as
231 underscore, in C mode) selects the symbol surrounding that character.
232 Double-clicking on a character with open- or close-parenthesis syntax
233 selects the parenthetical grouping which that character starts or
234 ends.  Double-clicking on a character with string-delimiter syntax
235 (such as a single-quote or double-quote in C) selects the string
236 constant (Emacs uses heuristics to figure out whether that character
237 is the beginning or the end of it).
239 Double-clicking on the beginning of a parenthetical grouping or
240 beginning string-delimiter moves point to the end of the region,
241 scrolling the buffer display forward if necessary to show the new
242 location of point.  Double-clicking on the end of a parenthetical
243 grouping or end string-delimiter keeps point at the end of the region
244 by default, so the beginning of the region will not be visible if it
245 is above the top of the window; setting the user option
246 @code{mouse-select-region-move-to-beginning} to non-@code{nil} changes
247 this to move point to the beginning of the region, scrolling the
248 display backward if necessary.
250 @item Double-Drag-mouse-1
251 Select the text you drag across, in units of whole words.
253 @item Triple-mouse-1
254 Select the line you click on.
256 @item Triple-Drag-mouse-1
257 Select the text you drag across, in units of whole lines.
258 @end table
260 @node Mouse References
261 @section Following References with the Mouse
262 @kindex mouse-1 @r{(on buttons)}
263 @kindex mouse-2 @r{(on buttons)}
264 @cindex hyperlinks
265 @cindex links
266 @cindex text buttons
267 @cindex buttons
269 @vindex mouse-highlight
270   Some Emacs buffers include @dfn{buttons}, or @dfn{hyperlinks}:
271 pieces of text that perform some action (e.g., following a reference)
272 when activated (e.g., by clicking on them).  Usually, a button's text
273 is visually highlighted: it is underlined, or a box is drawn around
274 it.  If you move the mouse over a button, the shape of the mouse
275 cursor changes and the button lights up.  If you change the variable
276 @code{mouse-highlight} to @code{nil}, Emacs disables this
277 highlighting.
279   You can activate a button by moving point to it and typing
280 @key{RET}, or by clicking either @kbd{mouse-1} or @kbd{mouse-2} on the
281 button.  For example, in a Dired buffer, each file name is a button;
282 activating it causes Emacs to visit that file (@pxref{Dired}).  In a
283 @file{*Compilation*} buffer, each error message is a button, and
284 activating it visits the source code for that error
285 (@pxref{Compilation}).
287   Although clicking @kbd{mouse-1} on a button usually activates the
288 button, if you hold the mouse button down for a period of time before
289 releasing it (specifically, for more than 450 milliseconds), then
290 Emacs moves point where you clicked, without activating the button.
291 In this way, you can use the mouse to move point over a button without
292 activating it.  Dragging the mouse over or onto a button has its usual
293 behavior of setting the region, and does not activate the button.
295   You can change how @kbd{mouse-1} applies to buttons by customizing
296 the variable @code{mouse-1-click-follows-link}.  If the value is a
297 positive integer, that determines how long you need to hold the mouse
298 button down for, in milliseconds, to cancel button activation; the
299 default is 450, as described in the previous paragraph.  If the value
300 is @code{nil}, @kbd{mouse-1} just sets point where you clicked, and
301 does not activate buttons.  If the value is @code{double}, double
302 clicks activate buttons but single clicks just set point.
304 @vindex mouse-1-click-in-non-selected-windows
305   Normally, @kbd{mouse-1} on a button activates the button even if it
306 is in a non-selected window.  If you change the variable
307 @code{mouse-1-click-in-non-selected-windows} to @code{nil},
308 @kbd{mouse-1} on a button in an unselected window moves point to the
309 clicked position and selects that window, without activating the
310 button.
312 @node Menu Mouse Clicks
313 @section Mouse Clicks for Menus
315   Several mouse clicks with the @key{Ctrl} and @key{SHIFT} modifiers
316 bring up menus.
318 @table @kbd
319 @item C-mouse-1
320 @kindex C-mouse-1
321 This menu is for selecting a buffer.
323 The MSB (``mouse select buffer'') global minor mode makes this
324 menu smarter and more customizable.  @xref{Buffer Menus}.
326 @item C-mouse-2
327 @kindex C-mouse-2
328 This menu contains entries for examining faces and other text
329 properties, and well as for setting them (the latter is mainly useful
330 when editing enriched text; @pxref{Enriched Text}).
332 @item C-mouse-3
333 @kindex C-mouse-3
334 This menu is mode-specific.  For most modes if Menu-bar mode is on,
335 this menu has the same items as all the mode-specific menu-bar menus
336 put together.  Some modes may specify a different menu for this
337 button.  If Menu Bar mode is off, this menu contains all the items
338 which would be present in the menu bar---not just the mode-specific
339 ones---so that you can access them without having to display the menu
340 bar.
342 @item S-mouse-1
343 This menu is for changing the default face within the window's buffer.
344 @xref{Text Scale}.
345 @end table
347   Some graphical applications use @kbd{mouse-3} for a mode-specific
348 menu.  If you prefer @kbd{mouse-3} in Emacs to bring up such a menu
349 instead of running the @code{mouse-save-then-kill} command, rebind
350 @kbd{mouse-3} by adding the following line to your init file
351 (@pxref{Init Rebinding}):
353 @c FIXME: `mouse-popup-menubar-stuff' is obsolete since 23.1.
354 @smallexample
355 (global-set-key [mouse-3] 'mouse-popup-menubar-stuff)
356 @end smallexample
358 @node Mode Line Mouse
359 @section Mode Line Mouse Commands
360 @cindex mode line, mouse
361 @cindex mouse on mode line
363   You can use mouse clicks on window mode lines to select and manipulate
364 windows.
366   Some areas of the mode line, such as the buffer name, and major and minor
367 mode names, have their own special mouse bindings.  These areas are
368 highlighted when you hold the mouse over them, and information about
369 the special bindings will be displayed (@pxref{Tooltips}).  This
370 section's commands do not apply in those areas.
372 @table @kbd
373 @item mouse-1
374 @kindex mouse-1 @r{(mode line)}
375 @kbd{mouse-1} on a mode line selects the window it belongs to.  By
376 dragging @kbd{mouse-1} on the mode line, you can move it, thus
377 changing the height of the windows above and below.  Changing heights
378 with the mouse in this way never deletes windows, it just refuses to
379 make any window smaller than the minimum height.
381 @item mouse-2
382 @kindex mouse-2 @r{(mode line)}
383 @kbd{mouse-2} on a mode line expands that window to fill its frame.
385 @item mouse-3
386 @kindex mouse-3 @r{(mode line)}
387 @kbd{mouse-3} on a mode line deletes the window it belongs to.  If the
388 frame has only one window, it does nothing.
390 @item C-mouse-2
391 @kbd{C-mouse-2} on a mode line splits that window, producing two
392 side-by-side windows with the boundary running through the click
393 position (@pxref{Split Window}).
394 @end table
396 @kindex mouse-1 @r{(scroll bar)}
397   Furthermore, by clicking and dragging @kbd{mouse-1} on the divider
398 between two side-by-side mode lines, you can move the vertical
399 boundary to the left or right.
401   Note that resizing windows is affected by the value of
402 @code{window-resize-pixelwise}, see @ref{Split Window}.
404 @node Creating Frames
405 @section Creating Frames
406 @cindex creating frames
408 @kindex C-x 5
409   The prefix key @kbd{C-x 5} is analogous to @kbd{C-x 4}.  Whereas
410 each @kbd{C-x 4} command pops up a buffer in a different window in the
411 selected frame (@pxref{Pop Up Window}), the @kbd{C-x 5} commands use a
412 different frame.  If an existing visible or iconified (a.k.a.@:
413 ``minimized'', @pxref{Visibility of Frames,,, elisp, The Emacs Lisp
414 Reference Manual}) frame already displays the requested buffer, that
415 frame is raised and deiconified (``un-minimized''); otherwise, a new
416 frame is created on the current display terminal.
418   The various @kbd{C-x 5} commands differ in how they find or create the
419 buffer to select:
421 @table @kbd
422 @item C-x 5 2
423 @kindex C-x 5 2
424 @findex make-frame-command
425 Create a new frame (@code{make-frame-command}).
426 @item C-x 5 b @var{bufname} @key{RET}
427 Select buffer @var{bufname} in another frame.  This runs
428 @code{switch-to-buffer-other-frame}.
429 @item C-x 5 f @var{filename} @key{RET}
430 Visit file @var{filename} and select its buffer in another frame.  This
431 runs @code{find-file-other-frame}.  @xref{Visiting}.
432 @item C-x 5 d @var{directory} @key{RET}
433 Select a Dired buffer for directory @var{directory} in another frame.
434 This runs @code{dired-other-frame}.  @xref{Dired}.
435 @item C-x 5 m
436 Start composing a mail message in another frame.  This runs
437 @code{compose-mail-other-frame}.  It is the other-frame variant of
438 @kbd{C-x m}.  @xref{Sending Mail}.
439 @item C-x 5 .
440 Find the definition of an identifier in another frame.  This runs
441 @code{xref-find-definitions-other-frame}, the multiple-frame variant
442 of @kbd{M-.}.  @xref{Xref}.
443 @item C-x 5 r @var{filename} @key{RET}
444 @kindex C-x 5 r
445 @findex find-file-read-only-other-frame
446 Visit file @var{filename} read-only, and select its buffer in another
447 frame.  This runs @code{find-file-read-only-other-frame}.
448 @xref{Visiting}.
449 @end table
451   You can control the appearance and behavior of the newly-created
452 frames by specifying @dfn{frame parameters}.  @xref{Frame Parameters}.
454 @node Frame Commands
455 @section Frame Commands
457   The following commands are used to delete and operate on frames:
459 @table @kbd
460 @item C-x 5 0
461 @kindex C-x 5 0
462 @findex delete-frame
463 Delete the selected frame (@code{delete-frame}).  This signals an
464 error if there is only one frame.
466 @item C-z
467 @kindex C-z @r{(X windows)}
468 Minimize (or iconify) the selected Emacs frame
469 (@code{suspend-frame}).  @xref{Exiting}.
471 @item C-x 5 o
472 @kindex C-x 5 o
473 @findex other-frame
474 Select another frame, and raise it.  If you repeat this command, it
475 cycles through all the frames on your terminal.
477 @item C-x 5 1
478 @kindex C-x 5 1
479 @findex delete-other-frames
480 Delete all frames on the current terminal, except the selected one.
482 @item M-<F10>
483 @kindex M-<F10>
484 @findex toggle-frame-maximized
485 Toggle the maximization state of the current frame.  When a frame is
486 maximized, it fills the screen.
488 @item <F11>
489 @kindex <F11>
490 @findex toggle-frame-fullscreen
491 Toggle full-screen mode for the current frame.  (The difference
492 between full-screen and maximized is normally that the former
493 hides window manager decorations, giving slightly more screen space to
494 Emacs itself.)
495 @end table
497 @vindex frame-resize-pixelwise
498   Note that with some window managers you may have to customize the
499 variable @code{frame-resize-pixelwise} to a non-@code{nil} value in
500 order to make a frame truly maximized or full-screen.  This
501 variable, when set to a non-@code{nil} value, in general allows
502 resizing frames at pixel resolution, rather than in integral multiples
503 of lines and columns.
505   The @kbd{C-x 5 0} (@code{delete-frame}) command deletes the selected
506 frame.  However, it will refuse to delete the last frame in an Emacs
507 session, to prevent you from losing the ability to interact with the
508 Emacs session.  Note that when Emacs is run as a daemon (@pxref{Emacs
509 Server}), there is always a virtual frame that remains after all
510 the ordinary, interactive frames are deleted.  In this case, @kbd{C-x
511 5 0} can delete the last interactive frame; you can use
512 @command{emacsclient} to reconnect to the Emacs session.
514   The @kbd{C-x 5 1} (@code{delete-other-frames}) command deletes all
515 other frames on the current terminal (this terminal refers to either a
516 graphical display, or a text terminal; @pxref{Non-Window Terminals}).
517 If the Emacs session has frames open on other graphical displays or
518 text terminals, those are not deleted.
520 @vindex focus-follows-mouse
521   The @kbd{C-x 5 o} (@code{other-frame}) command selects the next
522 frame on the current terminal.  If you are using Emacs on the X Window
523 System with a window manager that selects (or @dfn{gives focus to})
524 whatever frame the mouse cursor is over, you have to change the
525 variable @code{focus-follows-mouse} to @code{t} in order for this
526 command to work properly.  Then invoking @kbd{C-x 5 o} will also warp
527 the mouse cursor to the chosen frame.
529 @node Fonts
530 @section Fonts
531 @cindex fonts
533   By default, Emacs displays text on graphical displays using a
534 10-point monospace font.  There are several different ways to specify
535 a different font:
537 @itemize
538 @item
539 Click on @samp{Set Default Font} in the @samp{Options} menu.  This
540 makes the selected font the default on all existing graphical frames.
541 To save this for future sessions, click on @samp{Save Options} in the
542 @samp{Options} menu.
544 @item
545 Add a line to your init file, modifying the variable
546 @code{default-frame-alist} to specify the @code{font} parameter
547 (@pxref{Frame Parameters}), like this:
549 @example
550 (add-to-list 'default-frame-alist
551              '(font . "DejaVu Sans Mono-10"))
552 @end example
554 @noindent
555 This makes the font the default on all graphical frames created after
556 restarting Emacs with that init file.
558 @cindex X defaults file
559 @cindex X resources file
560 @item
561 Add an @samp{emacs.font} X resource setting to your X resource file,
562 like this:
564 @example
565 emacs.font: DejaVu Sans Mono-12
566 @end example
568 @noindent
569 You must restart X, or use the @command{xrdb} command, for the X
570 resources file to take effect.  @xref{Resources}.  Do not quote
571 font names in X resource files.
573 @item
574 If you are running Emacs on the GNOME desktop, you can tell Emacs to
575 use the default system font by setting the variable
576 @code{font-use-system-font} to @code{t} (the default is @code{nil}).
577 For this to work, Emacs must have been compiled with support for
578 Gsettings (or the older Gconf).
580 @item
581 Use the command line option @samp{-fn} (or @samp{--font}).  @xref{Font
583 @end itemize
585   To check what font you're currently using, the @kbd{C-u C-x =}
586 command can be helpful.  It describes the character at point, and
587 names the font that it's rendered in.
589 @cindex fontconfig
590   On X, there are four different ways to express a font name.  The
591 first is to use a @dfn{Fontconfig pattern}.  Fontconfig patterns have
592 the following form:
594 @example
595 @var{fontname}[-@var{fontsize}][:@var{name1}=@var{values1}][:@var{name2}=@var{values2}]...
596 @end example
598 @noindent
599 Within this format, any of the elements in brackets may be omitted.
600 Here, @var{fontname} is the @dfn{family name} of the font, such as
601 @samp{Monospace} or @samp{DejaVu Sans Mono}; @var{fontsize} is the
602 @dfn{point size} of the font (one @dfn{printer's point} is about 1/72
603 of an inch); and the @samp{@var{name}=@var{values}} entries specify
604 settings such as the slant and weight of the font.  Each @var{values}
605 may be a single value, or a list of values separated by commas.  In
606 addition, some property values are valid with only one kind of
607 property name, in which case the @samp{@var{name}=} part may be
608 omitted.
610 Here is a list of common font properties:
612 @table @samp
613 @item slant
614 One of @samp{italic}, @samp{oblique}, or @samp{roman}.
616 @item weight
617 One of @samp{light}, @samp{medium}, @samp{demibold}, @samp{bold} or
618 @samp{black}.
620 @item style
621 Some fonts define special styles which are a combination of slant and
622 weight.  For instance, @samp{Dejavu Sans} defines the @samp{book}
623 style, which overrides the slant and weight properties.
625 @item width
626 One of @samp{condensed}, @samp{normal}, or @samp{expanded}.
628 @item spacing
629 One of @samp{monospace}, @samp{proportional}, @samp{dual-width}, or
630 @samp{charcell}.
631 @end table
633 @noindent
634 Here are some examples of Fontconfig patterns:
636 @example
637 Monospace
638 Monospace-12
639 Monospace-12:bold
640 DejaVu Sans Mono:bold:italic
641 Monospace-12:weight=bold:slant=italic
642 @end example
644 For a more detailed description of Fontconfig patterns, see the
645 Fontconfig manual, which is distributed with Fontconfig and available
646 online at @url{https://fontconfig.org/fontconfig-user.html}.
648 @cindex GTK font pattern
649   The second way to specify a font is to use a @dfn{GTK font pattern}.
650 These have the syntax
652 @example
653 @var{fontname} [@var{properties}] [@var{fontsize}]
654 @end example
656 @noindent
657 where @var{fontname} is the family name, @var{properties} is a list of
658 property values separated by spaces, and @var{fontsize} is the point
659 size.  The properties that you may specify for GTK font patterns are
660 as follows:
662 @itemize
663 @item
664 Slant properties: @samp{Italic} or @samp{Oblique}.  If omitted, the
665 default (roman) slant is implied.
666 @item
667 Weight properties: @samp{Bold}, @samp{Book}, @samp{Light},
668 @samp{Medium}, @samp{Semi-bold}, or @samp{Ultra-light}.  If omitted,
669 @samp{Medium} weight is implied.
670 @item
671 Width properties: @samp{Semi-Condensed} or @samp{Condensed}.  If
672 omitted, a default width is used.
673 @end itemize
675 @noindent
676 Here are some examples of GTK font patterns:
678 @example
679 Monospace 12
680 Monospace Bold Italic 12
681 @end example
683 @cindex XLFD
684 @cindex X Logical Font Description
685   The third way to specify a font is to use an @dfn{XLFD} (@dfn{X
686 Logical Font Description}).  This is the traditional method for
687 specifying fonts under X@.  Each XLFD consists of fourteen words or
688 numbers, separated by dashes, like this:
690 @example
691 -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1
692 @end example
694 @noindent
695 A wildcard character (@samp{*}) in an XLFD matches any sequence of
696 characters (including none), and @samp{?} matches any single
697 character.  However, matching is implementation-dependent, and can be
698 inaccurate when wildcards match dashes in a long name.  For reliable
699 results, supply all 14 dashes and use wildcards only within a field.
700 Case is insignificant in an XLFD@.  The syntax for an XLFD is as
701 follows:
703 @example
704 -@var{maker}-@var{family}-@var{weight}-@var{slant}-@var{widthtype}-@var{style}@dots{}
705 @dots{}-@var{pixels}-@var{height}-@var{horiz}-@var{vert}-@var{spacing}-@var{width}-@var{registry}-@var{encoding}
706 @end example
708 @noindent
709 The entries have the following meanings:
711 @table @var
712 @item maker
713 The name of the font manufacturer.
714 @item family
715 The name of the font family (e.g., @samp{courier}).
716 @item weight
717 The font weight---normally either @samp{bold}, @samp{medium} or
718 @samp{light}.  Some font names support other values.
719 @item slant
720 The font slant---normally @samp{r} (roman), @samp{i} (italic),
721 @samp{o} (oblique), @samp{ri} (reverse italic), or @samp{ot} (other).
722 Some font names support other values.
723 @item widthtype
724 The font width---normally @samp{normal}, @samp{condensed},
725 @samp{semicondensed}, or @samp{extended}.  Some font names support
726 other values.
727 @item style
728 An optional additional style name.  Usually it is empty---most XLFDs
729 have two hyphens in a row at this point.  The style name can also
730 specify a two-letter ISO-639 language name, like @samp{ja} or
731 @samp{ko}; some fonts that support CJK scripts have that spelled out
732 in the style name part.
733 @item pixels
734 The font height, in pixels.
735 @item height
736 The font height on the screen, measured in tenths of a printer's
737 point.  This is the point size of the font, times ten.  For a given
738 vertical resolution, @var{height} and @var{pixels} are proportional;
739 therefore, it is common to specify just one of them and use @samp{*}
740 for the other.
741 @item horiz
742 The horizontal resolution, in pixels per inch, of the screen for which
743 the font is intended.
744 @item vert
745 The vertical resolution, in pixels per inch, of the screen for which
746 the font is intended.  Normally the resolution of the fonts on your
747 system is the right value for your screen; therefore, you normally
748 specify @samp{*} for this and @var{horiz}.
749 @item spacing
750 This is @samp{m} (monospace), @samp{p} (proportional) or @samp{c}
751 (character cell).
752 @item width
753 The average character width, in pixels, multiplied by ten.
754 @item registry
755 @itemx encoding
756 The X font character set that the font depicts.  (X font character
757 sets are not the same as Emacs character sets, but they are similar.)
758 You can use the @command{xfontsel} program to check which choices you
759 have.  Normally you should use @samp{iso8859} for @var{registry} and
760 @samp{1} for @var{encoding}.
761 @end table
763   The fourth and final method of specifying a font is to use a font
764 nickname.  Certain fonts have shorter nicknames, which you can use
765 instead of a normal font specification.  For instance, @samp{6x13} is
766 equivalent to
768 @example
769 -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1
770 @end example
772 @cindex client-side fonts
773 @cindex server-side fonts
774   On X, Emacs recognizes two types of fonts: @dfn{client-side} fonts,
775 which are provided by the Xft and Fontconfig libraries, and
776 @dfn{server-side} fonts, which are provided by the X server itself.
777 Most client-side fonts support advanced font features such as
778 antialiasing and subpixel hinting, while server-side fonts do not.
779 Fontconfig and GTK patterns match only client-side fonts.
781 @cindex listing system fonts
782   You will probably want to use a fixed-width default font---that is,
783 a font in which all characters have the same width.  For Xft and
784 Fontconfig fonts, you can use the @command{fc-list} command to list
785 the available fixed-width fonts, like this:
787 @example
788 fc-list :spacing=mono
789 fc-list :spacing=charcell
790 @end example
792 @noindent
793 For server-side X fonts, you can use the @command{xlsfonts} program to
794 list the available fixed-width fonts, like this:
796 @example
797 xlsfonts -fn '*x*' | grep -E '^[0-9]+x[0-9]+'
798 xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-m*'
799 xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-c*'
800 @end example
802 @noindent
803 Any font with @samp{m} or @samp{c} in the @var{spacing} field of the
804 XLFD is a fixed-width font.  To see what a particular font looks like,
805 use the @command{xfd} command.  For example:
807 @example
808 xfd -fn 6x13
809 @end example
811 @noindent
812 displays the entire font @samp{6x13}.
814   While running Emacs, you can also set the font of a specific kind of
815 text (@pxref{Faces}), or a particular frame (@pxref{Frame
816 Parameters}).
818 @node Speedbar
819 @section Speedbar Frames
820 @cindex speedbar
822 @cindex attached frame (of speedbar)
823   The @dfn{speedbar} is a special frame for conveniently navigating in
824 or operating on another frame.  The speedbar, when it exists, is
825 always associated with a specific frame, called its @dfn{attached
826 frame}; all speedbar operations act on that frame.
828   Type @kbd{M-x speedbar} to create the speedbar and associate it with
829 the current frame.  To dismiss the speedbar, type @kbd{M-x speedbar}
830 again, or select the speedbar and type @kbd{q}.  (You can also delete
831 the speedbar frame like any other Emacs frame.)  If you wish to
832 associate the speedbar with a different frame, dismiss it and call
833 @kbd{M-x speedbar} from that frame.
835   The speedbar can operate in various modes.  Its default mode is
836 @dfn{File Display} mode, which shows the files in the current
837 directory of the selected window of the attached frame, one file per
838 line.  Clicking on a non-directory visits that file in the selected window
839 of the attached frame, and clicking on a directory shows that
840 directory in the speedbar (@pxref{Mouse References}).  Each line also
841 has a box, @samp{[+]} or @samp{<+>}, that you can click on to
842 @dfn{expand} the contents of that item.  Expanding a directory adds
843 the contents of that directory to the speedbar display, underneath the
844 directory's own line.  Expanding an ordinary file adds a list of the
845 tags in that file to the speedbar display; you can click on a tag name
846 to jump to that tag in the selected window of the attached frame.
847 When a file or directory is expanded, the @samp{[+]} changes to
848 @samp{[-]}; you can click on that box to @dfn{contract} the item,
849 hiding its contents.
851   You navigate through the speedbar using the keyboard, too.  Typing
852 @key{RET} while point is on a line in the speedbar is equivalent to
853 clicking the item on the current line, and @key{SPC} expands or
854 contracts the item.  @kbd{U} displays the parent directory of the
855 current directory.  To copy, delete, or rename the file on the current
856 line, type @kbd{C}, @kbd{D}, and @kbd{R} respectively.  To create a
857 new directory, type @kbd{M}.
859   Another general-purpose speedbar mode is @dfn{Buffer Display} mode;
860 in this mode, the speedbar displays a list of Emacs buffers.  To
861 switch to this mode, type @kbd{b} in the speedbar.  To return to File
862 Display mode, type @kbd{f}.  You can also change the display mode by
863 clicking @kbd{mouse-3} anywhere in the speedbar window (or
864 @kbd{mouse-1} on the mode-line) and selecting @samp{Displays} in the
865 pop-up menu.
867   Some major modes, including Rmail mode, Info, and GUD, have
868 specialized ways of putting useful items into the speedbar for you to
869 select.  For example, in Rmail mode, the speedbar shows a list of Rmail
870 files, and lets you move the current message to another Rmail file by
871 clicking on its @samp{<M>} box.
873   For more details on using and programming the speedbar, @xref{Top,
874 Speedbar,,speedbar, Speedbar Manual}.
876 @node Multiple Displays
877 @section Multiple Displays
878 @cindex multiple displays
880   A single Emacs can talk to more than one X display.  Initially, Emacs
881 uses just one display---the one specified with the @env{DISPLAY}
882 environment variable or with the @samp{--display} option (@pxref{Initial
883 Options}).  To connect to another display, use the command
884 @code{make-frame-on-display}:
886 @findex make-frame-on-display
887 @table @kbd
888 @item M-x make-frame-on-display @key{RET} @var{display} @key{RET}
889 Create a new frame on display @var{display}.
890 @end table
892   A single X server can handle more than one screen.  When you open
893 frames on two screens belonging to one server, Emacs knows they share a
894 single keyboard, and it treats all the commands arriving from these
895 screens as a single stream of input.
897   When you open frames on different X servers, Emacs makes a separate
898 input stream for each server.  Each server also has its own selected
899 frame.  The commands you enter with a particular X server apply to
900 that server's selected frame.
902 @node Frame Parameters
903 @section Frame Parameters
904 @cindex default-frame-alist
906   You can control the default appearance and behavior of all frames by
907 specifying a default list of @dfn{frame parameters} in the variable
908 @code{default-frame-alist}.  Its value should be a list of entries,
909 each specifying a parameter name and a value for that parameter.
910 These entries take effect whenever Emacs creates a new frame,
911 including the initial frame.
913 @cindex frame size, specifying default
914   For example, you can add the following lines to your init file
915 (@pxref{Init File}) to set the default frame width to 90 character
916 columns, the default frame height to 40 character rows, and the
917 default font to @samp{Monospace-10}:
919 @example
920 (add-to-list 'default-frame-alist '(width  . 90))
921 (add-to-list 'default-frame-alist '(height . 40))
922 (add-to-list 'default-frame-alist '(font . "Monospace-10"))
923 @end example
925   For a list of frame parameters and their effects, see @ref{Frame
926 Parameters,,, elisp, The Emacs Lisp Reference Manual}.
928 @cindex initial-frame-alist
929   You can also specify a list of frame parameters which apply to just
930 the initial frame, by customizing the variable
931 @code{initial-frame-alist}.
933   If Emacs is compiled to use an X toolkit, frame parameters that
934 specify colors and fonts don't affect menus and the menu bar, since
935 those are drawn by the toolkit and not directly by Emacs.
937   Note that if you are using the desktop library to save and restore
938 your sessions, the frames to be restored are recorded in the desktop
939 file, together with their parameters.  When these frames are restored,
940 the recorded parameters take precedence over the frame parameters
941 specified by @code{default-frame-alist} and @code{initial-frame-alist}
942 in your init file.  @xref{Saving Emacs Sessions}, for how to avoid
943 that.
945 @node Scroll Bars
946 @section Scroll Bars
947 @cindex Scroll Bar mode
948 @cindex mode, Scroll Bar
949 @cindex Vertical Scroll Bar
951   On graphical displays, there is a @dfn{vertical scroll bar} on the
952 side of each Emacs window.  Clicking @kbd{mouse-1} on the scroll bar's
953 up and down buttons scrolls the window by one line at a time (but some
954 toolkits allow you to customize the scroll bars to not have those
955 buttons).  Clicking @kbd{mouse-1} above or below the scroll bar's
956 inner box scrolls the window by nearly the entire height of the
957 window, like @kbd{M-v} and @kbd{C-v} respectively (@pxref{Moving
958 Point}).  (This, too, can behave differently with some toolkits.)
959 Dragging the inner box scrolls continuously.
961   If Emacs is compiled on the X Window System without X toolkit
962 support, the scroll bar behaves differently.  Clicking @kbd{mouse-1}
963 anywhere on the scroll bar scrolls forward like @kbd{C-v}, while
964 @kbd{mouse-3} scrolls backward like @kbd{M-v}.  Clicking @kbd{mouse-2}
965 in the scroll bar lets you drag the inner box up and down.
967 @findex scroll-bar-mode
968 @findex toggle-scroll-bar
969   To toggle the use of vertical scroll bars, type @kbd{M-x
970 scroll-bar-mode}.  This command applies to all frames, including frames
971 yet to be created.  To toggle vertical scroll bars for just the selected
972 frame, use the command @kbd{M-x toggle-scroll-bar}.
974 @vindex scroll-bar-mode
975   To control the use of vertical scroll bars at startup, customize the
976 variable @code{scroll-bar-mode}.  Its value should be either
977 @code{right} (put scroll bars on the right side of windows), @code{left}
978 (put them on the left), or @code{nil} (disable vertical scroll bars).
979 By default, Emacs puts scroll bars on the right if it was compiled with
980 GTK+ support on the X Window System, and on MS-Windows or macOS; Emacs
981 puts scroll bars on the left if compiled on the X Window System without
982 GTK+ support (following the old convention for X applications).
984 @vindex scroll-bar-width
985 @cindex width of the vertical scroll bar
986   You can also use the X resource @samp{verticalScrollBars} to enable
987 or disable the scroll bars (@pxref{Resources}).  To control the scroll
988 bar width, change the @code{scroll-bar-width} frame parameter
989 (@pxref{Frame Parameters,,, elisp, The Emacs Lisp Reference Manual}).
991 @vindex scroll-bar-adjust-thumb-portion
992 @cindex overscrolling
993 If you're using Emacs on X (with GTK+ or Motif), you can customize the
994 variable @code{scroll-bar-adjust-thumb-portion} to control
995 @dfn{overscrolling} of the scroll bar, i.e., dragging the thumb down even
996 when the end of the buffer is visible.  If its value is
997 non-@code{nil}, the scroll bar can be dragged downwards even if the
998 end of the buffer is shown; if @code{nil}, the thumb will be at the
999 bottom when the end of the buffer is shown.  You cannot over-scroll
1000 when the entire buffer is visible.
1002 @cindex scroll-bar face
1003   The visual appearance of the scroll bars is controlled by the
1004 @code{scroll-bar} face.  (Some toolkits, such as GTK and MS-Windows,
1005 ignore this face; the scroll-bar appearance there can only be
1006 customized system-wide, for GTK @pxref{GTK resources}).
1008 @cindex vertical border
1009   On graphical frames, vertical scroll bars implicitly serve to separate
1010 side-by-side windows visually.  When vertical scroll bars are disabled,
1011 Emacs by default separates such windows with the help of a one-pixel
1012 wide @dfn{vertical border}.  That border occupies the first pixel column
1013 of the window on the right and may thus overdraw the leftmost pixels of
1014 any glyph displayed there.  If these pixels convey important
1015 information, you can make them visible by enabling window dividers, see
1016 @ref{Window Dividers}.  To replicate the look of vertical borders, set
1017 the @code{right-divider-width} parameter of frames to one and have the
1018 @code{window-divider} face inherit from that of @code{vertical-border},
1019 @ref{Window Dividers,, Window Dividers, elisp, The Emacs Lisp Reference
1020 Manual}.
1022 @cindex Horizontal Scroll Bar
1023 @cindex Horizontal Scroll Bar mode
1024   On graphical displays with toolkit support, Emacs may also supply a
1025 @dfn{horizontal scroll bar} on the bottom of each window.  Clicking
1026 @kbd{mouse-1} on that scroll bar's left and right buttons scrolls the
1027 window horizontally by one column at a time.  (Note that some toolkits
1028 allow customizations of the scroll bar that cause these buttons not to
1029 be shown.)  Clicking @kbd{mouse-1} on the left or right of the scroll
1030 bar's inner box scrolls the window by four columns.  Dragging the
1031 inner box scrolls the window continuously.
1033   Note that such horizontal scrolling can make the window's position of
1034 point disappear on the left or the right.  Typing a character to insert
1035 text or moving point with a keyboard command will usually bring it back
1036 into view.
1038 @findex horizontal-scroll-bar-mode
1039   To toggle the use of horizontal scroll bars, type @kbd{M-x
1040 horizontal-scroll-bar-mode}.  This command applies to all frames,
1041 including frames yet to be created.  To toggle horizontal scroll bars
1042 for just the selected frame, use the command @kbd{M-x
1043 toggle-horizontal-scroll-bar}.
1045 @vindex horizontal-scroll-bar-mode
1046   To control the use of horizontal scroll bars at startup, customize the
1047 variable @code{horizontal-scroll-bar-mode}.
1049 @vindex scroll-bar-height
1050 @cindex height of the horizontal scroll bar
1051   You can also use the X resource @samp{horizontalScrollBars} to enable
1052 or disable horizontal scroll bars (@pxref{Resources}).  To control the
1053 scroll bar height, change the @code{scroll-bar-height} frame parameter
1054 (@pxref{Frame Parameters,,, elisp, The Emacs Lisp Reference Manual}).
1056 @node Window Dividers
1057 @section Window Dividers
1058 @cindex Window Divider mode
1059 @cindex mode, Window Divider
1061   On graphical displays, you can use @dfn{window dividers} in order to
1062 separate windows visually.  Window dividers are bars that can be dragged
1063 with the mouse, thus allowing you to easily resize adjacent windows.
1065 @findex window-divider-mode
1066   To toggle the display of window dividers, use the command @kbd{M-x
1067 window-divider-mode}.
1069 @vindex window-divider-default-places
1070   To customize where dividers should appear, use the option
1071 @code{window-divider-default-places}.  Its value should be either
1072 @code{bottom-only} (to show dividers only on the bottom of windows),
1073 @code{right-only} (to show dividers only on the right of windows), or
1074 @code{t} (to show them on the bottom and on the right).
1076 @vindex window-divider-default-bottom-width
1077 @vindex window-divider-default-right-width
1078   To adjust the width of window dividers displayed by this mode
1079 customize the options @code{window-divider-default-bottom-width} and
1080 @code{window-divider-default-right-width}.
1082   When vertical scroll bars are disabled, dividers can be also useful to
1083 make the first pixel column of a window visible, which would be otherwise
1084 covered by the vertical border used to separate side-by-side windows
1085 (@pxref{Scroll Bars}).
1087 For more details about window dividers see @ref{Window Dividers,,
1088 Window Dividers, elisp, The Emacs Lisp Reference Manual}.
1090 @node Drag and Drop
1091 @section Drag and Drop
1092 @cindex drag and drop
1094   In most graphical desktop environments, Emacs has basic support for
1095 @dfn{drag and drop} operations.  For instance, dropping text onto an
1096 Emacs frame inserts the text where it is dropped.  Dropping a file
1097 onto an Emacs frame visits that file.  As a special case, dropping the
1098 file on a Dired buffer moves or copies the file (according to the
1099 conventions of the application it came from) into the directory
1100 displayed in that buffer.
1102 @vindex dnd-open-file-other-window
1103   Dropping a file normally visits it in the window you drop it on.  If
1104 you prefer to visit the file in a new window in such cases, customize
1105 the variable @code{dnd-open-file-other-window}.
1107   The XDND and Motif drag and drop protocols, and the old KDE 1.x
1108 protocol, are currently supported.
1110 @vindex mouse-drag-and-drop-region
1111   Emacs can also optionally drag the region with the mouse into
1112 another portion of this or another buffer.  To enable that, customize
1113 the variable @code{mouse-drag-and-drop-region} to a non-@code{nil}
1114 value.  Normally, the text is moved, i.e. cut and pasted, when the
1115 destination is the same buffer as the origin; dropping the region on
1116 another buffer copies the text instead.  If the value of this variable
1117 names a modifier key, such as @samp{shift}, @samp{control} or
1118 @samp{alt}, then pressing that modifier key when dropping the text
1119 will copy it instead of cutting it, even if you drop on the same
1120 buffer as the one from which the text came.
1122 @vindex mouse-drag-and-drop-region-cut-when-buffers-differ
1123 @vindex mouse-drag-and-drop-region-show-tooltip
1124 @vindex mouse-drag-and-drop-region-show-cursor
1125 In order to cut text even when source and destination buffers differ,
1126 set the option
1127 @code{mouse-drag-and-drop-region-cut-when-buffers-differ} to a
1128 non-@code{nil} value.  By default, on a graphic display the selected
1129 text is shown in a tooltip and point moves together with the mouse
1130 cursor during dragging.  To suppress such behavior, set the options
1131 @code{mouse-drag-and-drop-region-show-tooltip} and/or
1132 @code{mouse-drag-and-drop-region-show-cursor} to @code{nil}.
1135 @node Menu Bars
1136 @section Menu Bars
1137 @cindex Menu Bar mode
1138 @cindex mode, Menu Bar
1139 @findex menu-bar-mode
1140 @vindex menu-bar-mode
1142   You can toggle the use of menu bars with @kbd{M-x menu-bar-mode}.
1143 With no argument, this command toggles Menu Bar mode, a global minor
1144 mode.  With an argument, the command turns Menu Bar mode on if the
1145 argument is positive, off if the argument is not positive.  To control
1146 the use of menu bars at startup, customize the variable
1147 @code{menu-bar-mode}.
1149 @kindex C-mouse-3 @r{(when menu bar is disabled)}
1150   Expert users often turn off the menu bar, especially on text
1151 terminals, where this makes one additional line available for text.
1152 If the menu bar is off, you can still pop up a menu of its contents
1153 with @kbd{C-mouse-3} on a display which supports pop-up menus.
1154 @xref{Menu Mouse Clicks}.
1156   @xref{Menu Bar}, for information on how to invoke commands with the
1157 menu bar.  @xref{X Resources}, for how to customize the menu bar
1158 menus' visual appearance.
1160 @node Tool Bars
1161 @section Tool Bars
1162 @cindex Tool Bar mode
1163 @cindex mode, Tool Bar
1164 @cindex icons, toolbar
1166   On graphical displays, Emacs puts a @dfn{tool bar} at the top of
1167 each frame, just below the menu bar.  This is a row of icons which you
1168 can click on with the mouse to invoke various commands.
1170   The global (default) tool bar contains general commands.  Some major
1171 modes define their own tool bars; whenever a buffer with such a major
1172 mode is current, the mode's tool bar replaces the global tool bar.
1174 @findex tool-bar-mode
1175 @vindex tool-bar-mode
1176   To toggle the use of tool bars, type @kbd{M-x tool-bar-mode}.  This
1177 command applies to all frames, including frames yet to be created.  To
1178 control the use of tool bars at startup, customize the variable
1179 @code{tool-bar-mode}.
1181 @vindex tool-bar-style
1182 @cindex Tool Bar style
1183   When Emacs is compiled with GTK+ support, each tool bar item can
1184 consist of an image, or a text label, or both.  By default, Emacs
1185 follows the Gnome desktop's tool bar style setting; if none is
1186 defined, it displays tool bar items as just images.  To impose a
1187 specific tool bar style, customize the variable @code{tool-bar-style}.
1189 @cindex Tool Bar position
1190   You can also control the placement of the tool bar for the GTK+ tool
1191 bar with the frame parameter @code{tool-bar-position}.  @xref{Frame
1192 Parameters,,, elisp, The Emacs Lisp Reference Manual}.
1194   NS builds consider the tool bar to be a window decoration, and
1195 therefore do not display it when a window is undecorated.  @xref{Frame
1196 Parameters,,, elisp, The Emacs Lisp Reference Manual}.  On macOS the
1197 tool bar is hidden when the frame is put into fullscreen, but can be
1198 displayed by moving the mouse pointer to the top of the screen.
1200 @node Dialog Boxes
1201 @section Using Dialog Boxes
1202 @cindex dialog boxes
1204 @vindex use-dialog-box
1205   A dialog box is a special kind of menu for asking you a yes-or-no
1206 question or some other special question.  Many Emacs commands use a
1207 dialog box to ask a yes-or-no question, if you used the mouse to
1208 invoke the command that led to the question.
1210   To disable the use of dialog boxes, change the variable
1211 @code{use-dialog-box} to @code{nil}.  In that case, Emacs always
1212 performs yes-or-no prompts using the echo area and keyboard input.
1213 This variable also controls whether to use file selection windows (but
1214 those are not supported on all platforms).
1216 @vindex use-file-dialog
1217 @cindex file selection dialog, how to disable
1218   A file selection window is a special kind of dialog box for asking
1219 for file names.  You can customize the variable @code{use-file-dialog}
1220 to suppress the use of file selection windows, even if you still want
1221 other kinds of dialogs.  This variable has no effect if you have
1222 suppressed all dialog boxes with the variable @code{use-dialog-box}.
1224 @vindex x-gtk-show-hidden-files
1225 @vindex x-gtk-file-dialog-help-text
1226 @cindex hidden files, in GTK+ file chooser
1227 @cindex help text, in GTK+ file chooser
1228   When Emacs is compiled with GTK+ support, it uses the GTK+ file
1229 chooser dialog.  Emacs adds an additional toggle button to this
1230 dialog, which you can use to enable or disable the display of hidden
1231 files (files starting with a dot) in that dialog.  If you want this
1232 toggle to be activated by default, change the variable
1233 @code{x-gtk-show-hidden-files} to @code{t}.  In addition, Emacs adds
1234 help text to the GTK+ file chooser dialog; to disable this help text,
1235 change the variable @code{x-gtk-file-dialog-help-text} to @code{nil}.
1237 @node Tooltips
1238 @section Tooltips
1239 @cindex tooltips
1241   @dfn{Tooltips} are small special frames that display text
1242 information at the current mouse position.  They activate when there
1243 is a pause in mouse movement over some significant piece of text in a
1244 window, or the mode line, or some other part of the Emacs frame such
1245 as a tool bar button or menu item.
1247 @findex tooltip-mode
1248   You can toggle the use of tooltips with the command @kbd{M-x
1249 tooltip-mode}.  When Tooltip mode is disabled, the help text is
1250 displayed in the echo area instead.  To control the use of tooltips at
1251 startup, customize the variable @code{tooltip-mode}.
1253 The following variables provide customization options for tooltip
1254 display:
1256 @vtable @code
1257 @item tooltip-delay
1258 This variable specifies how long Emacs should wait before displaying
1259 the first tooltip.  The value is in seconds.
1261 @item tooltip-short-delay
1262 This variable specifies how long Emacs should wait before displaying
1263 subsequent tooltips on different items, having already displayed the
1264 first tooltip.  The value is in seconds.
1266 @item tooltip-hide-delay
1267 The number of seconds since displaying a tooltip to hide it, if the
1268 mouse doesn't move.
1270 @item tooltip-x-offset
1271 @itemx tooltip-y-offset
1272 The X and Y offsets, in pixels, of the left top corner of the tooltip
1273 from the mouse pointer position.  Note that these are ignored if
1274 @code{tooltip-frame-parameters} was customized to include,
1275 respectively, the @code{left} and @code{top} parameters.  The values
1276 of the offsets should be chosen so that the tooltip doesn't cover the
1277 mouse pointer's hot spot, or it might interfere with clicking the
1278 mouse.
1280 @item tooltip-frame-parameters
1281 The frame parameters used for displaying tooltips.  @xref{Frame
1282 Parameters,,, elisp, The Emacs Lisp Reference Manual}, and also
1283 @ref{Tooltips,,, elisp, The Emacs Lisp Reference Manual}.
1284 @end vtable
1286 For additional customization options for displaying tooltips, use
1287 @kbd{M-x customize-group @key{RET} tooltip @key{RET}}.
1289 @vindex x-gtk-use-system-tooltips
1290   If Emacs is built with GTK+ support, it displays tooltips via GTK+,
1291 using the default appearance of GTK+ tooltips.  To disable this,
1292 change the variable @code{x-gtk-use-system-tooltips} to @code{nil}.
1293 If you do this, or if Emacs is built without GTK+ support, most
1294 attributes of the tooltip text are specified by the @code{tooltip}
1295 face, and by X resources (@pxref{X Resources}).
1297   @dfn{GUD tooltips} are special tooltips that show the values of
1298 variables when debugging a program with GUD@.  @xref{Debugger
1299 Operation}.
1301 @node Mouse Avoidance
1302 @section Mouse Avoidance
1303 @cindex avoiding mouse in the way of your typing
1304 @cindex mouse avoidance
1306   On graphical terminals, the mouse pointer may obscure the text in
1307 the Emacs frame.  Emacs provides two methods to avoid this problem.
1309   Firstly, Emacs hides the mouse pointer each time you type a
1310 self-inserting character, if the pointer lies inside an Emacs frame;
1311 moving the mouse pointer makes it visible again.  To disable this
1312 feature, set the variable @code{make-pointer-invisible} to @code{nil}.
1313 @xref{Display Custom}.
1315 @vindex mouse-avoidance-mode
1316   Secondly, you can use Mouse Avoidance mode, a minor mode, to keep
1317 the mouse pointer away from point.  To use Mouse Avoidance mode,
1318 customize the variable @code{mouse-avoidance-mode}.  You can set this
1319 to various values to move the mouse in several ways:
1321 @table @code
1322 @item banish
1323 Move the pointer to a corner of the frame on any key-press.  You can
1324 customize the variable @code{mouse-avoidance-banish-position} to
1325 specify where the pointer goes when it is banished.
1326 @item exile
1327 Banish the pointer only if the cursor gets too close, and allow it to
1328 return once the cursor is out of the way.
1329 @item jump
1330 If the cursor gets too close to the pointer, displace the pointer by a
1331 random distance and direction.
1332 @item animate
1333 As @code{jump}, but shows steps along the way for illusion of motion.
1334 @item cat-and-mouse
1335 The same as @code{animate}.
1336 @item proteus
1337 As @code{animate}, but changes the shape of the mouse pointer too.
1338 @end table
1340 @findex mouse-avoidance-mode
1341 You can also use the command @kbd{M-x mouse-avoidance-mode} to enable
1342 the mode.  Whenever Mouse Avoidance mode moves the mouse, it also
1343 raises the frame.
1345 @node Non-Window Terminals
1346 @section Non-Window Terminals
1347 @cindex text terminal
1349   On a text terminal, Emacs can display only one Emacs frame at a
1350 time.  However, you can still create multiple Emacs frames, and switch
1351 between them.  Switching frames on these terminals is much like
1352 switching between different window configurations.
1354   Use @kbd{C-x 5 2} to create a new frame and switch to it; use @kbd{C-x
1355 5 o} to cycle through the existing frames; use @kbd{C-x 5 0} to delete
1356 the current frame.
1358   Each frame has a number to distinguish it.  If your terminal can
1359 display only one frame at a time, the selected frame's number @var{n}
1360 appears near the beginning of the mode line, in the form
1361 @samp{F@var{n}}.
1363 @findex set-frame-name
1364 @findex select-frame-by-name
1365   @samp{F@var{n}} is in fact the frame's initial name.  You can give
1366 frames more meaningful names if you wish, and you can select a frame
1367 by its name.  Use the command @kbd{M-x set-frame-name @key{RET}
1368 @var{name} @key{RET}} to specify a new name for the selected frame,
1369 and use @kbd{M-x select-frame-by-name @key{RET} @var{name} @key{RET}}
1370 to select a frame according to its name.  The name you specify appears
1371 in the mode line when the frame is selected.
1373 @node Text-Only Mouse
1374 @section Using a Mouse in Text Terminals
1375 @cindex mouse support
1376 @cindex terminal emulators, mouse support
1378 Some text terminals support mouse clicks in the terminal window.
1380 @cindex xterm
1381   In a terminal emulator which is compatible with @command{xterm}, you
1382 can use @kbd{M-x xterm-mouse-mode} to give Emacs control over simple
1383 uses of the mouse---basically, only non-modified single clicks are
1384 supported.  Newer versions of @command{xterm} also support
1385 mouse-tracking.  The normal @command{xterm} mouse functionality for
1386 such clicks is still available by holding down the @key{SHIFT} key
1387 when you press the mouse button.  Xterm Mouse mode is a global minor
1388 mode (@pxref{Minor Modes}).  Repeating the command turns the mode off
1389 again.
1391 @findex gpm-mouse-mode
1392   In the console on GNU/Linux, you can use @kbd{M-x gpm-mouse-mode} to
1393 enable mouse support.  You must have the gpm server installed and
1394 running on your system in order for this to work.  Note that when
1395 this mode is enabled, you cannot use the mouse to transfer text
1396 between Emacs and other programs which use GPM.  This is due to
1397 limitations in GPM and the Linux kernel.
1399 @iftex
1400 @xref{MS-DOS Mouse,,,emacs-xtra,Specialized Emacs Features},
1401 @end iftex
1402 @ifnottex
1403 @xref{MS-DOS Mouse},
1404 @end ifnottex
1405 for information about mouse support on MS-DOS.