5.6.3 Move a paragraph without losing it

Cutting with C-w removes the region and stores it for yanking. Practise in the unchanged three-paragraph source above; copying in the previous task did not alter it. Do not overwrite an existing buffer to recreate the example.

  1. Select the middle sentence from its beginning. This time move down twice after setting the mark, stopping at the beginning of Keep the closing paragraph.. The region contains the middle paragraph and both following newlines, but none of the closing paragraph. Check with C-e r.
  2. Press C-w. Emacsvox announces the cut. The source now contains the opening and closing paragraphs, and point is where the removed passage began. Inspect the remaining text without making another cut or copy.
  3. Press M-> for the buffer end. With the example’s final newline present, press RET once to add a blank line after the closing paragraph. Press C-y to insert the cut paragraph there.
  4. Read from the beginning using short passages. The order should be opening, closing, then the moved paragraph, separated by blank lines. Check that the middle paragraph appears only once.

In other text, decide deliberately whether to move a following newline or blank line. Cutting only the visible words can leave an empty paragraph at the source and join words at the destination. For a transfer between files, verify both buffers before saving either: this is not one atomic file move.

Consecutive kills can combine into one kill-ring entry. Avoid using another kill command to tidy the destination before yanking the passage; it can alter what you insert. C-k, for example, kills to the line end and can remove the newline when used there. See Killing by lines and Appending kills in the GNU Emacs Manual before using that faster editing pattern.