ARCHIVED: In Emacs or Pico, what should I do if a huge chunk of my document disappears while I'm editing?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

You may have mistakenly entered the command to kill the region (C-w in Emacs or Ctrl-k in Pico). This command is used to delete a large portion of a document, usually by setting a mark, moving the cursor to another spot, then using the command to kill all the text in between the spot you marked and the spot you're now on.

In Pico, you can usually tell when you're marking text, because the marked text is highlighted, but Emacs often gives no indication that a mark has been set.

Note: Normally in Pico, Ctrl-k deletes only the current line, but it will delete a whole region if you have set a mark.

Recovering text in Emacs

To get the text back in Emacs, type C-y. If that doesn't work, try typing C-x u. You might have to type this command several times. Watch carefully so that you can stop as soon as you get back the text that you want.

Note: If you aren't sure how to enter these commands in Emacs, see How keystrokes are denoted in Emacs

Recovering text in Pico

To get the text back in Pico, type Ctrl-u. If that doesn't work the first time, try typing Ctrl-u several more times, watching carefully to see when the command gets back the text that you want.

At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.

This is document abjc in the Knowledge Base.
Last modified on 2018-01-18 10:52:29.