aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-10-15 16:59:03 +0000
committerChong Yidong2008-10-15 16:59:03 +0000
commit2aee6012cfcf709a8ced33d3a6469c18d198e406 (patch)
tree1977eaadd7540099bfa9ca0ca11e6e99c957fb63
parentb0f95216d2f91953d04370318624580c6be21124 (diff)
downloademacs-2aee6012cfcf709a8ced33d3a6469c18d198e406.tar.gz
emacs-2aee6012cfcf709a8ced33d3a6469c18d198e406.zip
(Mouse Commands, Cut/Paste Other App): Rewrite.
(Cut/Paste Other App): Document select-active-regions and x-select-enable-primary.
-rw-r--r--doc/emacs/frames.texi350
1 files changed, 189 insertions, 161 deletions
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index ccea345d13b..c9a8bb84a3f 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -6,24 +6,22 @@
6@chapter Frames and Graphical Displays 6@chapter Frames and Graphical Displays
7@cindex frames 7@cindex frames
8 8
9 When using a graphical display, you can create multiple windows at 9 When using a graphical display, you can create multiple system-level
10the system in a single Emacs session. Each system-level window that 10``windows'' in a single Emacs session. We refer to these system-level
11belongs to Emacs displays a @dfn{frame} which can contain one or 11windows as @dfn{frames}. A frame initially contains a single Emacs
12several Emacs windows. A frame initially contains a single 12window; however, you can subdivide this Emacs window into smaller
13general-purpose Emacs window which you can subdivide vertically or 13windows, all fitting into the same frame. Each frame normally
14horizontally into smaller windows. A frame normally contains its own 14contains its own echo area and minibuffer.
15echo area and minibuffer, but you can make frames that don't have
16these---they use the echo area and minibuffer of another frame.
17 15
18 To avoid confusion, we reserve the word ``window'' for the 16 To avoid confusion, we reserve the word ``window'' for the
19subdivisions that Emacs implements, and never use it to refer to a 17subdivisions that Emacs implements, and never use it to refer to a
20frame. 18frame.
21 19
22 Editing you do in one frame affects the other frames. For 20 Any editing you do in one frame affects the other frames. For
23instance, if you put text in the kill ring in one frame, you can yank it 21instance, if you put text in the kill ring in one frame, you can yank
24in another frame. If you exit Emacs through @kbd{C-x C-c} in one frame, 22it in another frame. If you exit Emacs through @kbd{C-x C-c} in one
25it terminates all the frames. To delete just one frame, use @kbd{C-x 5 23frame, it terminates all the frames. To delete just one frame, use
260} (that is zero, not @kbd{o}). 24@kbd{C-x 5 0} (that is zero, not @kbd{o}).
27 25
28 Emacs compiled for MS-DOS emulates some windowing functionality, 26 Emacs compiled for MS-DOS emulates some windowing functionality,
29so that you can use many of the features described in this chapter. 27so that you can use many of the features described in this chapter.
@@ -60,13 +58,13 @@ so that you can use many of the features described in this chapter.
60@node Cut and Paste 58@node Cut and Paste
61@section Killing and Yanking on Graphical Displays 59@section Killing and Yanking on Graphical Displays
62 60
63 This section describes facilities for selecting a region, killing, 61 This section describes commands for selecting a region, killing, and
64and yanking using the mouse. 62yanking using the mouse.
65 63
66@menu 64@menu
67* Mouse Commands:: Moving, cutting, and pasting, with the mouse. 65* Mouse Commands:: Moving, cutting, and pasting, with the mouse.
68* Cut/Paste Other App:: Transfering text between Emacs and other apps.
69* Word and Line Mouse:: Mouse commands for selecting whole words or lines. 66* Word and Line Mouse:: Mouse commands for selecting whole words or lines.
67* Cut/Paste Other App:: Transfering text between Emacs and other apps.
70* Secondary Selection:: Cutting without altering point and mark. 68* Secondary Selection:: Cutting without altering point and mark.
71* Clipboard:: Using the clipboard for selections. 69* Clipboard:: Using the clipboard for selections.
72@end menu 70@end menu
@@ -75,189 +73,219 @@ and yanking using the mouse.
75@subsection Mouse Commands for Editing 73@subsection Mouse Commands for Editing
76@cindex mouse buttons (what they do) 74@cindex mouse buttons (what they do)
77 75
78 The mouse commands for selecting and copying a region are mostly
79compatible with the @code{xterm} program. You can use the same mouse
80commands for copying between Emacs and other window-based programs.
81Most of these commands also work in Emacs when you run it under an
82@code{xterm} terminal.
83
84@kindex DELETE @r{(and mouse selection)}
85 If you select a region with any of these mouse commands, and then
86immediately afterward type the @key{DELETE} function key, it deletes the
87region that you selected. The @key{BACKSPACE} function key and the
88@acronym{ASCII} character @key{DEL} do not do this; if you type any other key
89in between the mouse command and @key{DELETE}, it does not do this.
90
91@findex mouse-set-region
92@findex mouse-set-point
93@findex mouse-yank-at-click
94@findex mouse-save-then-click
95@kindex Mouse-1 76@kindex Mouse-1
96@kindex Mouse-2 77@kindex Mouse-2
97@kindex Mouse-3 78@kindex Mouse-3
98@table @kbd 79@table @key
99@item Mouse-1 80@item Mouse-1
100Move point to where you click (@code{mouse-set-point}). 81Move point to where you click (@code{mouse-set-point}).
101This is normally the left button. 82
83@item Drag-Mouse-1
84Activate the region around the text selected by dragging, and copy it
85to the kill ring (@code{mouse-set-region}).
86
87@item Mouse-2
88Yank the last killed text at the click position
89(@code{mouse-yank-at-click}).
90
91@item Mouse-3
92If the region is active, move the nearer end of the region to the
93click position; otherwise, set mark at the current value of point and
94point at the click position. Save the resulting region in the kill
95ring; 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
100called by clicking with the left mouse button, @key{Mouse-1}, in the
101text area of a window. This moves point to the position where you
102clicked.
102 103
103@vindex x-mouse-click-focus-ignore-position 104@vindex x-mouse-click-focus-ignore-position
104Normally, Emacs does not distinguish between ordinary mouse clicks and 105 Normally, Emacs does not distinguish between ordinary mouse clicks
105clicks that select a frame. When you click on a frame to select it, 106and clicks that select a frame. When you click on a frame to select
106that also changes the selected window and cursor position according to 107it, that also changes the selected window and cursor position
107the mouse click position. On the X window system, you can change this 108according to the mouse click position. On the X window system, you
108behavior by setting the variable 109can change this behavior by setting the variable
109@code{x-mouse-click-focus-ignore-position} to @code{t}. Then the 110@code{x-mouse-click-focus-ignore-position} to @code{t}. Then the
110first click selects the frame, but does not affect the selected window 111first click selects the frame, but does not affect the selected window
111or cursor position. If you click again in the same place, since that 112or cursor position. If you click again in the same place, that click
112click will be in the selected frame, it will change the window or 113will be in the selected frame, so it will change the window or cursor
113cursor position. 114position.
114 115
115@item Drag-Mouse-1 116@findex mouse-set-region
116Set the region to the text you select by dragging, and copy it to the 117@vindex mouse-drag-copy-region
117kill ring (@code{mouse-set-region}). You can specify both ends of the 118 Holding down @key{Mouse-1} and ``dragging'' the mouse over a stretch
118region with this single command. 119of text activates the region around that text
120(@code{mouse-set-region}). @xref{Mark}. Emacs places the mark where
121you started holding down the mouse button, and point where you release
122it. In addition, the region is copied into the kill ring (@pxref{Kill
123Ring}). If you don't want Emacs to copy the region, change the
124variable @code{mouse-drag-copy-region} to @code{nil}.
119 125
120@vindex mouse-scroll-min-lines 126@vindex mouse-scroll-min-lines
121If you move the mouse off the top or bottom of the window while 127 If you move the mouse off the top or bottom of the window while
122dragging, the window scrolls at a steady rate until you move the mouse 128dragging, the window scrolls at a steady rate until you move the mouse
123back into the window. This way, you can select regions that don't fit 129back into the window. This way, you can select regions that don't fit
124entirely on the screen. The number of lines scrolled per step depends 130entirely on the screen. The number of lines scrolled per step depends
125on how far away from the window edge the mouse has gone; the variable 131on how far away from the window edge the mouse has gone; the variable
126@code{mouse-scroll-min-lines} specifies a minimum step size. 132@code{mouse-scroll-min-lines} specifies a minimum step size.
127 133
128@vindex mouse-drag-copy-region 134@findex mouse-yank-at-click
129If the variable @code{mouse-drag-copy-region} is @code{nil}, this
130mouse command does not copy the selected region into the kill ring.
131
132@item Mouse-2
133Yank the last killed text, where you click (@code{mouse-yank-at-click}).
134This is normally the middle button.
135
136@item Mouse-3
137This command, @code{mouse-save-then-kill}, has several functions
138depending on where you click and the status of the region.
139
140The most basic case is when you click @kbd{Mouse-1} in one place and
141then @kbd{Mouse-3} in another. This selects the text between those two
142positions as the region. It also copies the new region to the kill
143ring, so that you can copy it to someplace else.
144
145If you click @kbd{Mouse-1} in the text, scroll with the scroll bar, and
146then click @kbd{Mouse-3}, it remembers where point was before scrolling
147(where you put it with @kbd{Mouse-1}), and uses that position as the
148other end of the region. This is so that you can select a region that
149doesn't fit entirely on the screen.
150
151More generally, if you do not have a highlighted region, @kbd{Mouse-3}
152selects the text between point and the click position as the region. It
153does this by setting the mark where point was, and moving point to where
154you click.
155
156If you have a highlighted region, or if the region was set just before
157by dragging button 1, @kbd{Mouse-3} adjusts the nearer end of the region
158by moving it to where you click. The adjusted region's text also
159replaces the old region's text in the kill ring.
160
161If you originally specified the region using a double or triple
162@kbd{Mouse-1}, so that the region is defined to consist of entire words
163or lines, then adjusting the region with @kbd{Mouse-3} also proceeds by
164entire words or lines.
165
166If you use @kbd{Mouse-3} a second time consecutively, at the same place,
167that kills the region already selected.
168@end table
169
170 The simplest way to kill text with the mouse is to press @kbd{Mouse-1}
171at one end, then press @kbd{Mouse-3} twice at the other end.
172@xref{Killing}. To copy the text into the kill ring without deleting it
173from the buffer, press @kbd{Mouse-3} just once---or just drag across the
174text with @kbd{Mouse-1}. Then you can copy it elsewhere by yanking it.
175
176@vindex mouse-yank-at-point 135@vindex mouse-yank-at-point
177 To yank the killed or copied text somewhere else, move the mouse there 136 Clicking with the middle mouse button, @key{Mouse-2}, moves point to
178and press @kbd{Mouse-2}. @xref{Yanking}. However, if 137the position where you clicked and performs a yank
179@code{mouse-yank-at-point} is non-@code{nil}, @kbd{Mouse-2} yanks at 138(@code{mouse-yank-at-click}). @xref{Yanking}. If you change the
180point. Then it does not matter where you click, or even which of the 139variable @code{mouse-yank-at-point} to a non-@code{nil} value,
181frame's windows you click on. The default value is @code{nil}. This 140@kbd{Mouse-2} does not move point. Then it does not matter where you
182variable also affects yanking the secondary selection. 141click, or even which of the frame's windows you click on; the yank
142occurs at the existing point. This variable also affects yanking the
143primary and secondary selections (@pxref{Cut/Paste Other App}).
144
145@findex mouse-save-then-kill
146 Clicking with the right mouse button, @key{Mouse-3}, runs the
147command @code{mouse-save-then-kill}. This performs several actions
148depending on where you click and the status of the region:
149
150@itemize @bullet
151@item
152If no region is active, clicking @key{Mouse-3} activates the region,
153placing the mark where point was and point at the clicked position.
154In addition, the text in the region is copied to the kill ring.
155
156@item
157If a region is active, clicking @key{Mouse-3} adjusts the nearer end
158of the region by moving it to the clicked position. The adjusted
159region's text is copied to the kill ring; if the text in the original
160region was already on the kill ring, it replaces it there.
161
162@item
163If you originally specified the region using a double or triple
164@key{Mouse-1}, so that the region is defined to consist of entire
165words or lines, then adjusting the region with @key{Mouse-3} also
166proceeds by entire words or lines.
167
168@item
169If you use @key{Mouse-3} a second time consecutively, at the same
170place, that kills the region already selected. Thus, the simplest way
171to kill text with the mouse is to click @key{Mouse-1} at one end, then
172click @key{Mouse-3} twice at the other end. To copy the text into the
173kill ring without deleting it from the buffer, press @key{Mouse-3}
174just once---or just drag across the text with @key{Mouse-1}. Then you
175can copy it elsewhere by yanking it.
176@end itemize
177
178 Whenever you set the region using any of the mouse commands
179described above, the mark will be deactivated by any subsequent
180unshifted cursor motion command, in addition to the usual ways of
181deactivating the mark. @xref{Shift Selection}. While the region
182remains active, typing @key{Backspace} or @key{Delete} deletes the
183text in that region and deactivates the mark; this behavior follows a
184convention established by other graphical programs, and it does
185@emph{not} apply when you set the region any other way, including
186shift-selection (@pxref{Shift Selection}).
183 187
184@cindex Delete Selection mode 188@cindex Delete Selection mode
185@cindex mode, Delete Selection 189@cindex mode, Delete Selection
186@findex delete-selection-mode 190@findex delete-selection-mode
187 Many graphical applications follow the convention that insertion 191 Many graphical applications also follow the convention that
188while text is selected deletes the selected text. You can make Emacs 192insertion while text is selected deletes the selected text. You can
189behave this way by enabling Delete Selection mode---with @kbd{M-x 193make Emacs behave this way by typing @kbd{M-x delete-selection-mode}.
190delete-selection-mode} or using Custom. Another effect of this mode 194This enables a minor mode named Delete Selection mode. Another effect
191is that some keys, such as @key{DEL} and @kbd{C-d}, kill the region if 195of this mode is that some keys, such as @key{DEL} and @kbd{C-d},
192one exists. 196always kill the region if one exists.
193
194@node Cut/Paste Other App
195@subsection Cut and Paste with Other Window Applications
196
197@cindex cutting
198@cindex pasting
199@cindex X cutting and pasting
200 To copy text to another windowing application, kill it or save it in
201the kill ring. Then use the ``paste'' or ``yank'' command of the
202other application to insert the text.
203
204 To copy text from another windowing application, use its ``cut'' or
205``copy'' command to select the text you want. Then yank it in Emacs
206with @kbd{C-y} or @kbd{Mouse-2}.
207
208@cindex primary selection
209@cindex cut buffer
210@cindex selection, primary
211@vindex x-cut-buffer-max
212 When Emacs puts text into the kill ring, or rotates text to the
213front of the kill ring, it sets the @dfn{primary selection} in the
214window system. This is how other windowing applications can access
215the text. On the X Window System, emacs also stores the text in the
216cut buffer, but only if the text is short enough (the value of
217@code{x-cut-buffer-max} specifies the maximum number of characters);
218putting long strings in the cut buffer can be slow.
219
220 The commands to yank the first entry in the kill ring actually check
221first for a primary selection in another program; after that, they check
222for text in the cut buffer. If neither of those sources provides text
223to yank, the kill ring contents are used.
224
225 The standard coding system for X Window System selections is
226@code{compound-text-with-extensions}. You may find that the pasted
227text is not what you expected. In such a case, you can specify
228another coding system for selections by @kbd{C-x @key{RET} x} or
229@kbd{C-x @key{RET} X}, or can request the different data type by
230modifying the variable @code{x-select-request-type}.
231@xref{Communication Coding}.
232 197
233@node Word and Line Mouse 198@node Word and Line Mouse
234@subsection Mouse Commands for Words and Lines 199@subsection Mouse Commands for Words and Lines
235 200
236 These variants of @kbd{Mouse-1} select entire words or lines at a time. 201 These variants of @kbd{Mouse-1} select entire words or lines at a
202time. Emacs activates the region around the selected text, which is
203also copied to the kill ring.
237 204
238@table @kbd 205@table @kbd
239@item Double-Mouse-1 206@item Double-Mouse-1
240This key sets the region around the word which you click on. If you 207Select the text around the word which you click on.
241click on a character with ``symbol'' syntax (such as underscore, in C
242mode), it sets the region around the symbol surrounding that character.
243 208
244If you click on a character with open-parenthesis or close-parenthesis 209Double-clicking on a character with ``symbol'' syntax (such as
245syntax, it sets the region around the parenthetical grouping 210underscore, in C mode) selects the symbol surrounding that character.
246which that character starts or ends. If you click on a character with 211Double-clicking on a character with open- or close-parenthesis syntax
247string-delimiter syntax (such as a singlequote or doublequote in C), it 212selects the parenthetical grouping which that character starts or
248sets the region around the string constant (using heuristics to figure 213ends. Double-clicking on a character with string-delimiter syntax
249out whether that character is the beginning or the end of it). 214(such as a singlequote or doublequote in C) selects the string
215constant (Emacs uses heuristics to figure out whether that character
216is the beginning or the end of it).
250 217
251@item Double-Drag-Mouse-1 218@item Double-Drag-Mouse-1
252This key selects a region made up of the words you drag across. 219Select the text you drag across, in the form of whole words.
253 220
254@item Triple-Mouse-1 221@item Triple-Mouse-1
255This key sets the region around the line you click on. 222Select the line you click on.
256 223
257@item Triple-Drag-Mouse-1 224@item Triple-Drag-Mouse-1
258This key selects a region made up of the lines you drag across. 225Select the text you drag across, in the form of whole lines.
259@end table 226@end table
260 227
228@node Cut/Paste Other App
229@subsection Cut and Paste with Other Window Applications
230
231@cindex X cutting and pasting
232@cindex X selection
233@cindex primary selection
234@cindex selection, primary
235 When running Emacs under the X window system, you can transfer text
236between Emacs and other X applications using the @dfn{primary
237selection}. The primary selection is sometimes also referred to as
238the @dfn{X selection}. It @emph{not} the same thing as the
239@dfn{clipboard}, a separate facility used on desktop environments such
240as Gnome, and on operating systems such as Microsoft Windows
241(@pxref{Clipboard}).
242
243 Under X, whenever you select some text in Emacs by dragging or
244clicking the mouse (@pxref{Mouse Commands}), it is also saved in the
245primary selection. You can then @dfn{paste} that text into any other
246X application, usually by clicking @key{Mouse-2} in that application.
247Unlike the Emacs kill ring (@pxref{Kill Ring}), the primary selection
248has no ``memory'': each time you save something in the primary
249selection, either in Emacs or in another X application, the previous
250contents of the primary selection are lost.
251
252 Whenever you kill some text using a command such as @kbd{C-w}
253(@code{kill-region}), or copy it into the kill ring using a command
254such as @kbd{M-w} (@code{kill-ring-save}), that text is also saved in
255the primary selection. @xref{Killing}.
256
257 If you set the region using the keyboard, the text within the region
258is not saved to the primary selection. However, if you change the
259variable @code{select-active-regions} to @code{t}, the region is
260automatically saved to the primary selection each time you activate
261the mark (however, the primary selection is @emph{not} updated if you
262subsequently change the region by moving point).
263
264@cindex cut buffer
265@vindex x-cut-buffer-max
266 Whenever Emacs saves some text to the primary selection, it may also
267save it to the @dfn{cut buffer}. The cut buffer is an obsolete
268predecessor to the primary selection; most modern applications do not
269make use of it. Because saving text to the cut buffer is slow and
270inefficient, Emacs only does it if the text is shorter than the value
271of @code{x-cut-buffer-max} (the default is 20000 characters).
272
273 You can yank the primary selection into Emacs using the usual yank
274commands, such as @kbd{C-y} (@code{yank}) and @key{Mouse-2}
275(@code{mouse-yank-at-click}). These commands actually check the
276primary selection before referring to the kill ring; if no primary
277selection is available, the kill ring contents are used. To prevent
278yank commands from accessing the primary selection, set the variable
279@code{x-select-enable-primary} to @code{nil}.
280
281 The standard coding system for the primary selection is
282@code{compound-text-with-extensions}. You may find that the pasted
283text is not what you expected. In such a case, you can specify
284another coding system for the selection by typing @kbd{C-x @key{RET}
285x} or @kbd{C-x @key{RET} X}. Alternatively, you can request a
286different data type by modifying the variable
287@code{x-select-request-type}. @xref{Communication Coding}.
288
261@node Secondary Selection 289@node Secondary Selection
262@subsection Secondary Selection 290@subsection Secondary Selection
263@cindex secondary selection 291@cindex secondary selection
@@ -323,7 +351,7 @@ which of the frame's windows you click on. @xref{Mouse Commands}.
323 351
324 Apart from the primary and secondary selection types, Emacs can 352 Apart from the primary and secondary selection types, Emacs can
325handle the @dfn{clipboard} selection type which is used by some 353handle the @dfn{clipboard} selection type which is used by some
326applications, particularly under OpenWindows and Gnome. 354desktop environments, such as Gnome.
327 355
328 The command @kbd{M-x menu-bar-enable-clipboard} makes the @code{Cut}, 356 The command @kbd{M-x menu-bar-enable-clipboard} makes the @code{Cut},
329@code{Paste} and @code{Copy} menu items, as well as the keys of the same 357@code{Paste} and @code{Copy} menu items, as well as the keys of the same