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