28.1.12.4 Inserting Version Control Headers
On Subversion, CVS, RCS, and SCCS, you can put certain special strings called version headers into a work file. When the file is committed, the version control system automatically puts the revision number, the name of the user who made the commit, and other relevant information into the version header.
VC does not normally use the information in the version headers. As
an exception, when using RCS, Emacs uses the version header, if there
is one, to determine the file version, since it is often more reliable
than the RCS master file. To inhibit using the version header this
way, change the variable vc-consult-headers
to nil
. VC
then always uses the file permissions (if it is supposed to trust
them), or else checks the master file.
To insert a suitable header string into the current buffer, use the
command M-x vc-insert-headers
. This command works only on
Subversion, CVS, RCS, and SCCS. The variable
vc-backend-header
contains the list of keywords to insert
into the version header; for instance, CVS uses vc-cvs-header
,
whose default value is '("\$Id\$")
. (The extra backslashes
prevent the string constant from being interpreted as a header, if the
Emacs Lisp file defining it is maintained with version control.) The
vc-insert-headers
command inserts each keyword in the list on a
new line at point, surrounded by tabs, and inside comment delimiters
if necessary.
The variable vc-static-header-alist
specifies further strings
to add based on the name of the buffer. Its value should be a list of
elements of the form (regexp . format)
. Whenever
regexp matches the buffer name, format is also inserted as
part of the version header. A ‘ %s
’ in format is replaced
with the file’s version control type.