diff options
| author | Chong Yidong | 2008-10-15 16:59:03 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-10-15 16:59:03 +0000 |
| commit | 2aee6012cfcf709a8ced33d3a6469c18d198e406 (patch) | |
| tree | 1977eaadd7540099bfa9ca0ca11e6e99c957fb63 | |
| parent | b0f95216d2f91953d04370318624580c6be21124 (diff) | |
| download | emacs-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.texi | 350 |
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 |
| 10 | the system in a single Emacs session. Each system-level window that | 10 | ``windows'' in a single Emacs session. We refer to these system-level |
| 11 | belongs to Emacs displays a @dfn{frame} which can contain one or | 11 | windows as @dfn{frames}. A frame initially contains a single Emacs |
| 12 | several Emacs windows. A frame initially contains a single | 12 | window; however, you can subdivide this Emacs window into smaller |
| 13 | general-purpose Emacs window which you can subdivide vertically or | 13 | windows, all fitting into the same frame. Each frame normally |
| 14 | horizontally into smaller windows. A frame normally contains its own | 14 | contains its own echo area and minibuffer. |
| 15 | echo area and minibuffer, but you can make frames that don't have | ||
| 16 | these---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 |
| 19 | subdivisions that Emacs implements, and never use it to refer to a | 17 | subdivisions that Emacs implements, and never use it to refer to a |
| 20 | frame. | 18 | frame. |
| 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 |
| 23 | instance, if you put text in the kill ring in one frame, you can yank it | 21 | instance, if you put text in the kill ring in one frame, you can yank |
| 24 | in another frame. If you exit Emacs through @kbd{C-x C-c} in one frame, | 22 | it in another frame. If you exit Emacs through @kbd{C-x C-c} in one |
| 25 | it terminates all the frames. To delete just one frame, use @kbd{C-x 5 | 23 | frame, it terminates all the frames. To delete just one frame, use |
| 26 | 0} (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, |
| 29 | so that you can use many of the features described in this chapter. | 27 | so 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 |
| 64 | and yanking using the mouse. | 62 | yanking 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 | ||
| 79 | compatible with the @code{xterm} program. You can use the same mouse | ||
| 80 | commands for copying between Emacs and other window-based programs. | ||
| 81 | Most 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 | ||
| 86 | immediately afterward type the @key{DELETE} function key, it deletes the | ||
| 87 | region 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 | ||
| 89 | in 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 |
| 100 | Move point to where you click (@code{mouse-set-point}). | 81 | Move point to where you click (@code{mouse-set-point}). |
| 101 | This is normally the left button. | 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 | ||
| 100 | called by clicking with the left mouse button, @key{Mouse-1}, in the | ||
| 101 | text area of a window. This moves point to the position where you | ||
| 102 | clicked. | ||
| 102 | 103 | ||
| 103 | @vindex x-mouse-click-focus-ignore-position | 104 | @vindex x-mouse-click-focus-ignore-position |
| 104 | Normally, Emacs does not distinguish between ordinary mouse clicks and | 105 | Normally, Emacs does not distinguish between ordinary mouse clicks |
| 105 | clicks that select a frame. When you click on a frame to select it, | 106 | and clicks that select a frame. When you click on a frame to select |
| 106 | that also changes the selected window and cursor position according to | 107 | it, that also changes the selected window and cursor position |
| 107 | the mouse click position. On the X window system, you can change this | 108 | according to the mouse click position. On the X window system, you |
| 108 | behavior by setting the variable | 109 | can 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 |
| 110 | first click selects the frame, but does not affect the selected window | 111 | first click selects the frame, but does not affect the selected window |
| 111 | or cursor position. If you click again in the same place, since that | 112 | or cursor position. If you click again in the same place, that click |
| 112 | click will be in the selected frame, it will change the window or | 113 | will be in the selected frame, so it will change the window or cursor |
| 113 | cursor position. | 114 | position. |
| 114 | 115 | ||
| 115 | @item Drag-Mouse-1 | 116 | @findex mouse-set-region |
| 116 | Set the region to the text you select by dragging, and copy it to the | 117 | @vindex mouse-drag-copy-region |
| 117 | kill 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 |
| 118 | region with this single command. | 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}. | ||
| 119 | 125 | ||
| 120 | @vindex mouse-scroll-min-lines | 126 | @vindex mouse-scroll-min-lines |
| 121 | If 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 |
| 122 | dragging, the window scrolls at a steady rate until you move the mouse | 128 | dragging, the window scrolls at a steady rate until you move the mouse |
| 123 | back into the window. This way, you can select regions that don't fit | 129 | back into the window. This way, you can select regions that don't fit |
| 124 | entirely on the screen. The number of lines scrolled per step depends | 130 | entirely on the screen. The number of lines scrolled per step depends |
| 125 | on how far away from the window edge the mouse has gone; the variable | 131 | on 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 |
| 129 | If the variable @code{mouse-drag-copy-region} is @code{nil}, this | ||
| 130 | mouse command does not copy the selected region into the kill ring. | ||
| 131 | |||
| 132 | @item Mouse-2 | ||
| 133 | Yank the last killed text, where you click (@code{mouse-yank-at-click}). | ||
| 134 | This is normally the middle button. | ||
| 135 | |||
| 136 | @item Mouse-3 | ||
| 137 | This command, @code{mouse-save-then-kill}, has several functions | ||
| 138 | depending on where you click and the status of the region. | ||
| 139 | |||
| 140 | The most basic case is when you click @kbd{Mouse-1} in one place and | ||
| 141 | then @kbd{Mouse-3} in another. This selects the text between those two | ||
| 142 | positions as the region. It also copies the new region to the kill | ||
| 143 | ring, so that you can copy it to someplace else. | ||
| 144 | |||
| 145 | If you click @kbd{Mouse-1} in the text, scroll with the scroll bar, and | ||
| 146 | then 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 | ||
| 148 | other end of the region. This is so that you can select a region that | ||
| 149 | doesn't fit entirely on the screen. | ||
| 150 | |||
| 151 | More generally, if you do not have a highlighted region, @kbd{Mouse-3} | ||
| 152 | selects the text between point and the click position as the region. It | ||
| 153 | does this by setting the mark where point was, and moving point to where | ||
| 154 | you click. | ||
| 155 | |||
| 156 | If you have a highlighted region, or if the region was set just before | ||
| 157 | by dragging button 1, @kbd{Mouse-3} adjusts the nearer end of the region | ||
| 158 | by moving it to where you click. The adjusted region's text also | ||
| 159 | replaces the old region's text in the kill ring. | ||
| 160 | |||
| 161 | If 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 | ||
| 163 | or lines, then adjusting the region with @kbd{Mouse-3} also proceeds by | ||
| 164 | entire words or lines. | ||
| 165 | |||
| 166 | If you use @kbd{Mouse-3} a second time consecutively, at the same place, | ||
| 167 | that 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} | ||
| 171 | at 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 | ||
| 173 | from the buffer, press @kbd{Mouse-3} just once---or just drag across the | ||
| 174 | text 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 |
| 178 | and press @kbd{Mouse-2}. @xref{Yanking}. However, if | 137 | the 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 |
| 180 | point. Then it does not matter where you click, or even which of the | 139 | variable @code{mouse-yank-at-point} to a non-@code{nil} value, |
| 181 | frame'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 |
| 182 | variable also affects yanking the secondary selection. | 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 | ||
| 146 | Clicking with the right mouse button, @key{Mouse-3}, runs the | ||
| 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 | ||
| 152 | If no region is active, clicking @key{Mouse-3} activates the region, | ||
| 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 | ||
| 157 | If a region is active, clicking @key{Mouse-3} adjusts the nearer end | ||
| 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 | ||
| 164 | @key{Mouse-1}, so that the region is defined to consist of entire | ||
| 165 | words or lines, then adjusting the region with @key{Mouse-3} also | ||
| 166 | proceeds by entire words or lines. | ||
| 167 | |||
| 168 | @item | ||
| 169 | If you use @key{Mouse-3} a second time consecutively, at the same | ||
| 170 | place, that kills the region already selected. Thus, the simplest way | ||
| 171 | to kill text with the mouse is to click @key{Mouse-1} at one end, then | ||
| 172 | click @key{Mouse-3} twice at the other end. To copy the text into the | ||
| 173 | kill ring without deleting it from the buffer, press @key{Mouse-3} | ||
| 174 | just once---or just drag across the text with @key{Mouse-1}. Then you | ||
| 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}). | ||
| 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 |
| 188 | while text is selected deletes the selected text. You can make Emacs | 192 | insertion while text is selected deletes the selected text. You can |
| 189 | behave this way by enabling Delete Selection mode---with @kbd{M-x | 193 | make Emacs behave this way by typing @kbd{M-x delete-selection-mode}. |
| 190 | delete-selection-mode} or using Custom. Another effect of this mode | 194 | This enables a minor mode named Delete Selection mode. Another effect |
| 191 | is that some keys, such as @key{DEL} and @kbd{C-d}, kill the region if | 195 | of this mode is that some keys, such as @key{DEL} and @kbd{C-d}, |
| 192 | one exists. | 196 | always 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 | ||
| 201 | the kill ring. Then use the ``paste'' or ``yank'' command of the | ||
| 202 | other 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 | ||
| 206 | with @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 | ||
| 213 | front of the kill ring, it sets the @dfn{primary selection} in the | ||
| 214 | window system. This is how other windowing applications can access | ||
| 215 | the text. On the X Window System, emacs also stores the text in the | ||
| 216 | cut buffer, but only if the text is short enough (the value of | ||
| 217 | @code{x-cut-buffer-max} specifies the maximum number of characters); | ||
| 218 | putting long strings in the cut buffer can be slow. | ||
| 219 | |||
| 220 | The commands to yank the first entry in the kill ring actually check | ||
| 221 | first for a primary selection in another program; after that, they check | ||
| 222 | for text in the cut buffer. If neither of those sources provides text | ||
| 223 | to 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 | ||
| 227 | text is not what you expected. In such a case, you can specify | ||
| 228 | another 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 | ||
| 230 | modifying 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 |
| 202 | time. Emacs activates the region around the selected text, which is | ||
| 203 | also copied to the kill ring. | ||
| 237 | 204 | ||
| 238 | @table @kbd | 205 | @table @kbd |
| 239 | @item Double-Mouse-1 | 206 | @item Double-Mouse-1 |
| 240 | This key sets the region around the word which you click on. If you | 207 | Select the text around the word which you click on. |
| 241 | click on a character with ``symbol'' syntax (such as underscore, in C | ||
| 242 | mode), it sets the region around the symbol surrounding that character. | ||
| 243 | 208 | ||
| 244 | If you click on a character with open-parenthesis or close-parenthesis | 209 | Double-clicking on a character with ``symbol'' syntax (such as |
| 245 | syntax, it sets the region around the parenthetical grouping | 210 | underscore, in C mode) selects the symbol surrounding that character. |
| 246 | which that character starts or ends. If you click on a character with | 211 | Double-clicking on a character with open- or close-parenthesis syntax |
| 247 | string-delimiter syntax (such as a singlequote or doublequote in C), it | 212 | selects the parenthetical grouping which that character starts or |
| 248 | sets the region around the string constant (using heuristics to figure | 213 | ends. Double-clicking on a character with string-delimiter syntax |
| 249 | out whether that character is the beginning or the end of it). | 214 | (such as a singlequote or doublequote in C) selects the string |
| 215 | constant (Emacs uses heuristics to figure out whether that character | ||
| 216 | is the beginning or the end of it). | ||
| 250 | 217 | ||
| 251 | @item Double-Drag-Mouse-1 | 218 | @item Double-Drag-Mouse-1 |
| 252 | This key selects a region made up of the words you drag across. | 219 | Select the text you drag across, in the form of whole words. |
| 253 | 220 | ||
| 254 | @item Triple-Mouse-1 | 221 | @item Triple-Mouse-1 |
| 255 | This key sets the region around the line you click on. | 222 | Select the line you click on. |
| 256 | 223 | ||
| 257 | @item Triple-Drag-Mouse-1 | 224 | @item Triple-Drag-Mouse-1 |
| 258 | This key selects a region made up of the lines you drag across. | 225 | Select 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 | ||
| 236 | between Emacs and other X applications using the @dfn{primary | ||
| 237 | selection}. The primary selection is sometimes also referred to as | ||
| 238 | the @dfn{X selection}. It @emph{not} the same thing as the | ||
| 239 | @dfn{clipboard}, a separate facility used on desktop environments such | ||
| 240 | as 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 | ||
| 244 | clicking the mouse (@pxref{Mouse Commands}), it is also saved in the | ||
| 245 | primary selection. You can then @dfn{paste} that text into any other | ||
| 246 | X application, usually by clicking @key{Mouse-2} in that application. | ||
| 247 | Unlike the Emacs kill ring (@pxref{Kill Ring}), the primary selection | ||
| 248 | has no ``memory'': each time you save something in the primary | ||
| 249 | selection, either in Emacs or in another X application, the previous | ||
| 250 | contents 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 | ||
| 254 | such as @kbd{M-w} (@code{kill-ring-save}), that text is also saved in | ||
| 255 | the primary selection. @xref{Killing}. | ||
| 256 | |||
| 257 | If you set the region using the keyboard, the text within the region | ||
| 258 | is not saved to the primary selection. However, if you change the | ||
| 259 | variable @code{select-active-regions} to @code{t}, the region is | ||
| 260 | automatically saved to the primary selection each time you activate | ||
| 261 | the mark (however, the primary selection is @emph{not} updated if you | ||
| 262 | subsequently 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 | ||
| 267 | save it to the @dfn{cut buffer}. The cut buffer is an obsolete | ||
| 268 | predecessor to the primary selection; most modern applications do not | ||
| 269 | make use of it. Because saving text to the cut buffer is slow and | ||
| 270 | inefficient, Emacs only does it if the text is shorter than the value | ||
| 271 | of @code{x-cut-buffer-max} (the default is 20000 characters). | ||
| 272 | |||
| 273 | You can yank the primary selection into Emacs using the usual yank | ||
| 274 | commands, such as @kbd{C-y} (@code{yank}) and @key{Mouse-2} | ||
| 275 | (@code{mouse-yank-at-click}). These commands actually check the | ||
| 276 | primary selection before referring to the kill ring; if no primary | ||
| 277 | selection is available, the kill ring contents are used. To prevent | ||
| 278 | yank 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 | ||
| 283 | text is not what you expected. In such a case, you can specify | ||
| 284 | another coding system for the selection by typing @kbd{C-x @key{RET} | ||
| 285 | x} or @kbd{C-x @key{RET} X}. Alternatively, you can request a | ||
| 286 | different 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 |
| 325 | handle the @dfn{clipboard} selection type which is used by some | 353 | handle the @dfn{clipboard} selection type which is used by some |
| 326 | applications, particularly under OpenWindows and Gnome. | 354 | desktop 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 |