[Download postscript version]
next up previous
Next: Etags Up: Emacs Previous: Entering frequent text

 

Cutting and Pasting Text

Another often used task is to cut a part of your text and insert it in other places. Emacs has a kill ring, where it inserts all the deleted text. Except the character deletion commands, namely C-d and backspace, all kill commands insert the deleted text into the kill ring. Consecutive kills append the deleted text at the same location of the kill ring. Pasting text back is made with C-y, the yank commands. If you would like to paste older killed text from the kill ring, you can repeatedly type M-y (after the initial C-y). Table 5 summarizes the different methods for marking, deleting and pasting.

 

Cut and Paste Functions
Key Action Explanation
C-k Delete line Delete everything up to the end of the line. If you pass a numerical argument (C-u (digits)), it deletes that many lines. A negative argument, it deletes backwards.
M-z (key) Zap to char Delete everything up to and including the character (key). For example, when you type M-z . everything up to the end of the phrase is deleted.
M-d (M-backspace) Kill word forward (backward) Deletes the entire word forward or backward and is inserted in the kill ring.
C-w Kill region Kill the entire region from the mark to the current position.
M-w Insert region into kill ring The same as C-w, but leaves the text in the buffer.
M-x mark-c-function Mark current c function If we want to kill or insert an entire function into the kill ring, we can mark it first with this function and then delete it with C-w or insert it with M-w.
MC-Space mark subexpression Marks the entire subexpression following the pointgif. If you would like to mark a parenthesized expression, move the cursor to the opening parenthesis (using for example MC-p described in section 2.1) and call this command.
MC-k kill subexpression Deletes the subexpression following the cursor. The command behaves similar to the one just described before.
Table 5:  


next up previous
Next: Etags Up: Emacs Previous: Entering frequent text

Adrian Perrig
Wed Jun 12 00:18:25 MET DST 1996