Download GNU Emacs Manual
Transcript
Chapter 9: Killing and Moving Text C-M-w 98 Cause the following command, if it is a kill command, to append to the previous kill (append-next-kill). See Section 9.2.3 [Appending Kills], page 99. The basic yanking command is C-y (yank). It inserts the most recent kill, leaving the cursor at the end of the inserted text. It also sets the mark at the beginning of the inserted text, without activating the mark; this lets you jump easily to that position, if you wish, with C-u C-SPC (see Section 8.4 [Mark Ring], page 92). With a plain prefix argument (C-u C-y), the command instead leaves the cursor in front of the inserted text, and sets the mark at the end. Using any other prefix argument specifies an earlier kill; e.g., C-u 4 C-y reinserts the fourth most recent kill. See Section 9.2.2 [Earlier Kills], page 98. On graphical displays, C-y first checks if another application has placed any text in the system clipboard more recently than the last Emacs kill. If so, it inserts the clipboard’s text instead. Thus, Emacs effectively treats “cut” or “copy” clipboard operations performed in other applications like Emacs kills, except that they are not recorded in the kill ring. See Section 9.3 [Cut and Paste], page 100, for details. 9.2.1 The Kill Ring The kill ring is a list of blocks of text that were previously killed. There is only one kill ring, shared by all buffers, so you can kill text in one buffer and yank it in another buffer. This is the usual way to move text from one buffer to another. (There are several other methods: for instance, you could store the text in a register; see Section 22.21 [Registers], page 507. See Section 9.4 [Accumulating Text], page 102, for some other ways to move text around.) The maximum number of entries in the kill ring is controlled by the variable kill-ringmax. The default is 60. If you make a new kill when this limit has been reached, Emacs makes room by deleting the oldest entry in the kill ring. The actual contents of the kill ring are stored in a variable named kill-ring; you can view the entire contents of the kill ring with C-h v kill-ring. 9.2.2 Yanking Earlier Kills As explained in Section 22.8.3 [Yanking], page 465, you can use a numeric argument to C-y to yank text that is no longer the most recent kill. This is useful if you remember which kill ring entry you want. If you don’t, you can use the M-y (yank-pop) command to cycle through the possibilities. If the previous command was a yank command, M-y takes the text that was yanked and replaces it with the text from an earlier kill. So, to recover the text of the next-to-the-last kill, first use C-y to yank the last kill, and then use M-y to replace it with the previous kill. M-y is allowed only after a C-y or another M-y. You can understand M-y in terms of a “last yank” pointer which points at an entry in the kill ring. Each time you kill, the “last yank” pointer moves to the newly made entry at the front of the ring. C-y yanks the entry which the “last yank” pointer points to. M-y moves the “last yank” pointer to a different entry, and the text in the buffer changes to match. Enough M-y commands can move the pointer to any entry in the ring, so you can get any entry into the buffer. Eventually the pointer reaches the end of the ring; the next M-y loops back around to the first entry again.
Related documents
GLADE User's Guide
HP OpenVMS Command Definition, Librarian, and Message Utilities
GNU Emacs Manual - Mr. Gober`s Website
GNU Emacs Manual - Programming Systems Lab
Emacs Predictive Completion Manual
GNU Emacs Manual
Magit User Manual
GNU Emacs Manual - Journal of the Australian Mathematical
GNU Emacs Manual
Installing and Starting Emacs
Geiser User Manual - download.savannah.gnu.org
Section - Eli - University of Colorado Boulder