aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Berry2006-04-12 00:27:50 +0000
committerKarl Berry2006-04-12 00:27:50 +0000
commit45ca30f2f426dc098b31ec04cd72c7581153475c (patch)
treef6b81244ed37bd6a5533ba59049518fa3e7de1ac
parent14e6dc54f295e1fbc92f6e22a5bb8b5f9a4b83ac (diff)
downloademacs-45ca30f2f426dc098b31ec04cd72c7581153475c.tar.gz
emacs-45ca30f2f426dc098b31ec04cd72c7581153475c.zip
move more advanced vc info to emacs-xtra.texi
-rw-r--r--man/ChangeLog12
-rw-r--r--man/cmdargs.texi2
-rw-r--r--man/emacs-xtra.texi887
-rw-r--r--man/emacs.texi4
-rw-r--r--man/files.texi941
5 files changed, 940 insertions, 906 deletions
diff --git a/man/ChangeLog b/man/ChangeLog
index 37543f5d8da..5123c1127ae 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,15 @@
12006-04-11 Karl Berry <karl@gnu.org>
2
3 * emacs-xtra.texi, emacs.texi (Dired under VC, VC Dired Commands,
4 Remote Repositories, Version Backups, Local Version Control,
5 Snapshots, Making and Using Snapshots, Snapshot Caveats,
6 Miscellaneous Commands and Features of VC, Change Logs and VC,
7 Renaming VC Work Files and Master Files,
8 Inserting Version Control Headers, Customizing VC, General Options,
9 Options for RCS and SCCS, Options specific for CVS): move all
10 these nodes to emacs-xtra.texi, for brevity.
11 * cmdargs.texi, files.texi: change cross-references.
12
12006-04-11 Reiner Steib <Reiner.Steib@gmx.de> 132006-04-11 Reiner Steib <Reiner.Steib@gmx.de>
2 14
3 * gnus.texi, gnus-faq.texi, message.texi: Gnus v5.10.8 is released. 15 * gnus.texi, gnus-faq.texi, message.texi: Gnus v5.10.8 is released.
diff --git a/man/cmdargs.texi b/man/cmdargs.texi
index f266913d266..f1e7c539f76 100644
--- a/man/cmdargs.texi
+++ b/man/cmdargs.texi
@@ -551,7 +551,7 @@ The name of an interpreter used to parse and execute programs run from
551inside Emacs. 551inside Emacs.
552@item SMTPSERVER 552@item SMTPSERVER
553The name of the outgoing mail server. Used by the SMTP library 553The name of the outgoing mail server. Used by the SMTP library
554(@pxref{Top,,Sending mail via SMTP,smtpmail}). 554(@pxref{Top,,,Sending mail via SMTP,smtpmail}).
555@cindex background mode, on @command{xterm} 555@cindex background mode, on @command{xterm}
556@item TERM 556@item TERM
557The type of the terminal that Emacs is using. This variable must be 557The type of the terminal that Emacs is using. This variable must be
diff --git a/man/emacs-xtra.texi b/man/emacs-xtra.texi
index 7f7574d05e5..d4a1e5f000e 100644
--- a/man/emacs-xtra.texi
+++ b/man/emacs-xtra.texi
@@ -57,12 +57,14 @@ license to the document, as described in section 6 of the license.
57@menu 57@menu
58* Introduction:: What documentation belongs here? 58* Introduction:: What documentation belongs here?
59* Autorevert:: Auto Reverting non-file buffers. 59* Autorevert:: Auto Reverting non-file buffers.
60* Subdir switches:: Subdirectory switches in Dired. 60* Subdir Switches:: Subdirectory switches in Dired.
61* Advanced Calendar/Diary Usage:: Advanced Calendar/Diary customization. 61* Advanced Calendar/Diary Usage:: Advanced Calendar/Diary customization.
62* Emerge:: A convenient way of merging two versions 62* Emerge:: A convenient way of merging two versions
63 of a program. 63 of a program.
64* Picture Mode:: Editing pictures made up of characters 64* Picture Mode:: Editing pictures made up of characters
65 using the quarter-plane screen model. 65 using the quarter-plane screen model.
66
67* Advanced VC Usage:: Advanced VC (version control) features.
66* Fortran:: Fortran mode and its special features. 68* Fortran:: Fortran mode and its special features.
67* MS-DOG:: 69* MS-DOG::
68* Index:: 70* Index::
@@ -273,7 +275,7 @@ for the buffer reliably assures that all information in the buffer is
273completely up to date (or will be after @code{auto-revert-interval} 275completely up to date (or will be after @code{auto-revert-interval}
274seconds). 276seconds).
275 277
276@node Subdir switches 278@node Subdir Switches
277@chapter Subdirectory Switches in Dired 279@chapter Subdirectory Switches in Dired
278 280
279You can insert subdirectories with specified @code{ls} switches in 281You can insert subdirectories with specified @code{ls} switches in
@@ -1889,6 +1891,887 @@ other modes. @kbd{C-c C-y} (@code{picture-yank-rectangle}) inserts
1889@kbd{C-c C-x} (@code{picture-yank-rectangle-from-register}) does 1891@kbd{C-c C-x} (@code{picture-yank-rectangle-from-register}) does
1890likewise for the rectangle found in a specified register. 1892likewise for the rectangle found in a specified register.
1891 1893
1894@node Advanced VC Usage
1895@chapter Advanced VC Usage
1896
1897 Commonly used features of Emacs' version control (VC) support are
1898described in the main Emacs manual (@pxref{Version Control,,,emacs,
1899the Emacs Manual}). This chapter describes more advanced VC usage.
1900
1901@menu
1902* VC Dired Mode:: Listing files managed by version control.
1903* VC Dired Commands:: Commands to use in a VC Dired buffer.
1904* Remote Repositories:: Efficient access to remote CVS servers.
1905* Snapshots:: Sets of file versions treated as a unit.
1906* Miscellaneous VC:: Various other commands and features of VC.
1907* Customizing VC:: Variables that change VC's behavior.
1908@end menu
1909
1910@node VC Dired Mode
1911@section Dired under VC
1912
1913@cindex PCL-CVS
1914@pindex cvs
1915@cindex CVS Dired Mode
1916 The VC Dired Mode described here works with all the version control
1917systems that VC supports. Another more powerful facility, designed
1918specifically for CVS, is called PCL-CVS. @xref{Top, , About PCL-CVS,
1919pcl-cvs, PCL-CVS --- The Emacs Front-End to CVS}.
1920
1921@kindex C-x v d
1922@findex vc-directory
1923 When you are working on a large program, it is often useful to find
1924out which files have changed within an entire directory tree, or to view
1925the status of all files under version control at once, and to perform
1926version control operations on collections of files. You can use the
1927command @kbd{C-x v d} (@code{vc-directory}) to make a directory listing
1928that includes only files relevant for version control.
1929
1930@vindex vc-dired-terse-display
1931 @kbd{C-x v d} creates a buffer which uses VC Dired Mode. This looks
1932much like an ordinary Dired buffer (@pxref{Dired,,,emacs, the
1933Emacs Manual}); however, normally it shows only the noteworthy files
1934(those locked or not up-to-date). This is called @dfn{terse display}.
1935If you set the variable @code{vc-dired-terse-display} to @code{nil},
1936then VC Dired shows all relevant files---those managed under version
1937control, plus all subdirectories (@dfn{full display}). The command
1938@kbd{v t} in a VC Dired buffer toggles between terse display and full
1939display (@pxref{VC Dired Commands}).
1940
1941@vindex vc-dired-recurse
1942 By default, VC Dired produces a recursive listing of noteworthy or
1943relevant files at or below the given directory. You can change this by
1944setting the variable @code{vc-dired-recurse} to @code{nil}; then VC
1945Dired shows only the files in the given directory.
1946
1947 The line for an individual file shows the version control state in the
1948place of the hard link count, owner, group, and size of the file. If
1949the file is unmodified, in sync with the master file, the version
1950control state shown is blank. Otherwise it consists of text in
1951parentheses. Under RCS and SCCS, the name of the user locking the file
1952is shown; under CVS, an abbreviated version of the @samp{cvs status}
1953output is used. Here is an example using RCS:
1954
1955@smallexample
1956@group
1957 /home/jim/project:
1958
1959 -rw-r--r-- (jim) Apr 2 23:39 file1
1960 -r--r--r-- Apr 5 20:21 file2
1961@end group
1962@end smallexample
1963
1964@noindent
1965The files @samp{file1} and @samp{file2} are under version control,
1966@samp{file1} is locked by user jim, and @samp{file2} is unlocked.
1967
1968 Here is an example using CVS:
1969
1970@smallexample
1971@group
1972 /home/joe/develop:
1973
1974 -rw-r--r-- (modified) Aug 2 1997 file1.c
1975 -rw-r--r-- Apr 4 20:09 file2.c
1976 -rw-r--r-- (merge) Sep 13 1996 file3.c
1977@end group
1978@end smallexample
1979
1980 Here @samp{file1.c} is modified with respect to the repository, and
1981@samp{file2.c} is not. @samp{file3.c} is modified, but other changes
1982have also been checked in to the repository---you need to merge them
1983with the work file before you can check it in.
1984
1985@vindex vc-stay-local
1986@vindex vc-cvs-stay-local
1987 In the above, if the repository were on a remote machine, VC would
1988only contact it when the variable @code{vc-stay-local} (or
1989@code{vc-cvs-stay-local}) is nil (@pxref{CVS Options}). This is
1990because access to the repository may be slow, or you may be working
1991offline and not have access to the repository at all. As a
1992consequence, VC would not be able to tell you that @samp{file3.c} is
1993in the ``merge'' state; you would learn that only when you try to
1994check-in your modified copy of the file, or use a command such as
1995@kbd{C-x v m}.
1996
1997 In practice, this is not a problem because CVS handles this case
1998consistently whenever it arises. In VC, you'll simply get prompted to
1999merge the remote changes into your work file first. The benefits of
2000less network communication usually outweigh the disadvantage of not
2001seeing remote changes immediately.
2002
2003@vindex vc-directory-exclusion-list
2004 When VC Dired displays subdirectories (in the ``full'' display mode),
2005it omits some that should never contain any files under version control.
2006By default, this includes Version Control subdirectories such as
2007@samp{RCS} and @samp{CVS}; you can customize this by setting the
2008variable @code{vc-directory-exclusion-list}.
2009
2010 You can fine-tune VC Dired's format by typing @kbd{C-u C-x v d}---as in
2011ordinary Dired, that allows you to specify additional switches for the
2012@samp{ls} command.
2013
2014@node VC Dired Commands
2015@section VC Dired Commands
2016
2017 All the usual Dired commands work normally in VC Dired mode, except
2018for @kbd{v}, which is redefined as the version control prefix. You can
2019invoke VC commands such as @code{vc-diff} and @code{vc-print-log} by
2020typing @kbd{v =}, or @kbd{v l}, and so on. Most of these commands apply
2021to the file name on the current line.
2022
2023 The command @kbd{v v} (@code{vc-next-action}) operates on all the
2024marked files, so that you can lock or check in several files at once.
2025If it operates on more than one file, it handles each file according to
2026its current state; thus, it might lock one file, but check in another
2027file. This could be confusing; it is up to you to avoid confusing
2028behavior by marking a set of files that are in a similar state. If no
2029files are marked, @kbd{v v} operates on the file in the current line.
2030
2031 If any files call for check-in, @kbd{v v} reads a single log entry,
2032then uses it for all the files being checked in. This is convenient for
2033registering or checking in several files at once, as part of the same
2034change.
2035
2036@findex vc-dired-toggle-terse-mode
2037@findex vc-dired-mark-locked
2038 You can toggle between terse display (only locked files, or files not
2039up-to-date) and full display at any time by typing @kbd{v t}
2040(@code{vc-dired-toggle-terse-mode}). There is also a special command
2041@kbd{* l} (@code{vc-dired-mark-locked}), which marks all files currently
2042locked (or, with CVS, all files not up-to-date). Thus, typing @kbd{* l
2043t k} is another way to delete from the buffer all files except those
2044currently locked.
2045
2046@node Remote Repositories
2047@section Remote Repositories
2048@cindex remote repositories (CVS)
2049
2050 A common way of using CVS is to set up a central CVS repository on
2051some Internet host, then have each developer check out a personal
2052working copy of the files on his local machine. Committing changes to
2053the repository, and picking up changes from other users into one's own
2054working area, then works by direct interactions with the CVS server.
2055
2056 One difficulty is that access to the CVS server is often slow, and
2057that developers might need to work off-line as well. VC is designed
2058to reduce the amount of network interaction necessary.
2059
2060@menu
2061* Version Backups:: Keeping local copies of repository versions.
2062* Local Version Control:: Using another version system for local editing.
2063@end menu
2064
2065@node Version Backups
2066@subsection Version Backups
2067@cindex version backups
2068
2069@cindex automatic version backups
2070 When VC sees that the CVS repository for a file is on a remote
2071machine, it automatically makes local backups of unmodified versions
2072of the file---@dfn{automatic version backups}. This means that you
2073can compare the file to the repository version (@kbd{C-x v =}), or
2074revert to that version (@kbd{C-x v u}), without any network
2075interactions.
2076
2077 The local copy of the unmodified file is called a @dfn{version
2078backup} to indicate that it corresponds exactly to a version that is
2079stored in the repository. Note that version backups are not the same
2080as ordinary Emacs backup files (@pxref{Backup,,,emacs, the Emacs
2081Manual}). But they follow a similar naming convention.
2082
2083 For a file that comes from a remote CVS repository, VC makes a
2084version backup whenever you save the first changes to the file, and
2085removes it after you have committed your modified version to the
2086repository. You can disable the making of automatic version backups by
2087setting @code{vc-cvs-stay-local} to @code{nil} (@pxref{CVS Options}).
2088
2089@cindex manual version backups
2090 The name of the automatic version backup for version @var{version}
2091of file @var{file} is @code{@var{file}.~@var{version}.~}. This is
2092almost the same as the name used by @kbd{C-x v ~} (@pxref{Old
2093Versions,,,emacs, the Emacs Manual}), the only difference being
2094the additional dot (@samp{.}) after the version number. This
2095similarity is intentional, because both kinds of files store the same
2096kind of information. The file made by @kbd{C-x v ~} acts as a
2097@dfn{manual version backup}.
2098
2099 All the VC commands that operate on old versions of a file can use
2100both kinds of version backups. For instance, @kbd{C-x v ~} uses
2101either an automatic or a manual version backup, if possible, to get
2102the contents of the version you request. Likewise, @kbd{C-x v =} and
2103@kbd{C-x v u} use either an automatic or a manual version backup, if
2104one of them exists, to get the contents of a version to compare or
2105revert to. If you changed a file outside of Emacs, so that no
2106automatic version backup was created for the previous text, you can
2107create a manual backup of that version using @kbd{C-x v ~}, and thus
2108obtain the benefit of the local copy for Emacs commands.
2109
2110 The only difference in Emacs's handling of manual and automatic
2111version backups, once they exist, is that Emacs deletes automatic
2112version backups when you commit to the repository. By contrast,
2113manual version backups remain until you delete them.
2114
2115@node Local Version Control
2116@subsection Local Version Control
2117@cindex local version control
2118@cindex local back end (version control)
2119
2120When you make many changes to a file that comes from a remote
2121repository, it can be convenient to have version control on your local
2122machine as well. You can then record intermediate versions, revert to
2123a previous state, etc., before you actually commit your changes to the
2124remote server.
2125
2126VC lets you do this by putting a file under a second, local version
2127control system, so that the file is effectively registered in two
2128systems at the same time. For the description here, we will assume
2129that the remote system is CVS, and you use RCS locally, although the
2130mechanism works with any combination of version control systems
2131(@dfn{back ends}).
2132
2133To make it work with other back ends, you must make sure that the
2134``more local'' back end comes before the ``more remote'' back end in
2135the setting of @code{vc-handled-backends} (@pxref{Customizing VC}). By
2136default, this variable is set up so that you can use remote CVS and
2137local RCS as described here.
2138
2139To start using local RCS for a file that comes from a remote CVS
2140server, you must @emph{register the file in RCS}, by typing @kbd{C-u
2141C-x v v rcs @key{RET}}. (In other words, use @code{vc-next-action} with a
2142prefix argument, and specify RCS as the back end.)
2143
2144You can do this at any time; it does not matter whether you have
2145already modified the file with respect to the version in the CVS
2146repository. If possible, VC tries to make the RCS master start with
2147the unmodified repository version, then checks in any local changes
2148as a new version. This works if you have not made any changes yet, or
2149if the unmodified repository version exists locally as a version
2150backup (@pxref{Version Backups}). If the unmodified version is not
2151available locally, the RCS master starts with the modified version;
2152the only drawback to this is that you cannot compare your changes
2153locally to what is stored in the repository.
2154
2155The version number of the RCS master is derived from the current CVS
2156version, starting a branch from it. For example, if the current CVS
2157version is 1.23, the local RCS branch will be 1.23.1. Version 1.23 in
2158the RCS master will be identical to version 1.23 under CVS; your first
2159changes are checked in as 1.23.1.1. (If the unmodified file is not
2160available locally, VC will check in the modified file twice, both as
21611.23 and 1.23.1.1, to make the revision numbers consistent.)
2162
2163If you do not use locking under CVS (the default), locking is also
2164disabled for RCS, so that editing under RCS works exactly as under
2165CVS.
2166
2167When you are done with local editing, you can commit the final version
2168back to the CVS repository by typing @kbd{C-u C-x v v cvs @key{RET}}.
2169This initializes the log entry buffer (@pxref{Log Buffer,,,emacs, the
2170Emacs Manual}) to contain all the log entries you have recorded in the
2171RCS master; you can edit them as you wish, and then commit in CVS by
2172typing @kbd{C-c C-c}. If the commit is successful, VC removes the RCS
2173master, so that the file is once again registered under CVS only.
2174(The RCS master is not actually deleted, just renamed by appending
2175@samp{~} to the name, so that you can refer to it later if you wish.)
2176
2177While using local RCS, you can pick up recent changes from the CVS
2178repository into your local file, or commit some of your changes back
2179to CVS, without terminating local RCS version control. To do this,
2180switch to the CVS back end temporarily, with the @kbd{C-x v b} command:
2181
2182@table @kbd
2183@item C-x v b
2184Switch to another back end that the current file is registered
2185under (@code{vc-switch-backend}).
2186
2187@item C-u C-x v b @var{backend} @key{RET}
2188Switch to @var{backend} for the current file.
2189@end table
2190
2191@kindex C-x v b
2192@findex vc-switch-backend
2193@kbd{C-x v b} does not change the buffer contents, or any files; it
2194only changes VC's perspective on how to handle the file. Any
2195subsequent VC commands for that file will operate on the back end that
2196is currently selected.
2197
2198If the current file is registered in more than one back end, typing
2199@kbd{C-x v b} ``cycles'' through all of these back ends. With a
2200prefix argument, it asks for the back end to use in the minibuffer.
2201
2202Thus, if you are using local RCS, and you want to pick up some recent
2203changes in the file from remote CVS, first visit the file, then type
2204@kbd{C-x v b} to switch to CVS, and finally use @kbd{C-x v m
2205@key{RET}} to merge the news (@pxref{Merging,,,emacs, the Emacs
2206Manual}). You can then switch back to RCS by typing @kbd{C-x v b}
2207again, and continue to edit locally.
2208
2209But if you do this, the revision numbers in the RCS master no longer
2210correspond to those of CVS. Technically, this is not a problem, but
2211it can become difficult to keep track of what is in the CVS repository
2212and what is not. So we suggest that you return from time to time to
2213CVS-only operation, by committing your local changes back to the
2214repository using @kbd{C-u C-x v v cvs @key{RET}}.
2215
2216@node Snapshots
2217@section Snapshots
2218@cindex snapshots and version control
2219
2220 A @dfn{snapshot} is a named set of file versions (one for each
2221registered file) that you can treat as a unit. One important kind of
2222snapshot is a @dfn{release}, a (theoretically) stable version of the
2223system that is ready for distribution to users.
2224
2225@menu
2226* Making Snapshots:: The snapshot facilities.
2227* Snapshot Caveats:: Things to be careful of when using snapshots.
2228@end menu
2229
2230@node Making Snapshots
2231@subsection Making and Using Snapshots
2232
2233 There are two basic commands for snapshots; one makes a
2234snapshot with a given name, the other retrieves a named snapshot.
2235
2236@table @code
2237@kindex C-x v s
2238@findex vc-create-snapshot
2239@item C-x v s @var{name} @key{RET}
2240Define the last saved versions of every registered file in or under the
2241current directory as a snapshot named @var{name}
2242(@code{vc-create-snapshot}).
2243
2244@kindex C-x v r
2245@findex vc-retrieve-snapshot
2246@item C-x v r @var{name} @key{RET}
2247For all registered files at or below the current directory level, select
2248whatever versions correspond to the snapshot @var{name}
2249(@code{vc-retrieve-snapshot}).
2250
2251This command reports an error if any files are locked at or below the
2252current directory, without changing anything; this is to avoid
2253overwriting work in progress.
2254@end table
2255
2256 A snapshot uses a very small amount of resources---just enough to record
2257the list of file names and which version belongs to the snapshot. Thus,
2258you need not hesitate to create snapshots whenever they are useful.
2259
2260 You can give a snapshot name as an argument to @kbd{C-x v =} or
2261@kbd{C-x v ~} (@pxref{Old Versions,,,emacs, the Emacs Manual}).
2262Thus, you can use it to compare a snapshot against the current files,
2263or two snapshots against each other, or a snapshot against a named
2264version.
2265
2266@node Snapshot Caveats
2267@subsection Snapshot Caveats
2268
2269@cindex named configurations (RCS)
2270 VC's snapshot facilities are modeled on RCS's named-configuration
2271support. They use RCS's native facilities for this, so
2272snapshots made using RCS through VC are visible even when you bypass VC.
2273
2274 With CVS, Meta-CVS, and Subversion, VC also uses the native
2275mechanism provided by that back end to make snapshots and retrieve them
2276(@dfn{tags} for CVS and Meta-CVS, @dfn{copies} for Subversion).
2277
2278@c worded verbosely to avoid overfull hbox.
2279 For SCCS, VC implements snapshots itself. The files it uses contain
2280name/file/version-number triples. These snapshots are visible only
2281through VC.
2282
2283 There is no support for VC snapshots using GNU Arch yet.
2284
2285 A snapshot is a set of checked-in versions. So make sure that all the
2286files are checked in and not locked when you make a snapshot.
2287
2288 File renaming and deletion can create some difficulties with snapshots.
2289This is not a VC-specific problem, but a general design issue in version
2290control systems that no one has solved very well yet.
2291
2292 If you rename a registered file, you need to rename its master along
2293with it (the command @code{vc-rename-file} does this automatically). If
2294you are using SCCS, you must also update the records of the snapshot, to
2295mention the file by its new name (@code{vc-rename-file} does this,
2296too). An old snapshot that refers to a master file that no longer
2297exists under the recorded name is invalid; VC can no longer retrieve
2298it. It would be beyond the scope of this manual to explain enough about
2299RCS and SCCS to explain how to update the snapshots by hand.
2300
2301 Using @code{vc-rename-file} makes the snapshot remain valid for
2302retrieval, but it does not solve all problems. For example, some of the
2303files in your program probably refer to others by name. At the very
2304least, the makefile probably mentions the file that you renamed. If you
2305retrieve an old snapshot, the renamed file is retrieved under its new
2306name, which is not the name that the makefile expects. So the program
2307won't really work as retrieved.
2308
2309@node Miscellaneous VC
2310@section Miscellaneous Commands and Features of VC
2311
2312 This section explains the less-frequently-used features of VC.
2313
2314@menu
2315* Change Logs and VC:: Generating a change log file from log entries.
2316* Renaming and VC:: A command to rename both the source and master
2317 file correctly.
2318* Version Headers:: Inserting version control headers into working files.
2319@end menu
2320
2321@node Change Logs and VC
2322@subsection Change Logs and VC
2323
2324 If you use RCS or CVS for a program and also maintain a change log
2325file for it (@pxref{Change Log,,,emacs, the Emacs Manual}), you
2326can generate change log entries automatically from the version control
2327log entries:
2328
2329@table @kbd
2330@item C-x v a
2331@kindex C-x v a
2332@findex vc-update-change-log
2333Visit the current directory's change log file and, for registered files
2334in that directory, create new entries for versions checked in since the
2335most recent entry in the change log file.
2336(@code{vc-update-change-log}).
2337
2338This command works with RCS or CVS only, not with any of the other
2339back ends.
2340
2341@item C-u C-x v a
2342As above, but only find entries for the current buffer's file.
2343
2344@item M-1 C-x v a
2345As above, but find entries for all the currently visited files that are
2346maintained with version control. This works only with RCS, and it puts
2347all entries in the log for the default directory, which may not be
2348appropriate.
2349@end table
2350
2351 For example, suppose the first line of @file{ChangeLog} is dated
23521999-04-10, and that the only check-in since then was by Nathaniel
2353Bowditch to @file{rcs2log} on 1999-05-22 with log text @samp{Ignore log
2354messages that start with `#'.}. Then @kbd{C-x v a} visits
2355@file{ChangeLog} and inserts text like this:
2356
2357@iftex
2358@medbreak
2359@end iftex
2360@smallexample
2361@group
23621999-05-22 Nathaniel Bowditch <nat@@apn.org>
2363
2364 * rcs2log: Ignore log messages that start with `#'.
2365@end group
2366@end smallexample
2367@iftex
2368@medbreak
2369@end iftex
2370
2371@noindent
2372You can then edit the new change log entry further as you wish.
2373
2374 Some of the new change log entries may duplicate what's already in
2375ChangeLog. You will have to remove these duplicates by hand.
2376
2377 Normally, the log entry for file @file{foo} is displayed as @samp{*
2378foo: @var{text of log entry}}. The @samp{:} after @file{foo} is omitted
2379if the text of the log entry starts with @w{@samp{(@var{functionname}):
2380}}. For example, if the log entry for @file{vc.el} is
2381@samp{(vc-do-command): Check call-process status.}, then the text in
2382@file{ChangeLog} looks like this:
2383
2384@iftex
2385@medbreak
2386@end iftex
2387@smallexample
2388@group
23891999-05-06 Nathaniel Bowditch <nat@@apn.org>
2390
2391 * vc.el (vc-do-command): Check call-process status.
2392@end group
2393@end smallexample
2394@iftex
2395@medbreak
2396@end iftex
2397
2398 When @kbd{C-x v a} adds several change log entries at once, it groups
2399related log entries together if they all are checked in by the same
2400author at nearly the same time. If the log entries for several such
2401files all have the same text, it coalesces them into a single entry.
2402For example, suppose the most recent check-ins have the following log
2403entries:
2404
2405@flushleft
2406@bullet{} For @file{vc.texinfo}: @samp{Fix expansion typos.}
2407@bullet{} For @file{vc.el}: @samp{Don't call expand-file-name.}
2408@bullet{} For @file{vc-hooks.el}: @samp{Don't call expand-file-name.}
2409@end flushleft
2410
2411@noindent
2412They appear like this in @file{ChangeLog}:
2413
2414@iftex
2415@medbreak
2416@end iftex
2417@smallexample
2418@group
24191999-04-01 Nathaniel Bowditch <nat@@apn.org>
2420
2421 * vc.texinfo: Fix expansion typos.
2422
2423 * vc.el, vc-hooks.el: Don't call expand-file-name.
2424@end group
2425@end smallexample
2426@iftex
2427@medbreak
2428@end iftex
2429
2430 Normally, @kbd{C-x v a} separates log entries by a blank line, but you
2431can mark several related log entries to be clumped together (without an
2432intervening blank line) by starting the text of each related log entry
2433with a label of the form @w{@samp{@{@var{clumpname}@} }}. The label
2434itself is not copied to @file{ChangeLog}. For example, suppose the log
2435entries are:
2436
2437@flushleft
2438@bullet{} For @file{vc.texinfo}: @samp{@{expand@} Fix expansion typos.}
2439@bullet{} For @file{vc.el}: @samp{@{expand@} Don't call expand-file-name.}
2440@bullet{} For @file{vc-hooks.el}: @samp{@{expand@} Don't call expand-file-name.}
2441@end flushleft
2442
2443@noindent
2444Then the text in @file{ChangeLog} looks like this:
2445
2446@iftex
2447@medbreak
2448@end iftex
2449@smallexample
2450@group
24511999-04-01 Nathaniel Bowditch <nat@@apn.org>
2452
2453 * vc.texinfo: Fix expansion typos.
2454 * vc.el, vc-hooks.el: Don't call expand-file-name.
2455@end group
2456@end smallexample
2457@iftex
2458@medbreak
2459@end iftex
2460
2461 A log entry whose text begins with @samp{#} is not copied to
2462@file{ChangeLog}. For example, if you merely fix some misspellings in
2463comments, you can log the change with an entry beginning with @samp{#}
2464to avoid putting such trivia into @file{ChangeLog}.
2465
2466@node Renaming and VC
2467@subsection Renaming VC Work Files and Master Files
2468
2469@findex vc-rename-file
2470 When you rename a registered file, you must also rename its master
2471file correspondingly to get proper results. Use @code{vc-rename-file}
2472to rename the source file as you specify, and rename its master file
2473accordingly. It also updates any snapshots (@pxref{Snapshots}) that
2474mention the file, so that they use the new name; despite this, the
2475snapshot thus modified may not completely work (@pxref{Snapshot
2476Caveats}).
2477
2478 Some back ends do not provide an explicit rename operation to their
2479repositories. After issuing @code{vc-rename-file}, use @kbd{C-x v v}
2480on the original and renamed buffers and provide the necessary edit
2481log.
2482
2483 You cannot use @code{vc-rename-file} on a file that is locked by
2484someone else.
2485
2486@node Version Headers
2487@subsection Inserting Version Control Headers
2488
2489 Sometimes it is convenient to put version identification strings
2490directly into working files. Certain special strings called
2491@dfn{version headers} are replaced in each successive version by the
2492number of that version, the name of the user who created it, and other
2493relevant information. All of the back ends that VC supports have such
2494a mechanism, except GNU Arch.
2495
2496 VC does not normally use the information contained in these headers.
2497The exception is RCS---with RCS, version headers are sometimes more
2498reliable than the master file to determine which version of the file
2499you are editing. Note that in a multi-branch environment, version
2500headers are necessary to make VC behave correctly (@pxref{Multi-User
2501Branching,,,emacs, the Emacs Manual}).
2502
2503 Searching for RCS version headers is controlled by the variable
2504@code{vc-consult-headers}. If it is non-@code{nil} (the default),
2505Emacs searches for headers to determine the version number you are
2506editing. Setting it to @code{nil} disables this feature.
2507
2508 Note that although CVS uses the same kind of version headers as RCS
2509does, VC never searches for these headers if you are using CVS,
2510regardless of the above setting.
2511
2512@kindex C-x v h
2513@findex vc-insert-headers
2514 You can use the @kbd{C-x v h} command (@code{vc-insert-headers}) to
2515insert a suitable header string.
2516
2517@table @kbd
2518@item C-x v h
2519Insert headers in a file for use with your version-control system.
2520@end table
2521
2522@vindex vc-@var{backend}-header
2523 The default header string is @samp{@w{$}Id$} for RCS and
2524@samp{@w{%}W%} for SCCS. You can specify other headers to insert by
2525setting the variables @code{vc-@var{backend}-header} where
2526@var{backend} is @code{rcs} or @code{sccs}.
2527
2528 Instead of a single string, you can specify a list of strings; then
2529each string in the list is inserted as a separate header on a line of
2530its own.
2531
2532 It may be necessary to use apparently-superfluous backslashes when
2533writing the strings that you put in this variable. For instance, you
2534might write @code{"$Id\$"} rather than @code{"$Id@w{$}"}. The extra
2535backslash prevents the string constant from being interpreted as a
2536header, if the Emacs Lisp file containing it is maintained with
2537version control.
2538
2539@vindex vc-comment-alist
2540 Each header is inserted surrounded by tabs, inside comment delimiters,
2541on a new line at point. Normally the ordinary comment
2542start and comment end strings of the current mode are used, but for
2543certain modes, there are special comment delimiters for this purpose;
2544the variable @code{vc-comment-alist} specifies them. Each element of
2545this list has the form @code{(@var{mode} @var{starter} @var{ender})}.
2546
2547@vindex vc-static-header-alist
2548 The variable @code{vc-static-header-alist} specifies further strings
2549to add based on the name of the buffer. Its value should be a list of
2550elements of the form @code{(@var{regexp} . @var{format})}. Whenever
2551@var{regexp} matches the buffer name, @var{format} is inserted as part
2552of the header. A header line is inserted for each element that matches
2553the buffer name, and for each string specified by
2554@code{vc-@var{backend}-header}. The header line is made by processing the
2555string from @code{vc-@var{backend}-header} with the format taken from the
2556element. The default value for @code{vc-static-header-alist} is as follows:
2557
2558@example
2559@group
2560(("\\.c$" .
2561 "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
2562#endif /* lint */\n"))
2563@end group
2564@end example
2565
2566@noindent
2567It specifies insertion of text of this form:
2568
2569@example
2570@group
2571
2572#ifndef lint
2573static char vcid[] = "@var{string}";
2574#endif /* lint */
2575@end group
2576@end example
2577
2578@noindent
2579Note that the text above starts with a blank line.
2580
2581 If you use more than one version header in a file, put them close
2582together in the file. The mechanism in @code{revert-buffer} that
2583preserves markers may not handle markers positioned between two version
2584headers.
2585
2586@node Customizing VC
2587@section Customizing VC
2588
2589@vindex vc-handled-backends
2590The variable @code{vc-handled-backends} determines which version
2591control systems VC should handle. The default value is @code{(RCS CVS
2592SVN SCCS Arch MCVS)}, so it contains all six version systems that are
2593currently supported. If you want VC to ignore one or more of these
2594systems, exclude its name from the list. To disable VC entirely, set
2595this variable to @code{nil}.
2596
2597The order of systems in the list is significant: when you visit a file
2598registered in more than one system (@pxref{Local Version Control}), VC
2599uses the system that comes first in @code{vc-handled-backends} by
2600default. The order is also significant when you register a file for
2601the first time, @pxref{Registering,,,emacs, the Emacs Manual} for
2602details.
2603
2604@menu
2605* General VC Options:: Options that apply to multiple back ends.
2606* RCS and SCCS:: Options for RCS and SCCS.
2607* CVS Options:: Options for CVS.
2608@end menu
2609
2610@node General VC Options
2611@subsection General Options
2612
2613@vindex vc-make-backup-files
2614 Emacs normally does not save backup files for source files that are
2615maintained with version control. If you want to make backup files even
2616for files that use version control, set the variable
2617@code{vc-make-backup-files} to a non-@code{nil} value.
2618
2619@vindex vc-keep-workfiles
2620 Normally the work file exists all the time, whether it is locked or
2621not. If you set @code{vc-keep-workfiles} to @code{nil}, then checking
2622in a new version with @kbd{C-x v v} deletes the work file; but any
2623attempt to visit the file with Emacs creates it again. (With CVS, work
2624files are always kept.)
2625
2626@vindex vc-follow-symlinks
2627 Editing a version-controlled file through a symbolic link can be
2628dangerous. It bypasses the version control system---you can edit the
2629file without locking it, and fail to check your changes in. Also,
2630your changes might overwrite those of another user. To protect against
2631this, VC checks each symbolic link that you visit, to see if it points
2632to a file under version control.
2633
2634 The variable @code{vc-follow-symlinks} controls what to do when a
2635symbolic link points to a version-controlled file. If it is @code{nil},
2636VC only displays a warning message. If it is @code{t}, VC automatically
2637follows the link, and visits the real file instead, telling you about
2638this in the echo area. If the value is @code{ask} (the default), VC
2639asks you each time whether to follow the link.
2640
2641@vindex vc-suppress-confirm
2642 If @code{vc-suppress-confirm} is non-@code{nil}, then @kbd{C-x v v}
2643and @kbd{C-x v i} can save the current buffer without asking, and
2644@kbd{C-x v u} also operates without asking for confirmation. (This
2645variable does not affect @kbd{C-x v c}; that operation is so drastic
2646that it should always ask for confirmation.)
2647
2648@vindex vc-command-messages
2649 VC mode does much of its work by running the shell commands for RCS,
2650CVS and SCCS. If @code{vc-command-messages} is non-@code{nil}, VC
2651displays messages to indicate which shell commands it runs, and
2652additional messages when the commands finish.
2653
2654@vindex vc-path
2655 You can specify additional directories to search for version control
2656programs by setting the variable @code{vc-path}. These directories
2657are searched before the usual search path. It is rarely necessary to
2658set this variable, because VC normally finds the proper files
2659automatically.
2660
2661@node RCS and SCCS
2662@subsection Options for RCS and SCCS
2663
2664@cindex non-strict locking (RCS)
2665@cindex locking, non-strict (RCS)
2666 By default, RCS uses locking to coordinate the activities of several
2667users, but there is a mode called @dfn{non-strict locking} in which
2668you can check-in changes without locking the file first. Use
2669@samp{rcs -U} to switch to non-strict locking for a particular file,
2670see the @code{rcs} manual page for details.
2671
2672 When deducing the version control state of an RCS file, VC first
2673looks for an RCS version header string in the file (@pxref{Version
2674Headers}). If there is no header string, VC normally looks at the
2675file permissions of the work file; this is fast. But there might be
2676situations when the file permissions cannot be trusted. In this case
2677the master file has to be consulted, which is rather expensive. Also
2678the master file can only tell you @emph{if} there's any lock on the
2679file, but not whether your work file really contains that locked
2680version.
2681
2682@vindex vc-consult-headers
2683 You can tell VC not to use version headers to determine the file
2684status by setting @code{vc-consult-headers} to @code{nil}. VC then
2685always uses the file permissions (if it is supposed to trust them), or
2686else checks the master file.
2687
2688@vindex vc-mistrust-permissions
2689 You can specify the criterion for whether to trust the file
2690permissions by setting the variable @code{vc-mistrust-permissions}.
2691Its value can be @code{t} (always mistrust the file permissions and
2692check the master file), @code{nil} (always trust the file
2693permissions), or a function of one argument which makes the decision.
2694The argument is the directory name of the @file{RCS} subdirectory. A
2695non-@code{nil} value from the function says to mistrust the file
2696permissions. If you find that the file permissions of work files are
2697changed erroneously, set @code{vc-mistrust-permissions} to @code{t}.
2698Then VC always checks the master file to determine the file's status.
2699
2700 VC determines the version control state of files under SCCS much as
2701with RCS. It does not consider SCCS version headers, though. Thus,
2702the variable @code{vc-mistrust-permissions} affects SCCS use, but
2703@code{vc-consult-headers} does not.
2704
2705@node CVS Options
2706@subsection Options specific for CVS
2707
2708@cindex locking (CVS)
2709 By default, CVS does not use locking to coordinate the activities of
2710several users; anyone can change a work file at any time. However,
2711there are ways to restrict this, resulting in behavior that resembles
2712locking.
2713
2714@cindex CVSREAD environment variable (CVS)
2715 For one thing, you can set the @env{CVSREAD} environment variable
2716(the value you use makes no difference). If this variable is defined,
2717CVS makes your work files read-only by default. In Emacs, you must
2718type @kbd{C-x v v} to make the file writable, so that editing works
2719in fact similar as if locking was used. Note however, that no actual
2720locking is performed, so several users can make their files writable
2721at the same time. When setting @env{CVSREAD} for the first time, make
2722sure to check out all your modules anew, so that the file protections
2723are set correctly.
2724
2725@cindex cvs watch feature
2726@cindex watching files (CVS)
2727 Another way to achieve something similar to locking is to use the
2728@dfn{watch} feature of CVS. If a file is being watched, CVS makes it
2729read-only by default, and you must also use @kbd{C-x v v} in Emacs to
2730make it writable. VC calls @code{cvs edit} to make the file writable,
2731and CVS takes care to notify other developers of the fact that you
2732intend to change the file. See the CVS documentation for details on
2733using the watch feature.
2734
2735@vindex vc-stay-local
2736@vindex vc-cvs-stay-local
2737@cindex remote repositories (CVS)
2738 When a file's repository is on a remote machine, VC tries to keep
2739network interactions to a minimum. This is controlled by the variable
2740@code{vc-cvs-stay-local}. There is another variable,
2741@code{vc-stay-local}, which enables the feature also for other back
2742ends that support it, including CVS. In the following, we will talk
2743only about @code{vc-cvs-stay-local}, but everything applies to
2744@code{vc-stay-local} as well.
2745
2746If @code{vc-cvs-stay-local} is @code{t} (the default), then VC uses
2747only the entry in the local CVS subdirectory to determine the file's
2748state (and possibly information returned by previous CVS commands).
2749One consequence of this is that when you have modified a file, and
2750somebody else has already checked in other changes to the file, you
2751are not notified of it until you actually try to commit. (But you can
2752try to pick up any recent changes from the repository first, using
2753@kbd{C-x v m @key{RET}}, @pxref{Merging,,,emacs, the Emacs Manual}).
2754
2755 When @code{vc-cvs-stay-local} is @code{t}, VC also makes local
2756version backups, so that simple diff and revert operations are
2757completely local (@pxref{Version Backups}).
2758
2759 On the other hand, if you set @code{vc-cvs-stay-local} to @code{nil},
2760then VC queries the remote repository @emph{before} it decides what to
2761do in @code{vc-next-action} (@kbd{C-x v v}), just as it does for local
2762repositories. It also does not make any version backups.
2763
2764 You can also set @code{vc-cvs-stay-local} to a regular expression
2765that is matched against the repository host name; VC then stays local
2766only for repositories from hosts that match the pattern.
2767
2768@vindex vc-cvs-global-switches
2769 You can specify additional command line options to pass to all CVS
2770operations in the variable @code{vc-cvs-global-switches}. These
2771switches are inserted immediately after the @code{cvs} command, before
2772the name of the operation to invoke.
2773
2774
1892@node Fortran 2775@node Fortran
1893@chapter Fortran Mode 2776@chapter Fortran Mode
1894@cindex Fortran mode 2777@cindex Fortran mode
diff --git a/man/emacs.texi b/man/emacs.texi
index 0dc04945e9f..c926961891f 100644
--- a/man/emacs.texi
+++ b/man/emacs.texi
@@ -399,10 +399,6 @@ Version Control
399* Old Versions:: Examining and comparing old versions. 399* Old Versions:: Examining and comparing old versions.
400* Secondary VC Commands:: The commands used a little less frequently. 400* Secondary VC Commands:: The commands used a little less frequently.
401* Branches:: Multiple lines of development. 401* Branches:: Multiple lines of development.
402* Remote Repositories:: Efficient access to remote CVS servers.
403* Snapshots:: Sets of file versions treated as a unit.
404* Miscellaneous VC:: Various other commands and features of VC.
405* Customizing VC:: Variables that change VC's behavior.
406 402
407Using Multiple Buffers 403Using Multiple Buffers
408 404
diff --git a/man/files.texi b/man/files.texi
index 4847f0d1355..ab3fe7bb583 100644
--- a/man/files.texi
+++ b/man/files.texi
@@ -517,7 +517,8 @@ value is @code{t}, so that Emacs does write backup files.
517Control}), the variable @code{vc-make-backup-files} determines whether 517Control}), the variable @code{vc-make-backup-files} determines whether
518to make backup files. By default it is @code{nil}, since backup files 518to make backup files. By default it is @code{nil}, since backup files
519are redundant when you store all the previous versions in a version 519are redundant when you store all the previous versions in a version
520control system. @xref{General VC Options}. 520control system. @xref{General VC Options,,,emacs-xtra, Specialized
521Emacs Features}.
521 522
522 At your option, Emacs can keep either a single backup for each file, 523 At your option, Emacs can keep either a single backup for each file,
523or make a series of numbered backup files for each file that you edit. 524or make a series of numbered backup files for each file that you edit.
@@ -1200,7 +1201,7 @@ RCS or CVS, you can switch to CSSC.
1200 1201
1201 VC is enabled by default in Emacs. To disable it, set the 1202 VC is enabled by default in Emacs. To disable it, set the
1202customizable variable @code{vc-handled-backends} to @code{nil} 1203customizable variable @code{vc-handled-backends} to @code{nil}
1203(@pxref{Customizing VC}). 1204(@pxref{Customizing VC,,,emacs-xtra, Specialized Emacs Features}).
1204 1205
1205@menu 1206@menu
1206* Introduction to VC:: How version control works in general. 1207* Introduction to VC:: How version control works in general.
@@ -1209,10 +1210,6 @@ customizable variable @code{vc-handled-backends} to @code{nil}
1209* Old Versions:: Examining and comparing old versions. 1210* Old Versions:: Examining and comparing old versions.
1210* Secondary VC Commands:: The commands used a little less frequently. 1211* Secondary VC Commands:: The commands used a little less frequently.
1211* Branches:: Multiple lines of development. 1212* Branches:: Multiple lines of development.
1212* Remote Repositories:: Efficient access to remote CVS servers.
1213* Snapshots:: Sets of file versions treated as a unit.
1214* Miscellaneous VC:: Various other commands and features of VC.
1215* Customizing VC:: Variables that change VC's behavior.
1216@end menu 1213@end menu
1217 1214
1218@node Introduction to VC 1215@node Introduction to VC
@@ -1350,7 +1347,7 @@ permitted; check-in is still the way to record a new version.
1350 CVS normally allows each user to modify his own copy of the work file 1347 CVS normally allows each user to modify his own copy of the work file
1351at any time, but requires merging with changes from other users at 1348at any time, but requires merging with changes from other users at
1352check-in time. However, CVS can also be set up to require locking. 1349check-in time. However, CVS can also be set up to require locking.
1353(@pxref{CVS Options}). 1350(@pxref{CVS Options,,,emacs-xtra, Specialized Emacs Features}).
1354 1351
1355@node Types of Log File 1352@node Types of Log File
1356@subsubsection Types of Log File 1353@subsubsection Types of Log File
@@ -1382,7 +1379,8 @@ for each change just once, then put it into both logs. You can write
1382the entry in @file{ChangeLog}, then copy it to the log buffer when you 1379the entry in @file{ChangeLog}, then copy it to the log buffer when you
1383check in the change. Or you can write the entry in the log buffer 1380check in the change. Or you can write the entry in the log buffer
1384while checking in the change, and later use the @kbd{C-x v a} command 1381while checking in the change, and later use the @kbd{C-x v a} command
1385to copy it to @file{ChangeLog} (@pxref{Change Logs and VC}). 1382to copy it to @file{ChangeLog} (@pxref{Change Logs and
1383VC,,,emacs-xtra, Specialized Emacs Features}).
1386 1384
1387@node VC Mode Line 1385@node VC Mode Line
1388@subsection Version Control and the Mode Line 1386@subsection Version Control and the Mode Line
@@ -1547,7 +1545,7 @@ the repository.
1547Instead of the version number, you can also specify the name of a 1545Instead of the version number, you can also specify the name of a
1548version control system. This is useful when one file is being managed 1546version control system. This is useful when one file is being managed
1549with two version control systems at the same time (@pxref{Local 1547with two version control systems at the same time (@pxref{Local
1550Version Control}). 1548Version Control,,,emacs-xtra, Specialized Emacs Features}).
1551@end itemize 1549@end itemize
1552 1550
1553@node Log Buffer 1551@node Log Buffer
@@ -1569,14 +1567,16 @@ control, you can generate the Log Edit text from the ChangeLog using
1569entries for the file(s) concerned in the top entry in the ChangeLog 1567entries for the file(s) concerned in the top entry in the ChangeLog
1570and uses those paragraphs as the log text. This text is only inserted 1568and uses those paragraphs as the log text. This text is only inserted
1571if the top entry was made under your user name on the current date. 1569if the top entry was made under your user name on the current date.
1572@xref{Change Logs and VC}, for the opposite way of 1570@xref{Change Logs and VC,,,emacs-xtra, Specialized Emacs Features},
1573working---generating ChangeLog entries from the revision control log. 1571for the opposite way of working---generating ChangeLog entries from
1572the revision control log.
1574 1573
1575 In the @samp{*VC-Log*} buffer, @kbd{C-c C-f} (@kbd{M-x log-edit-show-files}) 1574 In the @samp{*VC-Log*} buffer, @kbd{C-c C-f} (@kbd{M-x
1576shows the list of files to be committed in case you need to check 1575log-edit-show-files}) shows the list of files to be committed in case
1577that. (This can be a list of more than one file if you use VC Dired 1576you need to check that. (This can be a list of more than one file if
1578mode or PCL-CVS. @xref{VC Dired Mode}, and @ref{Top, , About PCL-CVS, 1577you use VC Dired mode or PCL-CVS. @xref{VC Dired Mode,,,emacs-xtra,
1579pcl-cvs, PCL-CVS --- The Emacs Front-End to CVS}.) 1578Specialized Emacs Features}, and @ref{Top, , About PCL-CVS, pcl-cvs,
1579PCL-CVS --- The Emacs Front-End to CVS}.)
1580 1580
1581 When you have finished editing the log message, type @kbd{C-c C-c} to 1581 When you have finished editing the log message, type @kbd{C-c C-c} to
1582exit the buffer and commit the change. 1582exit the buffer and commit the change.
@@ -1644,7 +1644,7 @@ Both forms display the output in a special buffer in another window.
1644 You can specify a checked-in version by its number; an empty input 1644 You can specify a checked-in version by its number; an empty input
1645specifies the current contents of the work file (which may be different 1645specifies the current contents of the work file (which may be different
1646from all the checked-in versions). You can also specify a snapshot name 1646from all the checked-in versions). You can also specify a snapshot name
1647(@pxref{Snapshots}) instead of one or both version numbers. 1647(@pxref{Snapshots,,,emacs-xtra, Specialized Emacs Features}) instead of one or both version numbers.
1648 1648
1649 If you supply a directory name instead of the name of a registered 1649 If you supply a directory name instead of the name of a registered
1650file, this command compares the two specified versions of all registered 1650file, this command compares the two specified versions of all registered
@@ -1733,8 +1733,6 @@ use once a day.
1733* Registering:: Putting a file under version control. 1733* Registering:: Putting a file under version control.
1734* VC Status:: Viewing the VC status of files. 1734* VC Status:: Viewing the VC status of files.
1735* VC Undo:: Canceling changes before or after check-in. 1735* VC Undo:: Canceling changes before or after check-in.
1736* VC Dired Mode:: Listing files managed by version control.
1737* VC Dired Commands:: Commands to use in a VC Dired buffer.
1738@end menu 1736@end menu
1739 1737
1740@node Registering 1738@node Registering
@@ -1753,14 +1751,15 @@ Register the visited file for version control.
1753 To register the file, Emacs must choose which version control system 1751 To register the file, Emacs must choose which version control system
1754to use for it. If the file's directory already contains files 1752to use for it. If the file's directory already contains files
1755registered in a version control system, Emacs uses that system. If 1753registered in a version control system, Emacs uses that system. If
1756there is more than one system in use for a directory, Emacs uses the one 1754there is more than one system in use for a directory, Emacs uses the
1757that appears first in @code{vc-handled-backends} (@pxref{Customizing VC}). 1755one that appears first in @code{vc-handled-backends}
1758On the other hand, if there are no files already registered, 1756(@pxref{Customizing VC,,,emacs-xtra, Specialized Emacs Features}). On
1759Emacs uses the first system from @code{vc-handled-backends} that could 1757the other hand, if there are no files already registered, Emacs uses
1760register the file (for example, you cannot register a file under CVS if 1758the first system from @code{vc-handled-backends} that could register
1761its directory is not already part of a CVS tree); with the default 1759the file (for example, you cannot register a file under CVS if its
1762value of @code{vc-handled-backends}, this means that Emacs uses RCS in 1760directory is not already part of a CVS tree); with the default value
1763this situation. 1761of @code{vc-handled-backends}, this means that Emacs uses RCS in this
1762situation.
1764 1763
1765 If locking is in use, @kbd{C-x v i} leaves the file unlocked and 1764 If locking is in use, @kbd{C-x v i} leaves the file unlocked and
1766read-only. Type @kbd{C-x v v} if you wish to start editing it. After 1765read-only. Type @kbd{C-x v v} if you wish to start editing it. After
@@ -1815,14 +1814,16 @@ count.
1815 1814
1816@item P 1815@item P
1817Move to the log of the previous file, when the logs of multiple files 1816Move to the log of the previous file, when the logs of multiple files
1818are in the log buffer (@pxref{VC Dired Mode}). Otherwise, just move 1817are in the log buffer (@pxref{VC Dired Mode,,,emacs-xtra, Specialized
1819to the beginning of the log. A numeric prefix argument is a repeat 1818Emacs Features}). Otherwise, just move to the beginning of the log. A
1820count, so @kbd{C-u 10 P} would move backward 10 files. 1819numeric prefix argument is a repeat count, so @kbd{C-u 10 P} would
1820move backward 10 files.
1821 1821
1822@item N 1822@item N
1823Move to the log of the next file, when the logs of multiple files are 1823Move to the log of the next file, when the logs of multiple files are
1824in the log buffer (@pxref{VC Dired Mode}). It also takes a numeric 1824in the log buffer (@pxref{VC Dired Mode,,,emacs-xtra, Specialized
1825prefix argument as a repeat count. 1825Emacs Features}). It also takes a numeric prefix argument as a repeat
1826count.
1826 1827
1827@item f 1828@item f
1828Visit the revision indicated at the current line, like typing @kbd{C-x 1829Visit the revision indicated at the current line, like typing @kbd{C-x
@@ -1876,10 +1877,11 @@ change and then discover a trivial error in it; you can cancel the
1876erroneous check-in, fix the error, and check the file in again. 1877erroneous check-in, fix the error, and check the file in again.
1877 1878
1878 When @kbd{C-x v c} does not revert the buffer, it unexpands all 1879 When @kbd{C-x v c} does not revert the buffer, it unexpands all
1879version control headers in the buffer instead (@pxref{Version Headers}). 1880version control headers in the buffer instead (@pxref{Version
1880This is because the buffer no longer corresponds to any existing 1881Headers,,,emacs-xtra, Specialized Emacs Features}). This is because
1881version. If you check it in again, the check-in process will expand the 1882the buffer no longer corresponds to any existing version. If you
1882headers properly for the new version number. 1883check it in again, the check-in process will expand the headers
1884properly for the new version number.
1883 1885
1884 However, it is impossible to unexpand the RCS @samp{@w{$}Log$} header 1886 However, it is impossible to unexpand the RCS @samp{@w{$}Log$} header
1885automatically. If you use that header feature, you have to unexpand it 1887automatically. If you use that header feature, you have to unexpand it
@@ -1891,142 +1893,6 @@ confirmation with @kbd{yes}. Note also that this command is disabled
1891under CVS, because canceling versions is very dangerous and discouraged 1893under CVS, because canceling versions is very dangerous and discouraged
1892with CVS. 1894with CVS.
1893 1895
1894@node VC Dired Mode
1895@subsubsection Dired under VC
1896
1897@cindex PCL-CVS
1898@pindex cvs
1899@cindex CVS Dired Mode
1900 The VC Dired Mode described here works with all the version control
1901systems that VC supports. Another more powerful facility, designed
1902specifically for CVS, is called PCL-CVS. @xref{Top, , About PCL-CVS,
1903pcl-cvs, PCL-CVS --- The Emacs Front-End to CVS}.
1904
1905@kindex C-x v d
1906@findex vc-directory
1907 When you are working on a large program, it is often useful to find
1908out which files have changed within an entire directory tree, or to view
1909the status of all files under version control at once, and to perform
1910version control operations on collections of files. You can use the
1911command @kbd{C-x v d} (@code{vc-directory}) to make a directory listing
1912that includes only files relevant for version control.
1913
1914@vindex vc-dired-terse-display
1915 @kbd{C-x v d} creates a buffer which uses VC Dired Mode. This looks
1916much like an ordinary Dired buffer (@pxref{Dired}); however, normally it
1917shows only the noteworthy files (those locked or not up-to-date). This
1918is called @dfn{terse display}. If you set the variable
1919@code{vc-dired-terse-display} to @code{nil}, then VC Dired shows all
1920relevant files---those managed under version control, plus all
1921subdirectories (@dfn{full display}). The command @kbd{v t} in a VC
1922Dired buffer toggles between terse display and full display (@pxref{VC
1923Dired Commands}).
1924
1925@vindex vc-dired-recurse
1926 By default, VC Dired produces a recursive listing of noteworthy or
1927relevant files at or below the given directory. You can change this by
1928setting the variable @code{vc-dired-recurse} to @code{nil}; then VC
1929Dired shows only the files in the given directory.
1930
1931 The line for an individual file shows the version control state in the
1932place of the hard link count, owner, group, and size of the file. If
1933the file is unmodified, in sync with the master file, the version
1934control state shown is blank. Otherwise it consists of text in
1935parentheses. Under RCS and SCCS, the name of the user locking the file
1936is shown; under CVS, an abbreviated version of the @samp{cvs status}
1937output is used. Here is an example using RCS:
1938
1939@smallexample
1940@group
1941 /home/jim/project:
1942
1943 -rw-r--r-- (jim) Apr 2 23:39 file1
1944 -r--r--r-- Apr 5 20:21 file2
1945@end group
1946@end smallexample
1947
1948@noindent
1949The files @samp{file1} and @samp{file2} are under version control,
1950@samp{file1} is locked by user jim, and @samp{file2} is unlocked.
1951
1952 Here is an example using CVS:
1953
1954@smallexample
1955@group
1956 /home/joe/develop:
1957
1958 -rw-r--r-- (modified) Aug 2 1997 file1.c
1959 -rw-r--r-- Apr 4 20:09 file2.c
1960 -rw-r--r-- (merge) Sep 13 1996 file3.c
1961@end group
1962@end smallexample
1963
1964 Here @samp{file1.c} is modified with respect to the repository, and
1965@samp{file2.c} is not. @samp{file3.c} is modified, but other changes
1966have also been checked in to the repository---you need to merge them
1967with the work file before you can check it in.
1968
1969@vindex vc-stay-local
1970@vindex vc-cvs-stay-local
1971 In the above, if the repository were on a remote machine, VC would
1972only contact it when the variable @code{vc-stay-local} (or
1973@code{vc-cvs-stay-local}) is nil (@pxref{CVS Options}). This is
1974because access to the repository may be slow, or you may be working
1975offline and not have access to the repository at all. As a
1976consequence, VC would not be able to tell you that @samp{file3.c} is
1977in the ``merge'' state; you would learn that only when you try to
1978check-in your modified copy of the file, or use a command such as
1979@kbd{C-x v m}.
1980
1981 In practice, this is not a problem because CVS handles this case
1982consistently whenever it arises. In VC, you'll simply get prompted to
1983merge the remote changes into your work file first. The benefits of
1984less network communication usually outweigh the disadvantage of not
1985seeing remote changes immediately.
1986
1987@vindex vc-directory-exclusion-list
1988 When VC Dired displays subdirectories (in the ``full'' display mode),
1989it omits some that should never contain any files under version control.
1990By default, this includes Version Control subdirectories such as
1991@samp{RCS} and @samp{CVS}; you can customize this by setting the
1992variable @code{vc-directory-exclusion-list}.
1993
1994 You can fine-tune VC Dired's format by typing @kbd{C-u C-x v d}---as in
1995ordinary Dired, that allows you to specify additional switches for the
1996@samp{ls} command.
1997
1998@node VC Dired Commands
1999@subsubsection VC Dired Commands
2000
2001 All the usual Dired commands work normally in VC Dired mode, except
2002for @kbd{v}, which is redefined as the version control prefix. You can
2003invoke VC commands such as @code{vc-diff} and @code{vc-print-log} by
2004typing @kbd{v =}, or @kbd{v l}, and so on. Most of these commands apply
2005to the file name on the current line.
2006
2007 The command @kbd{v v} (@code{vc-next-action}) operates on all the
2008marked files, so that you can lock or check in several files at once.
2009If it operates on more than one file, it handles each file according to
2010its current state; thus, it might lock one file, but check in another
2011file. This could be confusing; it is up to you to avoid confusing
2012behavior by marking a set of files that are in a similar state. If no
2013files are marked, @kbd{v v} operates on the file in the current line.
2014
2015 If any files call for check-in, @kbd{v v} reads a single log entry,
2016then uses it for all the files being checked in. This is convenient for
2017registering or checking in several files at once, as part of the same
2018change.
2019
2020@findex vc-dired-toggle-terse-mode
2021@findex vc-dired-mark-locked
2022 You can toggle between terse display (only locked files, or files not
2023up-to-date) and full display at any time by typing @kbd{v t}
2024(@code{vc-dired-toggle-terse-mode}). There is also a special command
2025@kbd{* l} (@code{vc-dired-mark-locked}), which marks all files currently
2026locked (or, with CVS, all files not up-to-date). Thus, typing @kbd{* l
2027t k} is another way to delete from the buffer all files except those
2028currently locked.
2029
2030@node Branches 1896@node Branches
2031@subsection Multiple Branches of a File 1897@subsection Multiple Branches of a File
2032@cindex branch (version control) 1898@cindex branch (version control)
@@ -2205,9 +2071,10 @@ own choice of selected versions, but all share the same common RCS
2205records. 2071records.
2206 2072
2207 This technique works reliably and automatically, provided that the 2073 This technique works reliably and automatically, provided that the
2208source files contain RCS version headers (@pxref{Version Headers}). The 2074source files contain RCS version headers (@pxref{Version
2209headers enable Emacs to be sure, at all times, which version number is 2075Headers,,,emacs-xtra, Specialized Emacs Features}). The headers enable
2210present in the work file. 2076Emacs to be sure, at all times, which version number is present in the
2077work file.
2211 2078
2212 If the files do not have version headers, you must instead tell Emacs 2079 If the files do not have version headers, you must instead tell Emacs
2213explicitly in each session which branch you are working on. To do this, 2080explicitly in each session which branch you are working on. To do this,
@@ -2215,730 +2082,6 @@ first find the file, then type @kbd{C-u C-x v v} and specify the correct
2215branch number. This ensures that Emacs knows which branch it is using 2082branch number. This ensures that Emacs knows which branch it is using
2216during this particular editing session. 2083during this particular editing session.
2217 2084
2218@node Remote Repositories
2219@subsection Remote Repositories
2220@cindex remote repositories (CVS)
2221
2222 A common way of using CVS is to set up a central CVS repository on
2223some Internet host, then have each developer check out a personal
2224working copy of the files on his local machine. Committing changes to
2225the repository, and picking up changes from other users into one's own
2226working area, then works by direct interactions with the CVS server.
2227
2228 One difficulty is that access to the CVS server is often slow, and
2229that developers might need to work off-line as well. VC is designed
2230to reduce the amount of network interaction necessary.
2231
2232@menu
2233* Version Backups:: Keeping local copies of repository versions.
2234* Local Version Control:: Using another version system for local editing.
2235@end menu
2236
2237@node Version Backups
2238@subsubsection Version Backups
2239@cindex version backups
2240
2241@cindex automatic version backups
2242 When VC sees that the CVS repository for a file is on a remote
2243machine, it automatically makes local backups of unmodified versions
2244of the file---@dfn{automatic version backups}. This means that you
2245can compare the file to the repository version (@kbd{C-x v =}), or
2246revert to that version (@kbd{C-x v u}), without any network
2247interactions.
2248
2249 The local copy of the unmodified file is called a @dfn{version
2250backup} to indicate that it corresponds exactly to a version that is
2251stored in the repository. Note that version backups are not the same
2252as ordinary Emacs backup files (@pxref{Backup}). But they follow a
2253similar naming convention.
2254
2255 For a file that comes from a remote CVS repository, VC makes a
2256version backup whenever you save the first changes to the file, and
2257removes it after you have committed your modified version to the
2258repository. You can disable the making of automatic version backups by
2259setting @code{vc-cvs-stay-local} to @code{nil} (@pxref{CVS Options}).
2260
2261@cindex manual version backups
2262 The name of the automatic version backup for version @var{version}
2263of file @var{file} is @code{@var{file}.~@var{version}.~}. This is
2264almost the same as the name used by @kbd{C-x v ~} (@pxref{Old
2265Versions}), the only difference being the additional dot (@samp{.})
2266after the version number. This similarity is intentional, because
2267both kinds of files store the same kind of information. The file made
2268by @kbd{C-x v ~} acts as a @dfn{manual version backup}.
2269
2270 All the VC commands that operate on old versions of a file can use
2271both kinds of version backups. For instance, @kbd{C-x v ~} uses
2272either an automatic or a manual version backup, if possible, to get
2273the contents of the version you request. Likewise, @kbd{C-x v =} and
2274@kbd{C-x v u} use either an automatic or a manual version backup, if
2275one of them exists, to get the contents of a version to compare or
2276revert to. If you changed a file outside of Emacs, so that no
2277automatic version backup was created for the previous text, you can
2278create a manual backup of that version using @kbd{C-x v ~}, and thus
2279obtain the benefit of the local copy for Emacs commands.
2280
2281 The only difference in Emacs's handling of manual and automatic
2282version backups, once they exist, is that Emacs deletes automatic
2283version backups when you commit to the repository. By contrast,
2284manual version backups remain until you delete them.
2285
2286@node Local Version Control
2287@subsubsection Local Version Control
2288@cindex local version control
2289@cindex local back end (version control)
2290
2291When you make many changes to a file that comes from a remote
2292repository, it can be convenient to have version control on your local
2293machine as well. You can then record intermediate versions, revert to
2294a previous state, etc., before you actually commit your changes to the
2295remote server.
2296
2297VC lets you do this by putting a file under a second, local version
2298control system, so that the file is effectively registered in two
2299systems at the same time. For the description here, we will assume
2300that the remote system is CVS, and you use RCS locally, although the
2301mechanism works with any combination of version control systems
2302(@dfn{back ends}).
2303
2304To make it work with other back ends, you must make sure that the
2305``more local'' back end comes before the ``more remote'' back end in
2306the setting of @code{vc-handled-backends} (@pxref{Customizing VC}). By
2307default, this variable is set up so that you can use remote CVS and
2308local RCS as described here.
2309
2310To start using local RCS for a file that comes from a remote CVS
2311server, you must @emph{register the file in RCS}, by typing @kbd{C-u
2312C-x v v rcs @key{RET}}. (In other words, use @code{vc-next-action} with a
2313prefix argument, and specify RCS as the back end.)
2314
2315You can do this at any time; it does not matter whether you have
2316already modified the file with respect to the version in the CVS
2317repository. If possible, VC tries to make the RCS master start with
2318the unmodified repository version, then checks in any local changes
2319as a new version. This works if you have not made any changes yet, or
2320if the unmodified repository version exists locally as a version
2321backup (@pxref{Version Backups}). If the unmodified version is not
2322available locally, the RCS master starts with the modified version;
2323the only drawback to this is that you cannot compare your changes
2324locally to what is stored in the repository.
2325
2326The version number of the RCS master is derived from the current CVS
2327version, starting a branch from it. For example, if the current CVS
2328version is 1.23, the local RCS branch will be 1.23.1. Version 1.23 in
2329the RCS master will be identical to version 1.23 under CVS; your first
2330changes are checked in as 1.23.1.1. (If the unmodified file is not
2331available locally, VC will check in the modified file twice, both as
23321.23 and 1.23.1.1, to make the revision numbers consistent.)
2333
2334If you do not use locking under CVS (the default), locking is also
2335disabled for RCS, so that editing under RCS works exactly as under
2336CVS.
2337
2338When you are done with local editing, you can commit the final version
2339back to the CVS repository by typing @kbd{C-u C-x v v cvs @key{RET}}.
2340This initializes the log entry buffer (@pxref{Log Buffer}) to contain
2341all the log entries you have recorded in the RCS master; you can edit
2342them as you wish, and then commit in CVS by typing @kbd{C-c C-c}. If
2343the commit is successful, VC removes the RCS master, so that the file
2344is once again registered under CVS only. (The RCS master is not
2345actually deleted, just renamed by appending @samp{~} to the name, so
2346that you can refer to it later if you wish.)
2347
2348While using local RCS, you can pick up recent changes from the CVS
2349repository into your local file, or commit some of your changes back
2350to CVS, without terminating local RCS version control. To do this,
2351switch to the CVS back end temporarily, with the @kbd{C-x v b} command:
2352
2353@table @kbd
2354@item C-x v b
2355Switch to another back end that the current file is registered
2356under (@code{vc-switch-backend}).
2357
2358@item C-u C-x v b @var{backend} @key{RET}
2359Switch to @var{backend} for the current file.
2360@end table
2361
2362@kindex C-x v b
2363@findex vc-switch-backend
2364@kbd{C-x v b} does not change the buffer contents, or any files; it
2365only changes VC's perspective on how to handle the file. Any
2366subsequent VC commands for that file will operate on the back end that
2367is currently selected.
2368
2369If the current file is registered in more than one back end, typing
2370@kbd{C-x v b} ``cycles'' through all of these back ends. With a
2371prefix argument, it asks for the back end to use in the minibuffer.
2372
2373Thus, if you are using local RCS, and you want to pick up some recent
2374changes in the file from remote CVS, first visit the file, then type
2375@kbd{C-x v b} to switch to CVS, and finally use @kbd{C-x v m
2376@key{RET}} to merge the news (@pxref{Merging}). You can then switch
2377back to RCS by typing @kbd{C-x v b} again, and continue to edit
2378locally.
2379
2380But if you do this, the revision numbers in the RCS master no longer
2381correspond to those of CVS. Technically, this is not a problem, but
2382it can become difficult to keep track of what is in the CVS repository
2383and what is not. So we suggest that you return from time to time to
2384CVS-only operation, by committing your local changes back to the
2385repository using @kbd{C-u C-x v v cvs @key{RET}}.
2386
2387@node Snapshots
2388@subsection Snapshots
2389@cindex snapshots and version control
2390
2391 A @dfn{snapshot} is a named set of file versions (one for each
2392registered file) that you can treat as a unit. One important kind of
2393snapshot is a @dfn{release}, a (theoretically) stable version of the
2394system that is ready for distribution to users.
2395
2396@menu
2397* Making Snapshots:: The snapshot facilities.
2398* Snapshot Caveats:: Things to be careful of when using snapshots.
2399@end menu
2400
2401@node Making Snapshots
2402@subsubsection Making and Using Snapshots
2403
2404 There are two basic commands for snapshots; one makes a
2405snapshot with a given name, the other retrieves a named snapshot.
2406
2407@table @code
2408@kindex C-x v s
2409@findex vc-create-snapshot
2410@item C-x v s @var{name} @key{RET}
2411Define the last saved versions of every registered file in or under the
2412current directory as a snapshot named @var{name}
2413(@code{vc-create-snapshot}).
2414
2415@kindex C-x v r
2416@findex vc-retrieve-snapshot
2417@item C-x v r @var{name} @key{RET}
2418For all registered files at or below the current directory level, select
2419whatever versions correspond to the snapshot @var{name}
2420(@code{vc-retrieve-snapshot}).
2421
2422This command reports an error if any files are locked at or below the
2423current directory, without changing anything; this is to avoid
2424overwriting work in progress.
2425@end table
2426
2427 A snapshot uses a very small amount of resources---just enough to record
2428the list of file names and which version belongs to the snapshot. Thus,
2429you need not hesitate to create snapshots whenever they are useful.
2430
2431 You can give a snapshot name as an argument to @kbd{C-x v =} or
2432@kbd{C-x v ~} (@pxref{Old Versions}). Thus, you can use it to compare a
2433snapshot against the current files, or two snapshots against each other,
2434or a snapshot against a named version.
2435
2436@node Snapshot Caveats
2437@subsubsection Snapshot Caveats
2438
2439@cindex named configurations (RCS)
2440 VC's snapshot facilities are modeled on RCS's named-configuration
2441support. They use RCS's native facilities for this, so
2442snapshots made using RCS through VC are visible even when you bypass VC.
2443
2444 With CVS, Meta-CVS, and Subversion, VC also uses the native
2445mechanism provided by that back end to make snapshots and retrieve them
2446(@dfn{tags} for CVS and Meta-CVS, @dfn{copies} for Subversion).
2447
2448@c worded verbosely to avoid overfull hbox.
2449 For SCCS, VC implements snapshots itself. The files it uses contain
2450name/file/version-number triples. These snapshots are visible only
2451through VC.
2452
2453 There is no support for VC snapshots using GNU Arch yet.
2454
2455 A snapshot is a set of checked-in versions. So make sure that all the
2456files are checked in and not locked when you make a snapshot.
2457
2458 File renaming and deletion can create some difficulties with snapshots.
2459This is not a VC-specific problem, but a general design issue in version
2460control systems that no one has solved very well yet.
2461
2462 If you rename a registered file, you need to rename its master along
2463with it (the command @code{vc-rename-file} does this automatically). If
2464you are using SCCS, you must also update the records of the snapshot, to
2465mention the file by its new name (@code{vc-rename-file} does this,
2466too). An old snapshot that refers to a master file that no longer
2467exists under the recorded name is invalid; VC can no longer retrieve
2468it. It would be beyond the scope of this manual to explain enough about
2469RCS and SCCS to explain how to update the snapshots by hand.
2470
2471 Using @code{vc-rename-file} makes the snapshot remain valid for
2472retrieval, but it does not solve all problems. For example, some of the
2473files in your program probably refer to others by name. At the very
2474least, the makefile probably mentions the file that you renamed. If you
2475retrieve an old snapshot, the renamed file is retrieved under its new
2476name, which is not the name that the makefile expects. So the program
2477won't really work as retrieved.
2478
2479@node Miscellaneous VC
2480@subsection Miscellaneous Commands and Features of VC
2481
2482 This section explains the less-frequently-used features of VC.
2483
2484@menu
2485* Change Logs and VC:: Generating a change log file from log entries.
2486* Renaming and VC:: A command to rename both the source and master
2487 file correctly.
2488* Version Headers:: Inserting version control headers into working files.
2489@end menu
2490
2491@node Change Logs and VC
2492@subsubsection Change Logs and VC
2493
2494 If you use RCS or CVS for a program and also maintain a change log
2495file for it (@pxref{Change Log}), you can generate change log entries
2496automatically from the version control log entries:
2497
2498@table @kbd
2499@item C-x v a
2500@kindex C-x v a
2501@findex vc-update-change-log
2502Visit the current directory's change log file and, for registered files
2503in that directory, create new entries for versions checked in since the
2504most recent entry in the change log file.
2505(@code{vc-update-change-log}).
2506
2507This command works with RCS or CVS only, not with any of the other
2508back ends.
2509
2510@item C-u C-x v a
2511As above, but only find entries for the current buffer's file.
2512
2513@item M-1 C-x v a
2514As above, but find entries for all the currently visited files that are
2515maintained with version control. This works only with RCS, and it puts
2516all entries in the log for the default directory, which may not be
2517appropriate.
2518@end table
2519
2520 For example, suppose the first line of @file{ChangeLog} is dated
25211999-04-10, and that the only check-in since then was by Nathaniel
2522Bowditch to @file{rcs2log} on 1999-05-22 with log text @samp{Ignore log
2523messages that start with `#'.}. Then @kbd{C-x v a} visits
2524@file{ChangeLog} and inserts text like this:
2525
2526@iftex
2527@medbreak
2528@end iftex
2529@smallexample
2530@group
25311999-05-22 Nathaniel Bowditch <nat@@apn.org>
2532
2533 * rcs2log: Ignore log messages that start with `#'.
2534@end group
2535@end smallexample
2536@iftex
2537@medbreak
2538@end iftex
2539
2540@noindent
2541You can then edit the new change log entry further as you wish.
2542
2543 Some of the new change log entries may duplicate what's already in
2544ChangeLog. You will have to remove these duplicates by hand.
2545
2546 Normally, the log entry for file @file{foo} is displayed as @samp{*
2547foo: @var{text of log entry}}. The @samp{:} after @file{foo} is omitted
2548if the text of the log entry starts with @w{@samp{(@var{functionname}):
2549}}. For example, if the log entry for @file{vc.el} is
2550@samp{(vc-do-command): Check call-process status.}, then the text in
2551@file{ChangeLog} looks like this:
2552
2553@iftex
2554@medbreak
2555@end iftex
2556@smallexample
2557@group
25581999-05-06 Nathaniel Bowditch <nat@@apn.org>
2559
2560 * vc.el (vc-do-command): Check call-process status.
2561@end group
2562@end smallexample
2563@iftex
2564@medbreak
2565@end iftex
2566
2567 When @kbd{C-x v a} adds several change log entries at once, it groups
2568related log entries together if they all are checked in by the same
2569author at nearly the same time. If the log entries for several such
2570files all have the same text, it coalesces them into a single entry.
2571For example, suppose the most recent check-ins have the following log
2572entries:
2573
2574@flushleft
2575@bullet{} For @file{vc.texinfo}: @samp{Fix expansion typos.}
2576@bullet{} For @file{vc.el}: @samp{Don't call expand-file-name.}
2577@bullet{} For @file{vc-hooks.el}: @samp{Don't call expand-file-name.}
2578@end flushleft
2579
2580@noindent
2581They appear like this in @file{ChangeLog}:
2582
2583@iftex
2584@medbreak
2585@end iftex
2586@smallexample
2587@group
25881999-04-01 Nathaniel Bowditch <nat@@apn.org>
2589
2590 * vc.texinfo: Fix expansion typos.
2591
2592 * vc.el, vc-hooks.el: Don't call expand-file-name.
2593@end group
2594@end smallexample
2595@iftex
2596@medbreak
2597@end iftex
2598
2599 Normally, @kbd{C-x v a} separates log entries by a blank line, but you
2600can mark several related log entries to be clumped together (without an
2601intervening blank line) by starting the text of each related log entry
2602with a label of the form @w{@samp{@{@var{clumpname}@} }}. The label
2603itself is not copied to @file{ChangeLog}. For example, suppose the log
2604entries are:
2605
2606@flushleft
2607@bullet{} For @file{vc.texinfo}: @samp{@{expand@} Fix expansion typos.}
2608@bullet{} For @file{vc.el}: @samp{@{expand@} Don't call expand-file-name.}
2609@bullet{} For @file{vc-hooks.el}: @samp{@{expand@} Don't call expand-file-name.}
2610@end flushleft
2611
2612@noindent
2613Then the text in @file{ChangeLog} looks like this:
2614
2615@iftex
2616@medbreak
2617@end iftex
2618@smallexample
2619@group
26201999-04-01 Nathaniel Bowditch <nat@@apn.org>
2621
2622 * vc.texinfo: Fix expansion typos.
2623 * vc.el, vc-hooks.el: Don't call expand-file-name.
2624@end group
2625@end smallexample
2626@iftex
2627@medbreak
2628@end iftex
2629
2630 A log entry whose text begins with @samp{#} is not copied to
2631@file{ChangeLog}. For example, if you merely fix some misspellings in
2632comments, you can log the change with an entry beginning with @samp{#}
2633to avoid putting such trivia into @file{ChangeLog}.
2634
2635@node Renaming and VC
2636@subsubsection Renaming VC Work Files and Master Files
2637
2638@findex vc-rename-file
2639 When you rename a registered file, you must also rename its master
2640file correspondingly to get proper results. Use @code{vc-rename-file}
2641to rename the source file as you specify, and rename its master file
2642accordingly. It also updates any snapshots (@pxref{Snapshots}) that
2643mention the file, so that they use the new name; despite this, the
2644snapshot thus modified may not completely work (@pxref{Snapshot
2645Caveats}).
2646
2647 Some back ends do not provide an explicit rename operation to their
2648repositories. After issuing @code{vc-rename-file}, use @kbd{C-x v v}
2649on the original and renamed buffers and provide the necessary edit
2650log.
2651
2652 You cannot use @code{vc-rename-file} on a file that is locked by
2653someone else.
2654
2655@node Version Headers
2656@subsubsection Inserting Version Control Headers
2657
2658 Sometimes it is convenient to put version identification strings
2659directly into working files. Certain special strings called
2660@dfn{version headers} are replaced in each successive version by the
2661number of that version, the name of the user who created it, and other
2662relevant information. All of the back ends that VC supports have such
2663a mechanism, except GNU Arch.
2664
2665 VC does not normally use the information contained in these headers.
2666The exception is RCS---with RCS, version headers are sometimes more
2667reliable than the master file to determine which version of the file
2668you are editing. Note that in a multi-branch environment, version
2669headers are necessary to make VC behave correctly (@pxref{Multi-User
2670Branching}).
2671
2672 Searching for RCS version headers is controlled by the variable
2673@code{vc-consult-headers}. If it is non-@code{nil} (the default),
2674Emacs searches for headers to determine the version number you are
2675editing. Setting it to @code{nil} disables this feature.
2676
2677 Note that although CVS uses the same kind of version headers as RCS
2678does, VC never searches for these headers if you are using CVS,
2679regardless of the above setting.
2680
2681@kindex C-x v h
2682@findex vc-insert-headers
2683 You can use the @kbd{C-x v h} command (@code{vc-insert-headers}) to
2684insert a suitable header string.
2685
2686@table @kbd
2687@item C-x v h
2688Insert headers in a file for use with your version-control system.
2689@end table
2690
2691@vindex vc-@var{backend}-header
2692 The default header string is @samp{@w{$}Id$} for RCS and
2693@samp{@w{%}W%} for SCCS. You can specify other headers to insert by
2694setting the variables @code{vc-@var{backend}-header} where
2695@var{backend} is @code{rcs} or @code{sccs}.
2696
2697 Instead of a single string, you can specify a list of strings; then
2698each string in the list is inserted as a separate header on a line of
2699its own.
2700
2701 It may be necessary to use apparently-superfluous backslashes when
2702writing the strings that you put in this variable. For instance, you
2703might write @code{"$Id\$"} rather than @code{"$Id@w{$}"}. The extra
2704backslash prevents the string constant from being interpreted as a
2705header, if the Emacs Lisp file containing it is maintained with
2706version control.
2707
2708@vindex vc-comment-alist
2709 Each header is inserted surrounded by tabs, inside comment delimiters,
2710on a new line at point. Normally the ordinary comment
2711start and comment end strings of the current mode are used, but for
2712certain modes, there are special comment delimiters for this purpose;
2713the variable @code{vc-comment-alist} specifies them. Each element of
2714this list has the form @code{(@var{mode} @var{starter} @var{ender})}.
2715
2716@vindex vc-static-header-alist
2717 The variable @code{vc-static-header-alist} specifies further strings
2718to add based on the name of the buffer. Its value should be a list of
2719elements of the form @code{(@var{regexp} . @var{format})}. Whenever
2720@var{regexp} matches the buffer name, @var{format} is inserted as part
2721of the header. A header line is inserted for each element that matches
2722the buffer name, and for each string specified by
2723@code{vc-@var{backend}-header}. The header line is made by processing the
2724string from @code{vc-@var{backend}-header} with the format taken from the
2725element. The default value for @code{vc-static-header-alist} is as follows:
2726
2727@example
2728@group
2729(("\\.c$" .
2730 "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
2731#endif /* lint */\n"))
2732@end group
2733@end example
2734
2735@noindent
2736It specifies insertion of text of this form:
2737
2738@example
2739@group
2740
2741#ifndef lint
2742static char vcid[] = "@var{string}";
2743#endif /* lint */
2744@end group
2745@end example
2746
2747@noindent
2748Note that the text above starts with a blank line.
2749
2750 If you use more than one version header in a file, put them close
2751together in the file. The mechanism in @code{revert-buffer} that
2752preserves markers may not handle markers positioned between two version
2753headers.
2754
2755@node Customizing VC
2756@subsection Customizing VC
2757
2758@vindex vc-handled-backends
2759The variable @code{vc-handled-backends} determines which version
2760control systems VC should handle. The default value is @code{(RCS CVS
2761SVN SCCS Arch MCVS)}, so it contains all six version systems that are
2762currently supported. If you want VC to ignore one or more of these
2763systems, exclude its name from the list. To disable VC entirely, set
2764this variable to @code{nil}.
2765
2766The order of systems in the list is significant: when you visit a file
2767registered in more than one system (@pxref{Local Version Control}),
2768VC uses the system that comes first in @code{vc-handled-backends} by
2769default. The order is also significant when you register a file for
2770the first time, @pxref{Registering} for details.
2771
2772@menu
2773* General VC Options:: Options that apply to multiple back ends.
2774* RCS and SCCS:: Options for RCS and SCCS.
2775* CVS Options:: Options for CVS.
2776@end menu
2777
2778@node General VC Options
2779@subsubsection General Options
2780
2781@vindex vc-make-backup-files
2782 Emacs normally does not save backup files for source files that are
2783maintained with version control. If you want to make backup files even
2784for files that use version control, set the variable
2785@code{vc-make-backup-files} to a non-@code{nil} value.
2786
2787@vindex vc-keep-workfiles
2788 Normally the work file exists all the time, whether it is locked or
2789not. If you set @code{vc-keep-workfiles} to @code{nil}, then checking
2790in a new version with @kbd{C-x v v} deletes the work file; but any
2791attempt to visit the file with Emacs creates it again. (With CVS, work
2792files are always kept.)
2793
2794@vindex vc-follow-symlinks
2795 Editing a version-controlled file through a symbolic link can be
2796dangerous. It bypasses the version control system---you can edit the
2797file without locking it, and fail to check your changes in. Also,
2798your changes might overwrite those of another user. To protect against
2799this, VC checks each symbolic link that you visit, to see if it points
2800to a file under version control.
2801
2802 The variable @code{vc-follow-symlinks} controls what to do when a
2803symbolic link points to a version-controlled file. If it is @code{nil},
2804VC only displays a warning message. If it is @code{t}, VC automatically
2805follows the link, and visits the real file instead, telling you about
2806this in the echo area. If the value is @code{ask} (the default), VC
2807asks you each time whether to follow the link.
2808
2809@vindex vc-suppress-confirm
2810 If @code{vc-suppress-confirm} is non-@code{nil}, then @kbd{C-x v v}
2811and @kbd{C-x v i} can save the current buffer without asking, and
2812@kbd{C-x v u} also operates without asking for confirmation. (This
2813variable does not affect @kbd{C-x v c}; that operation is so drastic
2814that it should always ask for confirmation.)
2815
2816@vindex vc-command-messages
2817 VC mode does much of its work by running the shell commands for RCS,
2818CVS and SCCS. If @code{vc-command-messages} is non-@code{nil}, VC
2819displays messages to indicate which shell commands it runs, and
2820additional messages when the commands finish.
2821
2822@vindex vc-path
2823 You can specify additional directories to search for version control
2824programs by setting the variable @code{vc-path}. These directories
2825are searched before the usual search path. It is rarely necessary to
2826set this variable, because VC normally finds the proper files
2827automatically.
2828
2829@node RCS and SCCS
2830@subsubsection Options for RCS and SCCS
2831
2832@cindex non-strict locking (RCS)
2833@cindex locking, non-strict (RCS)
2834 By default, RCS uses locking to coordinate the activities of several
2835users, but there is a mode called @dfn{non-strict locking} in which
2836you can check-in changes without locking the file first. Use
2837@samp{rcs -U} to switch to non-strict locking for a particular file,
2838see the @code{rcs} manual page for details.
2839
2840 When deducing the version control state of an RCS file, VC first
2841looks for an RCS version header string in the file (@pxref{Version
2842Headers}). If there is no header string, VC normally looks at the
2843file permissions of the work file; this is fast. But there might be
2844situations when the file permissions cannot be trusted. In this case
2845the master file has to be consulted, which is rather expensive. Also
2846the master file can only tell you @emph{if} there's any lock on the
2847file, but not whether your work file really contains that locked
2848version.
2849
2850@vindex vc-consult-headers
2851 You can tell VC not to use version headers to determine the file
2852status by setting @code{vc-consult-headers} to @code{nil}. VC then
2853always uses the file permissions (if it is supposed to trust them), or
2854else checks the master file.
2855
2856@vindex vc-mistrust-permissions
2857 You can specify the criterion for whether to trust the file
2858permissions by setting the variable @code{vc-mistrust-permissions}.
2859Its value can be @code{t} (always mistrust the file permissions and
2860check the master file), @code{nil} (always trust the file
2861permissions), or a function of one argument which makes the decision.
2862The argument is the directory name of the @file{RCS} subdirectory. A
2863non-@code{nil} value from the function says to mistrust the file
2864permissions. If you find that the file permissions of work files are
2865changed erroneously, set @code{vc-mistrust-permissions} to @code{t}.
2866Then VC always checks the master file to determine the file's status.
2867
2868 VC determines the version control state of files under SCCS much as
2869with RCS. It does not consider SCCS version headers, though. Thus,
2870the variable @code{vc-mistrust-permissions} affects SCCS use, but
2871@code{vc-consult-headers} does not.
2872
2873@node CVS Options
2874@subsubsection Options specific for CVS
2875
2876@cindex locking (CVS)
2877 By default, CVS does not use locking to coordinate the activities of
2878several users; anyone can change a work file at any time. However,
2879there are ways to restrict this, resulting in behavior that resembles
2880locking.
2881
2882@cindex CVSREAD environment variable (CVS)
2883 For one thing, you can set the @env{CVSREAD} environment variable
2884(the value you use makes no difference). If this variable is defined,
2885CVS makes your work files read-only by default. In Emacs, you must
2886type @kbd{C-x v v} to make the file writable, so that editing works
2887in fact similar as if locking was used. Note however, that no actual
2888locking is performed, so several users can make their files writable
2889at the same time. When setting @env{CVSREAD} for the first time, make
2890sure to check out all your modules anew, so that the file protections
2891are set correctly.
2892
2893@cindex cvs watch feature
2894@cindex watching files (CVS)
2895 Another way to achieve something similar to locking is to use the
2896@dfn{watch} feature of CVS. If a file is being watched, CVS makes it
2897read-only by default, and you must also use @kbd{C-x v v} in Emacs to
2898make it writable. VC calls @code{cvs edit} to make the file writable,
2899and CVS takes care to notify other developers of the fact that you
2900intend to change the file. See the CVS documentation for details on
2901using the watch feature.
2902
2903@vindex vc-stay-local
2904@vindex vc-cvs-stay-local
2905@cindex remote repositories (CVS)
2906 When a file's repository is on a remote machine, VC tries to keep
2907network interactions to a minimum. This is controlled by the variable
2908@code{vc-cvs-stay-local}. There is another variable,
2909@code{vc-stay-local}, which enables the feature also for other back
2910ends that support it, including CVS. In the following, we will talk
2911only about @code{vc-cvs-stay-local}, but everything applies to
2912@code{vc-stay-local} as well.
2913
2914If @code{vc-cvs-stay-local} is @code{t} (the default), then VC uses
2915only the entry in the local CVS subdirectory to determine the file's
2916state (and possibly information returned by previous CVS commands).
2917One consequence of this is that when you have modified a file, and
2918somebody else has already checked in other changes to the file, you
2919are not notified of it until you actually try to commit. (But you can
2920try to pick up any recent changes from the repository first, using
2921@kbd{C-x v m @key{RET}}, @pxref{Merging}).
2922
2923 When @code{vc-cvs-stay-local} is @code{t}, VC also makes local
2924version backups, so that simple diff and revert operations are
2925completely local (@pxref{Version Backups}).
2926
2927 On the other hand, if you set @code{vc-cvs-stay-local} to @code{nil},
2928then VC queries the remote repository @emph{before} it decides what to
2929do in @code{vc-next-action} (@kbd{C-x v v}), just as it does for local
2930repositories. It also does not make any version backups.
2931
2932 You can also set @code{vc-cvs-stay-local} to a regular expression
2933that is matched against the repository host name; VC then stays local
2934only for repositories from hosts that match the pattern.
2935
2936@vindex vc-cvs-global-switches
2937 You can specify additional command line options to pass to all CVS
2938operations in the variable @code{vc-cvs-global-switches}. These
2939switches are inserted immediately after the @code{cvs} command, before
2940the name of the operation to invoke.
2941
2942@node Directories 2085@node Directories
2943@section File Directories 2086@section File Directories
2944 2087