Using RCS in GNU Emacs

Emacs has integrated support for RCS (and other version control systems). Emacs looks for RCS comma-v (,v) files in the current directory or in an RCS subdirectory.

Version Control Commands in Emacs

Commands are located in the menu system in Tools...Version Control. The keyboard command prefix for all version control commands is C-x v.

Starting a File in RCS with Emacs

To check in a new file to RCS use the Tools... Version  Control... Register command (keyboard sequence C-x v i or C-x v v.

Interpretering the Emacs Mode Line

Files that are using RCS will have the following status line:

--1-:%%-F1  strntok.c         (C RCS-1.2)--L1--Top-------

The %% indicates the buffer is read-only. The RCS-1.2 indicates that this file is under RCS control, and you are viewing revision 1.2.

Checking Out and Editing File

To checkout and be able to edit the file use the Tools... Version Control... Check In/Out command (keyboard sequence C-x v v). The status line will now be:

--1-:---F1  strntok.c         (C RCS:1.2)--L1--Top------

The missing %% means the file is writeable, and the semicolon (: after RCS, resulting in RCS:, means the file is locked.

Viewing the Changes with rcsdiff

To compare the current version of the file you're editing with the last version in RCS use the command Tools... Version Control... Compare to Last Version (keyboard command C-v =), which opens a buffer with the output of the rcsdiff command.

Checking in Changes

To check in files use the same command as check out, Tools... Version  Control... Register command (keyboard sequence C-x v v).

Checking in files results in Emacs asking to save the buffer it hasn't been saved, and creates a window (buffer *VC-log*)to enter a change comment. Emacs tells you to type C-c C-c when done.

Reverting to Undo Changes

To undo all the changes to a file use Tools... Version  Control... Revert to Last Version (keyboard sequence C-x v u).

Viewing the Revision Log

The meta revision information of a file can be viewed with Tools... Version  Control... Show History (keyboard sequence C-x v l).

Viewing Another Revision

View another revision of a file in another window with Tools... Version  Control... Show Other Version (keyboard sequence C-x v ~).


This page was inspired by an answer from RIT Ask Dr. Tiger.

$Id: emacs.html,v 1.6 2005-10-28 22:25:45-04 ashawley Exp $

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Text being "A free book about free software", and Back-Cover Texts being "You have freedom to copy and modify this book".