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