This writeup will assume the following things about you:

  • You use Emacs to write documents or code.
  • You don't want to live in the perpetual now, and instead would like to save old versions of your text/code/whatever
  • You have access to some kind of revision control system like RCS, CVS, or the truly ancient SCCS.
  • You don't care to learn lots of commands like ci, co, cvs update, signin, signout, etc..., but you like the idea of saving old versions.
It also helps if you have geek tendencies, but if you are using Emacs you've already pretty much passed that test.

First, you'll need to have a repository to store the files in. If you don't, just create a directory called (all caps) RCS in the directory you want your work saved. This should work on any Unix system, because it is a pretty poor Linux distribution and/or sysadmin that doesn't provide you with RCS.

Now, when you want to save a revision, you can type C-x v v (by "C-x", I mean hold down the ctrl key and press x) and it will automatically do the next appropriate thing with your file. Emacs will check your file out if it hasn't been checked out yet, check it in if it differs from previous versions (and allow you to note what has changed in this version), and sign the file up to be source controlled if it hasn't been signed up yet.

If you are checking in changes, Emacs will ask you to describe those changes. A pithy little commment will usually suffice to remind you of what you did. Comments like "some changes" generally aren't very helpful, though. After you are done entering these comments, type C-c C-c to complete the check in process.

Note that too many checkins will clutter the revision control history making it difficult to find a particular version, and too few will mean that certain versions are lost forever. I recommend checking in your changes once a day, or once every major change.

Also note that for systems that use the checkin/checkout way of doing things (i.e. RCS and SCCS) every time you check in your changes, the file will become write protected. You'll have to check it out (C-x v v again) if you want to make more changes.

Now your intermediate versions have been archived forever! If, at some time in the future, you think "Bah! This is all wrong. I want it back the way I had a week ago.", that version is available. Unfortunately, you'll have to use the command line to retrieve it, but it is available, and will remain so forever. This, coupled with the fact that those revisions are stored in a separate directory, should help alleviate your fear of accidental deletions or good passages getting lost in major revisions, and allow you to get on with your writing - which is the whole point of using an editor in the first place!

Log in or registerto write something here or to contact authors.