]> code.delx.au - gnu-emacs/blob - doc/emacs/maintaining.texi
Add 2012 to FSF copyright years for Emacs files (do not merge to trunk)
[gnu-emacs] / doc / emacs / maintaining.texi
1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1999, 2000,
3 @c 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
4 @c Free Software Foundation, Inc.
5 @c See file emacs.texi for copying conditions.
6 @node Maintaining, Abbrevs, Building, Top
7 @chapter Maintaining Large Programs
8
9 This chapter describes Emacs features for maintaining large
10 programs.
11
12 @menu
13 * Version Control:: Using version control systems.
14 * Change Log:: Maintaining a change history for your program.
15 * Tags:: Go directly to any function in your program in one
16 command. Tags remembers which file it is in.
17 * EDE:: An integrated development environment for Emacs.
18 @ifnottex
19 * Emerge:: A convenient way of merging two versions of a program.
20 @end ifnottex
21 @end menu
22
23 @node Version Control
24 @section Version Control
25 @cindex version control
26
27 A @dfn{version control system} is a program that can record multiple
28 versions of a source file, storing information such as the creation
29 time of each version, who made it, and a description of what was
30 changed.
31
32 The Emacs version control interface is called @dfn{VC}. VC commands
33 work with several different version control systems; currently, it
34 supports GNU Arch, Bazaar, CVS, Git, Mercurial, Monotone, RCS,
35 SCCS/CSSC, and Subversion. Of these, the GNU project distributes CVS,
36 Arch, RCS, and Bazaar.
37
38 VC is enabled automatically whenever you visit a file governed by a
39 version control system. To disable VC entirely, set the customizable
40 variable @code{vc-handled-backends} to @code{nil}
41 @iftex
42 (@pxref{Customizing VC,,,emacs-xtra, Specialized Emacs Features}).
43 @end iftex
44 @ifnottex
45 (@pxref{Customizing VC}).
46 @end ifnottex
47
48 @menu
49 * Introduction to VC:: How version control works in general.
50 * VC Mode Line:: How the mode line shows version control status.
51 * Basic VC Editing:: How to edit a file under version control.
52 * Log Buffer:: Features available in log entry buffers.
53 * Old Revisions:: Examining and comparing old versions.
54 * Secondary VC Commands:: The commands used a little less frequently.
55 * VC Directory Mode:: Listing files managed by version control.
56 * Branches:: Multiple lines of development.
57 @ifnottex
58 * Remote Repositories:: Efficient access to remote CVS servers.
59 * Revision Tags:: Symbolic names for revisions.
60 * Miscellaneous VC:: Various other commands and features of VC.
61 * Customizing VC:: Variables that change VC's behavior.
62 @end ifnottex
63 @end menu
64
65 @node Introduction to VC
66 @subsection Introduction to Version Control
67
68 VC allows you to use a version control system from within Emacs,
69 integrating the version control operations smoothly with editing. It
70 provides a uniform interface for common operations in many version
71 control operations.
72
73 Some uncommon or intricate version control operations, such as
74 altering repository settings, are not supported in VC. You should
75 perform such tasks outside Emacs, e.g. via the command line.
76
77 This section provides a general overview of version control, and
78 describes the version control systems that VC supports. You can skip
79 this section if you are already familiar with the version control system
80 you want to use.
81
82 @menu
83 * Why Version Control?:: Understanding the problems it addresses.
84 * Version Control Systems:: Supported version control back-end systems.
85 * VCS Concepts:: Words and concepts related to version control.
86 * VCS Merging:: How file conflicts are handled.
87 * VCS Changesets:: How changes are grouped.
88 * VCS Repositories:: Where version control repositories are stored.
89 * Types of Log File:: The VCS log in contrast to the ChangeLog.
90 @end menu
91
92 @node Why Version Control?
93 @subsubsection Understanding the problems it addresses
94
95 Version control systems provide you with three important
96 capabilities:
97
98 @itemize @bullet
99 @item
100 @dfn{Reversibility}: the ability to back up to a previous state if you
101 discover that some modification you did was a mistake or a bad idea.
102
103 @item
104 @dfn{Concurrency}: the ability to have many people modifying the same
105 collection of files knowing that conflicting modifications can be
106 detected and resolved.
107
108 @item
109 @dfn{History}: the ability to attach historical data to your data,
110 such as explanatory comments about the intention behind each change to
111 it. Even for a programmer working solo, change histories are an
112 important aid to memory; for a multi-person project, they are a
113 vitally important form of communication among developers.
114 @end itemize
115
116 @node Version Control Systems
117 @subsubsection Supported Version Control Systems
118
119 @cindex back end (version control)
120 VC currently works with many different version control systems,
121 which it refers to as @dfn{back ends}:
122
123 @itemize @bullet
124
125 @cindex SCCS
126 @item
127 SCCS was the first version control system ever built, and was long ago
128 superseded by more advanced ones. VC compensates for certain features
129 missing in SCCS (e.g., tag names for releases) by implementing them
130 itself. Other VC features, such as multiple branches, are simply
131 unavailable. Since SCCS is non-free, we recommend avoiding it.
132
133 @cindex CSSC
134 @item
135 CSSC is a free replacement for SCCS. You should use CSSC only if, for
136 some reason, you cannot use a more recent and better-designed version
137 control system.
138
139 @cindex RCS
140 @item
141 RCS is the free version control system around which VC was initially
142 built. It is relatively primitive: it cannot be used over the
143 network, and works at the level of individual files. Almost
144 everything you can do with RCS can be done through VC.
145
146 @cindex CVS
147 @item
148 CVS is the free version control system that was, until recently (circa
149 2008), used by the majority of free software projects. Nowadays, it
150 is slowly being superseded by newer systems. CVS allows concurrent
151 multi-user development either locally or over the network. Unlike
152 newer systems, it lacks support for atomic commits and file
153 moving/renaming. VC supports all basic editing operations under CVS.
154
155 @cindex SVN
156 @cindex Subversion
157 @item
158 Subversion (SVN) is a free version control system designed to be
159 similar to CVS but without its problems (e.g., it supports atomic
160 commits of filesets, and versioning of directories, symbolic links,
161 meta-data, renames, copies, and deletes).
162
163 @cindex GNU Arch
164 @cindex Arch
165 @item
166 GNU Arch is one of the earliest @dfn{distributed} version control
167 systems (the other being Monotone). @xref{VCS Concepts}, for a
168 description of distributed version control systems. It is no longer
169 under active development, and has been deprecated in favor of Bazaar.
170
171 @cindex git
172 @item
173 Git is a distributed version control system originally invented by
174 Linus Torvalds to support development of Linux (his kernel). VC
175 supports many common git operations, but others, such as repository
176 syncing, must be done from the command line.
177
178 @cindex hg
179 @cindex Mercurial
180 @item
181 Mercurial (hg) is a distributed version control system broadly
182 resembling git. VC supports most Mercurial commands, with the
183 exception of repository sync operations.
184
185 @cindex bzr
186 @cindex Bazaar
187 @item
188 Bazaar (bzr) is a distributed version control system that supports
189 both repository-based and distributed versioning. VC supports most
190 basic editing operations under Bazaar.
191 @end itemize
192
193 Previous versions of VC supported a version control system known as
194 Meta-CVS. This support was dropped due to limited interest from users
195 and developers.
196
197 @node VCS Concepts
198 @subsubsection Concepts of Version Control
199
200 @cindex repository
201 @cindex registered file
202 When a file is under version control, we say that it is
203 @dfn{registered} in the version control system. The system has a
204 @dfn{repository} which stores both the file's present state and its
205 change history---enough to reconstruct the current version or any
206 earlier version. The repository also contains other information, such
207 as @dfn{log entries} that describe the changes made to each file.
208
209 @cindex work file
210 @cindex checking out files
211 The copy of a version-controlled file that you actually edit is
212 called the @dfn{work file}. You can change each work file as you
213 would an ordinary file. After you are done with a set of changes, you
214 @dfn{commit} (or @dfn{check in}) the changes; this records the changes
215 in the repository, along with a descriptive log entry.
216
217 @cindex revision
218 @cindex revision ID
219 A copy of a file stored in a repository is called a @dfn{revision}.
220 The history of a file is a sequence of revisions. Each revision is
221 named by a @dfn{revision ID}. The format of the revision ID depends
222 on the version control system; in the simplest case, it is just an
223 integer.
224
225 To go beyond these basic concepts, you will need to understand three
226 aspects in which version control systems differ. As explained in the
227 next three sections, they can be lock-based or merge-based; file-based
228 or changeset-based; and centralized or decentralized. VC handles all
229 these modes of operation, but it cannot hide the differences.
230
231 @node VCS Merging
232 @subsubsection Merge-based vs lock-based Version Control
233 @cindex locking versus merging
234
235 A version control system typically has some mechanism to coordinate
236 between users who want to change the same file. There are two ways to
237 do this: merging and locking.
238
239 In a version control system that uses merging, each user may check
240 out and modify a work file at any time. The system lets you
241 @dfn{merge} your work file, which may contain changes that have not
242 been committed, with the latest changes that others have committed.
243
244 Older version control systems use a @dfn{locking} scheme instead.
245 Here, work files are normally read-only. To edit a file, you ask the
246 version control system to make it writable for you by @dfn{locking}
247 it; only one user can lock a given file at any given time. This
248 procedure is analogous to, but different from, the locking that Emacs
249 uses to detect simultaneous editing of ordinary files
250 (@pxref{Interlocking}). When you commit your changes, that unlocks
251 the file, and the work file becomes read-only again. Other users may
252 then lock the file to make their own changes.
253
254 Both locking and merging systems can have problems when multiple
255 users try to modify the same file at the same time. Locking systems
256 have @dfn{lock conflicts}; a user may try to check a file out and be
257 unable to because it is locked. In merging systems, @dfn{merge
258 conflicts} happen when you commit a change to a file that conflicts
259 with a change committed by someone else after your checkout. Both
260 kinds of conflict have to be resolved by human judgment and
261 communication. Experience has shown that merging is superior to
262 locking, both in convenience to developers and in minimizing the
263 number and severity of conflicts that actually occur.
264
265 SCCS always uses locking. RCS is lock-based by default but can be
266 told to operate in a merging style. CVS and Subversion are
267 merge-based by default but can be told to operate in a locking mode.
268 Distributed version control systems, such as GNU Arch, git, and
269 Mercurial, are exclusively merging-based.
270
271 VC mode supports both locking and merging version control. The
272 terms ``commit'' and ``update'' are used in newer version control
273 systems; older lock-based systems use the terms ``check in'' and
274 ``check out''. VC hides the differences between them as much as
275 possible.
276
277 @node VCS Changesets
278 @subsubsection Changeset-based vs File-based Version Control
279
280 @cindex changesets
281 On SCCS, RCS, CVS, and other early version control systems, version
282 control operations are @dfn{file-based}: each file has its own comment
283 and revision history separate from that of all other files. Newer
284 systems, beginning with Subversion, are @dfn{changeset-based}: a
285 checkin may include changes to several files, and the entire set of
286 changes is handled as a unit. Any comment associated with the change
287 does not belong to a single file, but to the changeset itself.
288
289 Changeset-based version control is more flexible and powerful than
290 file-based version control; usually, when a change to multiple files
291 has to be reversed, it's good to be able to easily identify and remove
292 all of it.
293
294 @node VCS Repositories
295 @subsubsection Decentralized vs Centralized Repositories
296
297 @cindex centralized version control
298 @cindex decentralized version control
299 Early version control systems were designed around a
300 @dfn{centralized} model in which each project has only one repository
301 used by all developers. SCCS, RCS, CVS, and Subversion share this
302 kind of model. One of its drawbacks is that the repository is a choke
303 point for reliability and efficiency.
304
305 GNU Arch pioneered the concept of @dfn{decentralized} version
306 control, later implemented in git, Mercurial, and Bazaar. A project
307 may have several different repositories, and these systems support a
308 sort of super-merge between repositories that tries to reconcile their
309 change histories. In effect, there is one repository for each
310 developer, and repository merges take the place of commit operations.
311
312 VC helps you manage the traffic between your personal workfiles and
313 a repository. Whether the repository is a single master, or one of a
314 network of peer repositories, is not something VC has to care about.
315
316 @node Types of Log File
317 @subsubsection Types of Log File
318 @cindex types of log file
319 @cindex log File, types of
320 @cindex version control log
321
322 Projects that use a version control system can have two types of log
323 for changes. One is the log maintained by the version control system:
324 each time you commit a change, you fill out a @dfn{log entry} for the
325 change (@pxref{Log Buffer}). This is called the @dfn{version control
326 log}.
327
328 The other kind of log is the file @file{ChangeLog} (@pxref{Change
329 Log}). It provides a chronological record of all changes to a large
330 portion of a program---typically one directory and its subdirectories.
331 A small program would use one @file{ChangeLog} file; a large program
332 may have a @file{ChangeLog} file in each major directory.
333 @xref{Change Log}. Programmers have used change logs since long
334 before version control systems.
335
336 Changeset-based version systems typically maintain a changeset-based
337 modification log for the entire system, which makes change log files
338 somewhat redundant. One advantage that they retain is that it is
339 sometimes useful to be able to view the transaction history of a
340 single directory separately from those of other directories.
341
342 A project maintained with version control can use just the version
343 control log, or it can use both kinds of logs. It can handle some
344 files one way and some files the other way. Each project has its
345 policy, which you should follow.
346
347 When the policy is to use both, you typically want to write an entry
348 for each change just once, then put it into both logs. You can write
349 the entry in @file{ChangeLog}, then copy it to the log buffer with
350 @kbd{C-c C-a} when checking in the change (@pxref{Log Buffer}). Or
351 you can write the entry in the log buffer while checking in the
352 change, and later use the @kbd{C-x v a} command to copy it to
353 @file{ChangeLog}
354 @iftex
355 (@pxref{Change Logs and VC,,,emacs-xtra, Specialized Emacs Features}).
356 @end iftex
357 @ifnottex
358 (@pxref{Change Logs and VC}).
359 @end ifnottex
360
361 @node VC Mode Line
362 @subsection Version Control and the Mode Line
363
364 When you visit a file that is under version control, Emacs indicates
365 this on the mode line. For example, @samp{Bzr-1223} says that Bazaar
366 is used for that file, and the current revision ID is 1223.
367
368 The character between the back-end name and the revision ID
369 indicates the status of the work file. In a merge-based version
370 control system, a @samp{-} character indicates that the work file is
371 unmodified, and @samp{:} indicates that it has been modified. In a
372 lock-based system, @samp{-} indicates an unlocked file, and @samp{:} a
373 locked file; if the file is locked by another user (for instance,
374 @samp{jim}), that is displayed as @samp{RCS:jim:1.3}.
375
376 On a graphical display, you can move the mouse over this mode line
377 indicator to pop up a ``tool-tip'', which displays a more verbose
378 description of the version control status. Pressing @kbd{Mouse-1}
379 over the indicator pops up a menu of VC commands, identical to
380 @samp{Tools / Version Control} on the menu bar.
381
382 @vindex auto-revert-check-vc-info
383 When Auto Revert mode (@pxref{Reverting}) reverts a buffer that is
384 under version control, it updates the version control information in
385 the mode line. However, Auto Revert mode may not properly update this
386 information if the version control status changes without changes to
387 the work file, from outside the current Emacs session. If you set
388 @code{auto-revert-check-vc-info} to @code{t}, Auto Revert mode updates
389 the version control status information every
390 @code{auto-revert-interval} seconds, even if the work file itself is
391 unchanged. The resulting CPU usage depends on the version control
392 system, but is usually not excessive.
393
394 @node Basic VC Editing
395 @subsection Basic Editing under Version Control
396
397 @cindex filesets, VC
398 Most VC commands operate on @dfn{VC filesets}. A VC fileset is a
399 collection of one or more files that a VC operation acts on. When you
400 type VC commands in a buffer visiting a version-controlled file, the
401 VC fileset is simply that one file. When you type them in a VC
402 Directory buffer, and some files in it are marked, the VC fileset
403 consists of the marked files (@pxref{VC Directory Mode}).
404
405 The principal VC command is an all-purpose command, @kbd{C-x v v}
406 (@code{vc-next-action}), that performs either registration, locking,
407 merging or a check-in (depending on the situation) on the current VC
408 fileset. You can use @kbd{C-x v v} in a file-visiting buffer or in a
409 VC Directory buffer.
410
411 @table @kbd
412 @itemx C-x v v
413 Perform the appropriate next version control operation on the VC fileset.
414 @end table
415
416 @findex vc-next-action
417 @kindex C-x v v
418 The precise action of @kbd{C-x v v} depends on the state of the VC
419 fileset, and whether the version control system uses locking or
420 merging. This is described in detail in the subsequent sections.
421
422 VC filesets are the way that VC mode bridges the gap between
423 file-based and changeset-based version control systems. They are,
424 essentially, a way to pass multiple file arguments as a group to
425 version control commands. For example, on Subversion, a checkin with
426 a multi-file VC fileset becomes a joint commit, as though you had
427 typed @command{svn commit} with those file arguments at the shell
428 command line. All files in a VC fileset must be under the same
429 version control system; if they are not, Emacs signals an error when
430 you attempt to execute a command on the fileset.
431
432 VC filesets are distinct from the ``named filesets'' used for
433 viewing and visiting files in functional groups (@pxref{Filesets}).
434 Unlike named filesets, VC filesets are not named and don't persist
435 across sessions.
436
437 @menu
438 * VC With A Merging VCS:: Without locking: default mode for CVS.
439 * VC With A Locking VCS:: RCS in its default mode, SCCS, and optionally CVS.
440 * Advanced C-x v v:: Advanced features available with a prefix argument.
441 @end menu
442
443 @node VC With A Merging VCS
444 @subsubsection Basic Version Control with Merging
445
446 When your version control system is merging-based (the default for
447 CVS and all newer version control systems), work files are always
448 writable; you need not do anything special to begin editing a file.
449 The status indicator on the mode line is @samp{-} if the file is
450 unmodified; it flips to @samp{:} as soon as you save any changes
451 (@pxref{VC Mode Line}).
452
453 Here is what @kbd{C-x v v} does when using a merging-based system:
454
455 @itemize @bullet
456 @item
457 If the work file is in a directory that is not controlled by any
458 version control system, prompt for a repository type. Then, create a
459 version control repository of that type and register the file with it.
460
461 @item
462 If the work file is in a directory that is controlled by a version
463 control system but not registered with it, register the file.
464
465 @item
466 If the work file is the same as in the repository, do nothing.
467
468 @item
469 If you have not changed the work file, but some other user has checked
470 in changes to the repository, merge those changes into the work file.
471
472 @item
473 If you have made modifications to the work file, attempt to commit
474 the changes. To do this, Emacs first reads the log entry for the new
475 revision (@pxref{Log Buffer}). If some other user has committed
476 changes to the repository since you last checked it out, the checkin
477 fails. In that case, type @kbd{C-x v v} again to merge those changes
478 into your own work file; this puts the work file into a ``conflicted''
479 state. Type @kbd{C-x v v} to clear the ``conflicted'' state; VC then
480 regards the file as up-to-date and modified, and you can try to check
481 it in again.
482
483 To pick up any recent changes from the repository @emph{without}
484 trying to commit your own changes, type @kbd{C-x v m @key{RET}}.
485 @xref{Merging}.
486 @end itemize
487
488 These rules also apply when you use RCS in its ``non-locking'' mode,
489 except that changes are not automatically merged from the repository.
490 Nothing informs you if another user has committed changes in the same
491 file since you began editing it; when you commit your revision, his
492 changes are removed (however, they remain in the repository and are
493 thus not irrevocably lost). Therefore, you must verify that the
494 current revision is unchanged before checking in your changes. In
495 addition, locking is possible with RCS even in this mode: @kbd{C-x v
496 v} with an unmodified file locks the file, just as it does with RCS in
497 its normal locking mode (@pxref{VC With A Locking VCS}).
498
499 @node VC With A Locking VCS
500 @subsubsection Basic Version Control with Locking
501
502 Under a locking-based version control system (such as SCCS, and RCS
503 in its default mode), @kbd{C-x v v} does the following:
504
505 @itemize @bullet
506 @item
507 If the file is not locked, lock it and make it writable, so that you
508 can change it.
509
510 @item
511 If the file is locked by you, and contains changes, commit the
512 changes. In order to do this, Emacs first reads the log entry for the
513 new revision. @xref{Log Buffer}.
514
515 @item
516 If the file is locked by you, but you have not changed it since you
517 locked it, release the lock and makes the file read-only again.
518
519 @item
520 If the file is locked by some other user, ask whether you want to
521 ``steal the lock'' from that user. If you say yes, the file becomes
522 locked by you, but a message is sent to the person who had formerly
523 locked the file, to inform him of what has happened.
524 @end itemize
525
526 These rules also apply when you use CVS in locking mode, except
527 that CVS does not support stealing a lock.
528
529 @node Advanced C-x v v
530 @subsubsection Advanced Control in @kbd{C-x v v}
531
532 @cindex revision ID in version control
533 When you give a prefix argument to @code{vc-next-action} (@kbd{C-u
534 C-x v v}), it still performs the next logical version control
535 operation, but accepts additional arguments to specify precisely how
536 to do the operation.
537
538 @itemize @bullet
539 @item
540 If the file is modified (or locked), you can specify the revision ID
541 to use for the new version that you commit. This is one way to create
542 a new branch (@pxref{Branches}).
543
544 @item
545 If the file is not modified (and unlocked), you can specify the
546 revision to select; this lets you start working from an older
547 revision, or on another branch. If you do not enter any revision,
548 that takes you to the highest (``head'') revision on the current
549 branch; therefore @kbd{C-u C-x v v @key{RET}} is a convenient way to
550 get the latest version of a file from the repository.
551
552 @item
553 @cindex specific version control system
554 Instead of the revision ID, you can also specify the name of a
555 version control system. This is useful when one file is being managed
556 with two version control systems at the same time
557 @iftex
558 (@pxref{Local Version Control,,,emacs-xtra, Specialized Emacs
559 Features}).
560 @end iftex
561 @ifnottex
562 (@pxref{Local Version Control}).
563 @end ifnottex
564
565 @end itemize
566
567 @node Log Buffer
568 @subsection Features of the Log Entry Buffer
569
570 When you tell VC to commit a change, it pops up a buffer called
571 @samp{*VC-Log*}. In this buffer, you should write a @dfn{log entry}
572 describing the changes you have made (@pxref{Why Version Control?}).
573 After you are done, type @kbd{C-c C-c}; this exits the buffer and
574 commits the change, together with your log entry.
575
576 While in the @samp{*VC-Log*} buffer, you can write one or more
577 @dfn{header lines}, specifying additional information to be supplied
578 to the version control system. Each header line must occupy a single
579 line at the top of the buffer; the first line that is not a header
580 line is treated as the start of the log entry. For example, the
581 following header line states that the present change was not written
582 by you, but by another developer:
583
584 @smallexample
585 Author: J. R. Hacker <jrh@@example.com>
586 @end smallexample
587
588 @noindent
589 Apart from the @samp{Author} header, Emacs recognizes the headers
590 @samp{Date} (a manually-specified commit time) and @samp{Fixes} (a
591 reference to a bug fixed by the change). Not all version control
592 systems recognize all headers: Bazaar recognizes all three headers,
593 while git, Mercurial, and Monotone recognizes only @samp{Author} and
594 @samp{Summary}. If you specify a header for a version control that
595 does not support it, the header is treated as part of the log entry.
596
597 @findex log-edit-show-files
598 @findex log-edit-show-diff
599 Type @kbd{C-c C-f} (@code{log-edit-show-files}) to display a list of
600 files in the current VC fileset. If you called @kbd{C-x v v} directly
601 from a work file, the fileset consists of that single file; if you
602 called @kbd{C-x v v} from a VC directory buffer (@pxref{VC Directory
603 Mode}), the fileset may consist of multiple files.
604
605 @findex log-edit-insert-changelog
606 Type @kbd{C-c C-d} (@code{log-edit-show-diff}) to show a @dfn{diff}
607 of the changes you have made (i.e., the differences between the work
608 file and the repository revision from which you started editing).
609 @xref{Old Revisions}.
610
611 If the current VC fileset includes one or more @file{ChangeLog}
612 files (@pxref{Change Log}), type @kbd{C-c C-a}
613 (@code{log-edit-insert-changelog}) to pull the relevant entries into
614 the @samp{*VC-Log*} buffer. If the topmost item in each
615 @file{ChangeLog} was made under your user name on the current date,
616 this command searches that item for entries that match the file(s) to
617 be committed; if found, these entries are inserted.
618 @iftex
619 @xref{Change Logs and VC,,,emacs-xtra, Specialized Emacs Features},
620 @end iftex
621 @ifnottex
622 @xref{Change Logs and VC},
623 @end ifnottex
624 for the opposite way of working---generating ChangeLog entries from
625 the revision control log.
626
627 To abort a check-in, just @strong{don't} type @kbd{C-c C-c} in that
628 buffer. You can switch buffers and do other editing. As long as you
629 don't try to commit another file, the entry you were editing remains
630 in the @samp{*VC-Log*} buffer, and you can go back to that buffer at
631 any time to complete the check-in.
632
633 If you change several source files for the same reason, it is often
634 convenient to specify the same log entry for many of the files. (This
635 is the normal way to do things on a changeset-oriented system, where
636 comments are attached to changesets rather than the history of
637 individual files.) The most convenient way to do this is to mark all
638 the files in VC Directory Mode and commit from there; the log buffer
639 will carry the fileset information with it and do a group commit when
640 you type @kbd{C-c C-c}.
641
642 You can also browse the history of previous log entries to duplicate
643 a checkin comment. This can be useful when you want several files to
644 have checkin comments that vary only slightly from each other. The
645 commands @kbd{M-n}, @kbd{M-p}, @kbd{M-s} and @kbd{M-r} for doing this
646 work just like the minibuffer history commands (except that these
647 versions are used outside the minibuffer).
648
649 @vindex vc-log-mode-hook
650 Each time you commit a change, the log entry buffer is put into VC
651 Log Edit mode, which involves running two hooks: @code{text-mode-hook}
652 and @code{vc-log-mode-hook}. @xref{Hooks}.
653
654 @node Old Revisions
655 @subsection Examining And Comparing Old Revisions
656
657 One of the convenient features of version control is the ability
658 to examine any revision of a file, or compare two revisions.
659
660 @table @kbd
661 @item C-x v ~
662 Prompt for a revision of the current file, and visit it in a buffer of
663 its own (@code{vc-revision-other-window}).
664
665 @item C-x v =
666 Compare the files in the current fileset with the working revision(s)
667 you started from (@code{vc-diff}). With a prefix argument, prompt for
668 two revisions of the current fileset and compare them. You can call
669 this command from a Dired buffer (@pxref{Dired}).
670
671 @item C-x v D
672 Compare the entire tree corresponding to the current fileset with the
673 tree you started from (@code{vc-root-diff}). With a prefix argument,
674 prompt for two revisions and compare their trees.
675
676 @item C-x v g
677 Display an annotated version of the file: for each line, show the
678 latest revision in which it was modified (@code{vc-annotate}).
679 @end table
680
681 @findex vc-revision-other-window
682 @kindex C-x v ~
683 To examine an old revision, visit the work file and type @kbd{C-x v
684 ~ @var{revision} @key{RET}} (@code{vc-revision-other-window}). Here,
685 @var{revision} is either the desired revision ID (@pxref{VCS
686 Concepts}), or the name of a tag or branch
687 @iftex
688 (@pxref{Tags,,,emacs-xtra, Specialized Emacs Features}).
689 @end iftex
690 @ifnottex
691 (@pxref{Tags}).
692 @end ifnottex
693 This command puts the text of the old revision in a file named
694 @file{@var{filename}.~@var{revision}~}, and visits it in its own
695 buffer in a separate window.
696
697 @findex vc-diff
698 @kindex C-x v =
699 @kbd{C-x v =} (@code{vc-diff}) compares each file in the current VC
700 fileset (saving them if necessary) with the repository revision(s)
701 from which you started editing. Note that the latter may or may not
702 be the latest revision of the file(s).
703
704 The diff is displayed in another window, in a Diff mode buffer
705 (@pxref{Diff Mode}) named @file{*vc-diff*}. In this buffer, the
706 @kbd{g} (@code{revert-buffer}) command performs the file comparison
707 again, generating a new diff.
708
709 @findex vc-diff
710 @kindex C-u C-x v =
711 To compare two arbitrary revisions of the current VC fileset, call
712 @code{vc-diff} with a prefix argument: @kbd{C-u C-x v =}. This
713 prompts for two revision IDs, using the minibuffer, and displays the
714 diff in a special buffer in another window. Instead of providing a
715 revision ID, you can give an empty input, which specifies the current
716 contents of the work file; or a tag or branch name
717 @iftex
718 (@pxref{Tags,,,emacs-xtra, Specialized Emacs Features}).
719 @end iftex
720 @ifnottex
721 (@pxref{Tags}).
722 @end ifnottex
723 If your version control system is file-based (e.g. CVS) rather than
724 changeset-based (Subversion, GNU Arch, git, Mercurial), supplying a
725 revision ID for a multi-file fileset (as opposed to a symbolic tag
726 name) is unlikely to return diffs that are connected in any meaningful
727 way.
728
729 The command @kbd{C-x v D} (@code{vc-root-diff}) is similar to
730 @kbd{C-x v =}, but it compares the entire tree associated with the
731 current VC fileset with the tree you started with. This means all the
732 files controlled by the current version control repository, even those
733 that are not part of the current VC fileset.
734
735 If you invoke @kbd{C-x v =} or @kbd{C-u C-x v =} from a buffer that
736 is neither visiting a version-controlled file nor a VC directory
737 buffer, these commands generate a diff of all registered files in the
738 current directory and its subdirectories.
739
740 @vindex vc-diff-switches
741 @vindex vc-rcs-diff-switches
742 @kbd{C-x v =} works by running a variant of the @code{diff} utility
743 designed to work with the version control system in use. The options
744 to pass to the @code{diff} command are taken from the first non-@code{nil}
745 value of @code{vc-@var{backend}-diff-switches}, @code{vc-diff-switches},
746 and @code{diff-switches} (@pxref{Comparing Files}), in that order.
747 Since @code{nil} means to check the next variable in the sequence,
748 either of the first two may use the value @code{t} to mean no switches at all.
749 Most of the @samp{vc@dots{}diff-switches} variables default to
750 @code{nil}, but some default to @code{t}. These are for those version
751 control systems (e.g. SVN) whose @code{diff} implementations do not
752 accept common options (e.g. @samp{-c}) likely to be in
753 @code{diff-switches}.
754
755 The buffer produced by @kbd{C-x v =} supports the commands of
756 Compilation mode (@pxref{Compilation Mode}), such as @kbd{C-x `} and
757 @kbd{C-c C-c}, in both the ``old'' and ``new'' text, and they always
758 find the corresponding locations in the current work file. (Older
759 revisions are not, in general, present as files on your disk.)
760
761 @findex vc-annotate
762 @kindex C-x v g
763 For some back ends, you can display the file @dfn{annotated} with
764 per-line revision information, by typing @kbd{C-x v g}
765 (@code{vc-annotate}). This creates a new buffer (the ``annotate
766 buffer'') displaying the file's text, with each part colored to show
767 how old it is. Text colored red is new, blue means old, and
768 intermediate colors indicate intermediate ages. By default, the color
769 is scaled over the full range of ages, such that the oldest changes
770 are blue, and the newest changes are red.
771
772 When you give a prefix argument to this command, Emacs reads two
773 arguments using the minibuffer: the ID of which revision to display and
774 annotate (instead of the current file contents), and the time span in
775 days the color range should cover.
776
777 From the annotate buffer, these and other color scaling options are
778 available from the @samp{VC-Annotate} menu. In this buffer, you can
779 also use the following keys to browse the annotations of past revisions,
780 view diffs, or view log entries:
781
782 @table @kbd
783 @item p
784 Annotate the previous revision, that is to say, the revision before
785 the one currently annotated. A numeric prefix argument is a repeat
786 count, so @kbd{C-u 10 p} would take you back 10 revisions.
787
788 @item n
789 Annotate the next revision---the one after the revision currently
790 annotated. A numeric prefix argument is a repeat count.
791
792 @item j
793 Annotate the revision indicated by the current line.
794
795 @item a
796 Annotate the revision before the one indicated by the current line.
797 This is useful to see the state the file was in before the change on
798 the current line was made.
799
800 @item f
801 Show in a buffer the file revision indicated by the current line.
802
803 @item d
804 Display the diff between the current line's revision and the previous
805 revision. This is useful to see what the current line's revision
806 actually changed in the file.
807
808 @item D
809 Display the diff between the current line's revision and the previous
810 revision for all files in the changeset (for VC systems that support
811 changesets). This is useful to see what the current line's revision
812 actually changed in the tree.
813
814 @item l
815 Show the log of the current line's revision. This is useful to see
816 the author's description of the changes in the revision on the current
817 line.
818
819 @item w
820 Annotate the working revision--the one you are editing. If you used
821 @kbd{p} and @kbd{n} to browse to other revisions, use this key to
822 return to your working revision.
823
824 @item v
825 Toggle the annotation visibility. This is useful for looking just at
826 the file contents without distraction from the annotations.
827 @end table
828
829 @node Secondary VC Commands
830 @subsection The Secondary Commands of VC
831
832 This section explains the secondary commands of VC.
833
834 @menu
835 * Registering:: Putting a file under version control.
836 * VC Change Log:: Viewing the VC Change Log.
837 * VC Undo:: Canceling changes before or after check-in.
838 @end menu
839
840 @node Registering
841 @subsubsection Registering a File for Version Control
842
843 @kindex C-x v i
844 @findex vc-register
845 You can put any file under version control by simply visiting it, and
846 then typing @w{@kbd{C-x v i}} (@code{vc-register}).
847
848 @table @kbd
849 @item C-x v i
850 Register the visited file for version control.
851 @end table
852
853 To register the file, Emacs must choose which version control system
854 to use for it. If the file's directory already contains files
855 registered in a version control system, Emacs uses that system. If
856 there is more than one system in use for a directory, Emacs uses the
857 one that appears first in @code{vc-handled-backends}
858 @iftex
859 (@pxref{Customizing VC,,,emacs-xtra, Specialized Emacs Features}).
860 @end iftex
861 @ifnottex
862 (@pxref{Customizing VC}).
863 @end ifnottex
864 On the other hand, if there are no files already registered, Emacs uses
865 the first system from @code{vc-handled-backends} that could register
866 the file (for example, you cannot register a file under CVS if its
867 directory is not already part of a CVS tree); with the default value
868 of @code{vc-handled-backends}, this means that Emacs uses RCS in this
869 situation.
870
871 If locking is in use, @kbd{C-x v i} leaves the file unlocked and
872 read-only. Type @kbd{C-x v v} if you wish to start editing it. After
873 registering a file with CVS, you must subsequently commit the initial
874 revision by typing @kbd{C-x v v}. Until you do that, the revision ID
875 appears as @samp{@@@@} in the mode line.
876
877 @vindex vc-default-init-revision
878 @cindex initial revision ID to register
879 The default initial revision ID for a newly registered file
880 varies by what VCS you are using; normally it will be 1.1 on VCSes
881 that use dot-pair revision IDs and 1 on VCSes that use monotonic IDs.
882 You can specify a different default by setting the variable
883 @code{vc-default-init-revision}, or you can give @kbd{C-x v i} a
884 numeric argument; then it reads the initial revision ID for this
885 particular file using the minibuffer.
886
887 @vindex vc-initial-comment
888 If @code{vc-initial-comment} is non-@code{nil}, @kbd{C-x v i} reads an
889 initial comment to describe the purpose of this source file. Reading
890 the initial comment works like reading a log entry (@pxref{Log Buffer}).
891
892 @node VC Change Log
893 @subsubsection VC Change Log
894
895 @table @kbd
896 @item C-x v l
897 Display revision control state and change history
898 (@code{vc-print-log}).
899
900 @item C-x v L
901 Display the change history for the current repository
902 (@code{vc-print-root-log}).
903
904 @item C-x v I
905 Display the changes that will be received with a pull operation
906 (@code{vc-log-incoming}).
907
908 @item C-x v O
909 Display the changes that will be sent by the next push operation
910 (@code{vc-log-outgoing}).
911 @end table
912
913 @kindex C-x v l
914 @findex vc-print-log
915 The command @kbd{C-x v l} (@code{vc-print-log}) displays a buffer
916 named @samp{*vc-change-log*} in a new window. This buffer lists the
917 changes to the current file, including the associated log entries.
918 (These are the log entries associated with the version control system,
919 i.e. the ones you enter via the @samp{*VC-Log*} buffer. @xref{Log
920 Buffer}.) Point is centered at the revision of the file currently
921 being visited. With a prefix argument, the command prompts for the
922 revision to center on, and the maximum number of revisions to display.
923 You can call this command from a Dired buffer (@pxref{Dired}).
924
925 @findex vc-print-root-log
926 Type @kbd{C-x v L} (@code{vc-print-root-log}) to display a
927 @samp{*vc-change-log*} buffer showing the history of the
928 version-controlled directory tree as a whole. With a prefix argument,
929 the command prompts for the maximum number of revisions to display.
930 RCS, SCCS, and CVS do not support this feature.
931
932 On a distributed version control system, the @kbd{C-x v I}
933 (@code{vc-log-incoming}) command displays a log buffer showing the
934 changes that will be applied, the next time you run the version
935 control system's ``pull'' command to get new revisions from another
936 repository. This other repository is the default one from which
937 changes are pulled, as defined by the version control system; with a
938 prefix argument, @code{vc-log-incoming} prompts for a specific
939 repository from which changes would be pulled, and lists the changes
940 accordingly. Similarly, @kbd{C-x v O} (@code{vc-log-outgoing}) shows
941 the changes that will be sent to another repository, the next time you
942 run the ``push'' command; with a prefix argument, it prompts for a
943 specific repository to which changes would be pushed.
944
945 In the @samp{*vc-change-log*} buffer, you can use the following keys
946 to move between the logs of revisions and of files, to view past
947 revisions, to modify change comments, to view annotations and to view
948 diffs:
949
950 @table @kbd
951 @item p
952 Move to the previous revision-item in the buffer. (Revision entries in the log
953 buffer are usually in reverse-chronological order, so the previous
954 revision-item usually corresponds to a newer revision.) A numeric
955 prefix argument is a repeat count.
956
957 @item n
958 Move to the next revision-item (which most often corresponds to the
959 previous revision of the file). A numeric prefix argument is a repeat
960 count.
961
962 @item P
963 Move to the log of the previous file, when the logs of multiple files
964 are in the log buffer (@pxref{VC Directory Mode}). Otherwise, just
965 move to the beginning of the log. A numeric prefix argument is a
966 repeat count, so @kbd{C-u 10 P} would move backward 10 files.
967
968 @item N
969 Move to the log of the next file, when the logs of multiple files are
970 in the log buffer (@pxref{VC Directory Mode}). It also takes a
971 numeric prefix argument as a repeat count.
972
973 @item a
974 Annotate the revision indicated by the current line.
975
976 @item e
977 Modify the change comment displayed at point. Note that not all VC
978 systems support modifying change comments.
979
980 @item f
981 Visit the revision indicated at the current line, like typing @kbd{C-x
982 v ~} and specifying this revision's ID (@pxref{Old Revisions}).
983
984 @item d
985 Display the diff (@pxref{Comparing Files}) between the revision
986 indicated at the current line and the next earlier revision. This is
987 useful to see what actually changed in the file when the revision
988 indicated on the current line was committed.
989
990 @item D
991 Display the changeset diff (@pxref{Comparing Files}) between the
992 revision indicated at the current line and the next earlier revision.
993 This is useful to see all the changes to all files that the revision
994 indicated on the current line did when it was committed.
995 @end table
996
997 @vindex vc-log-show-limit
998 Because fetching many log entries can be slow, the
999 @samp{*vc-change-log*} buffer displays no more than 2000 revisions by
1000 default. The variable @code{vc-log-show-limit} specifies this limit;
1001 if you set the value to zero, that removes the limit. You can also
1002 increase the number of revisions shown in an existing
1003 @samp{*vc-change-log*} buffer by clicking on the @samp{Show 2X
1004 entries} or @samp{Show unlimited entries} buttons at the end of the
1005 buffer. However, RCS, SCCS, and CVS do not support this feature.
1006
1007 @node VC Undo
1008 @subsubsection Undoing Version Control Actions
1009
1010 @table @kbd
1011 @item C-x v u
1012 Revert the buffer and the file to the working revision from which you started
1013 editing the file.
1014
1015 @item C-x v c
1016 Remove the last-entered change from the master for the visited file.
1017 This undoes your last check-in.
1018 @end table
1019
1020 @kindex C-x v u
1021 @findex vc-revert-buffer
1022 If you want to discard your current set of changes and revert to the
1023 working revision from which you started editing the file, use @kbd{C-x
1024 v u} (@code{vc-revert-buffer}). If the version control system is
1025 locking-based, this leaves the file unlocked, and you must lock it
1026 again before making new changes. @kbd{C-x v u} requires confirmation,
1027 unless it sees that you haven't made any changes with respect to the
1028 master copy of the working revision.
1029
1030 @kbd{C-x v u} is also the command to unlock a file if you lock it and
1031 then decide not to change it.
1032
1033 @kindex C-x v c
1034 @findex vc-rollback
1035 To cancel a change that you already committed, use @kbd{C-x v c}
1036 (@code{vc-rollback}). This command discards all record of the most
1037 recent checked-in revision, but only if your work file corresponds to
1038 that revision---you cannot use @kbd{C-x v c} to cancel a revision that
1039 is not the latest on its branch. Note that many version control
1040 systems do not support rollback at all; this command is something of a
1041 historical relic.
1042
1043 @node VC Directory Mode
1044 @subsection VC Directory Mode
1045
1046 @kindex C-x v d
1047 @findex vc-dir
1048 When you are working on a large program, it is often useful to find
1049 out which files have changed within an entire directory tree, or to
1050 view the status of all files under version control at once, and to
1051 perform version control operations on collections of files. You can
1052 use the command @kbd{C-x v d} (@code{vc-dir}) to make a directory
1053 listing that includes only files relevant for version control. This
1054 creates a @dfn{VC Directory buffer} and displays it in a separate
1055 window.
1056
1057 @cindex PCL-CVS
1058 @pindex cvs
1059 @cindex CVS directory mode
1060 The VC Directory buffer works with all the version control systems
1061 that VC supports. For CVS, Emacs also offers a more powerful facility
1062 called PCL-CVS. @xref{Top, , About PCL-CVS, pcl-cvs, PCL-CVS --- The
1063 Emacs Front-End to CVS}.
1064
1065 @menu
1066 * Buffer: VC Directory Buffer. What the buffer looks like and means.
1067 * Commands: VC Directory Commands. Commands to use in a VC directory buffer.
1068 @end menu
1069
1070 @node VC Directory Buffer
1071 @subsubsection The VC Directory Buffer
1072
1073 The VC Directory buffer contains a list of version-controlled files
1074 in the current directory and its subdirectories. Files which are
1075 up-to-date (have no local differences from the repository copy) are
1076 usually hidden; if all files in a subdirectory are up-to-date, the
1077 subdirectory is hidden as well. There is an exception to this rule:
1078 if VC mode detects that a file has changed to an up-to-date state
1079 since you last looked at it, that file and its state are shown.
1080
1081 If a directory uses more that one version control system, you can
1082 select which system to use for the @code{vc-dir} command by invoking
1083 @code{vc-dir} with a prefix argument: @kbd{C-u C-x v d}.
1084
1085 The line for an individual file shows the version control state of
1086 the file. Under RCS and SCCS, the name of the user locking the file
1087 is shown; under CVS, an abbreviated version of the @samp{cvs status}
1088 output is used. Here is an example using CVS:
1089
1090 @smallexample
1091 @group
1092 ./
1093 modified file1.c
1094 needs-update file2.c
1095 needs-merge file3.c
1096 @end group
1097 @end smallexample
1098
1099 @noindent
1100 In this example, @samp{file1.c} is modified with respect to the
1101 repository, and @samp{file2.c} is not. @samp{file3.c} is modified,
1102 but other changes have also been committed---you need to merge them
1103 with the work file before you can check it in.
1104
1105 @vindex vc-stay-local
1106 @vindex vc-cvs-stay-local
1107 In the above, if the repository were on a remote machine, VC only
1108 contacts it when the variable @code{vc-stay-local} (or
1109 @code{vc-cvs-stay-local}) is @code{nil}
1110 @iftex
1111 (@pxref{CVS Options,,,emacs-xtra, Specialized Emacs Features}).
1112 @end iftex
1113 @ifnottex
1114 (@pxref{CVS Options}).
1115 @end ifnottex
1116 This is because access to the repository may be slow, or you may be
1117 working offline and not have access to the repository at all. As a
1118 consequence, VC would not be able to tell you that @samp{file3.c} is
1119 in the ``merge'' state; you would learn that only when you try to
1120 check-in your modified copy of the file, or use a command such as
1121 @kbd{C-x v m}.
1122
1123 In practice, this is not a problem because CVS handles this case
1124 consistently whenever it arises. In VC, you'll simply get prompted to
1125 merge the remote changes into your work file first. The benefits of
1126 less network communication usually outweigh the disadvantage of not
1127 seeing remote changes immediately.
1128
1129 @vindex vc-directory-exclusion-list
1130 When a VC directory displays subdirectories it omits some that
1131 should never contain any files under version control. By default,
1132 this includes Version Control subdirectories such as @samp{RCS} and
1133 @samp{CVS}; you can customize this by setting the variable
1134 @code{vc-directory-exclusion-list}.
1135
1136 @node VC Directory Commands
1137 @subsubsection VC Directory Commands
1138
1139 VC Directory mode has a full set of navigation and marking commands
1140 for picking out filesets. Some of these are also available in a
1141 context menu invoked by @kbd{mouse-2}.
1142
1143 Up- and down-arrow keys move in the buffer; @kbd{n} and @kbd{p} also
1144 move vertically as in other list-browsing modes. @key{SPC} and
1145 @key{TAB} behave like down-arrow, and @key{BackTab} behaves like
1146 up-arrow.
1147
1148 Both @kbd{C-m} and @kbd{f} visit the file on the current
1149 line. @kbd{o} visits that file in another window. @kbd{q} dismisses
1150 the directory buffer.
1151
1152 @kbd{x} hides up-to-date files.
1153
1154 @kbd{m} marks the file or directory on the current line. If the
1155 region is active, @kbd{m} marks all the files in the region. There
1156 are some restrictions when marking: a file cannot be marked if any of
1157 its parent directories are marked, and a directory cannot be marked if
1158 any files in it or in its child directories are marked.
1159
1160 @kbd{M} marks all the files with the same VC state as the current
1161 file if the cursor is on a file. If the cursor is on a directory, it
1162 marks all child files. With a prefix argument: marks all files and
1163 directories.
1164
1165 @kbd{u} unmarks the file or directory on the current line. If the
1166 region is active, it unmarks all the files in the region.
1167
1168 @kbd{U} marks all the files with the same VC state as the current file
1169 if the cursor is on a file. If the cursor is on a directory, it
1170 unmarks all child files. With a prefix argument: unmarks all marked
1171 files and directories.
1172
1173 It is possible to do search, search and replace, incremental search,
1174 and incremental regexp search on multiple files. These commands will
1175 work on all the marked files or the current file if nothing is marked.
1176 If a directory is marked, the files in that directory shown in the VC
1177 directory buffer will be used.
1178
1179 @kbd{S} searches the marked files.
1180
1181 @kbd{Q} does a query replace on the marked files.
1182
1183 @kbd{M-s a C-s} does an incremental search on the marked files.
1184
1185 @kbd{M-s a C-M-s} does an incremental regular expression search
1186 on the marked files.
1187
1188 @cindex stashes in version control
1189 @cindex shelves in version control
1190 Commands are also accessible from the VC-dir menu. Note that some
1191 VC backends use the VC-dir menu to make available extra,
1192 backend-specific, commands. For example, Git and Bazaar allow you to
1193 manipulate @dfn{stashes} and @dfn{shelves}. (These provide a
1194 mechanism to temporarily store uncommitted changes somewhere out of
1195 the way, and bring them back at a later time.)
1196
1197 Normal VC commands with the @kbd{C-x v} prefix work in VC directory
1198 buffers. Some single-key shortcuts are available as well; @kbd{=},
1199 @kbd{+}, @kbd{l}, @kbd{i}, and @kbd{v} behave as through prefixed with
1200 @kbd{C-x v}.
1201
1202 The command @kbd{C-x v v} (@code{vc-next-action}) operates on all
1203 the marked files, so that you can commit several files at once. If
1204 the underlying VC supports atomic commits of multiple-file changesets,
1205 @kbd{C-x v v} with a selected set of modified but not committed files
1206 will commit all of them at once as a single changeset.
1207
1208 When @kbd{C-x v v} (@code{vc-next-action}) operates on multiple
1209 files, all of those files must be either in the same state or in
1210 compatible states (added, modified and removed states are considered
1211 compatible). Otherwise it signals an error. This differs from the
1212 behavior of older versions of VC, which did not have fileset
1213 operations and simply did @code{vc-next-action} on each file
1214 individually.
1215
1216 If any files are in a state that calls for commit, @kbd{C-x v v} reads a
1217 single log entry and uses it for the changeset as a whole. If the
1218 underling VCS is file- rather than changeset-oriented, the log entry
1219 will be replicated into the history of each file.
1220
1221 @node Branches
1222 @subsection Multiple Branches of a File
1223 @cindex branch (version control)
1224 @cindex trunk (version control)
1225
1226 One use of version control is to maintain multiple ``current''
1227 revisions of a file. For example, you might have different revisions of a
1228 program in which you are gradually adding various unfinished new
1229 features. Each such independent line of development is called a
1230 @dfn{branch}. VC allows you to create branches, switch between
1231 different branches, and merge changes from one branch to another.
1232 Please note, however, that branches are not supported for SCCS.
1233
1234 A file's main line of development is usually called the @dfn{trunk}.
1235 You can create multiple branches from the trunk. How the difference
1236 between trunk and branch is made visible is dependent on whether the
1237 VCS uses dot-pair or monotonic version IDs.
1238
1239 In VCSes with dot-pair revision IDs, the revisions on the trunk are
1240 normally IDed 1.1, 1.2, 1.3, etc. At any such revision, you can
1241 start an independent branch. A branch starting at revision 1.2 would
1242 have revision ID 1.2.1.1, and consecutive revisions on this branch
1243 would have IDs 1.2.1.2, 1.2.1.3, 1.2.1.4, and so on. If there is
1244 a second branch also starting at revision 1.2, it would consist of
1245 revisions 1.2.2.1, 1.2.2.2, 1.2.2.3, etc.
1246
1247 In VCSes with monotonic revision IDs, trunk revisions are IDed as
1248 1, 2, 3, etc. A branch from (say) revision 2 might start with 2.1 and
1249 continue through 2.2, 2.3, etc. But naming conventions for branches
1250 and subbranches vary widely on these systems, and some (like
1251 Mercurial) never depart from the monotonic integer sequence at all.
1252 Consult the documentation of the VCS you are using.
1253
1254 @cindex head revision
1255 If you omit the final component of a dot-pair revision ID, that is called a
1256 @dfn{branch ID}. It refers to the highest existing revision on that
1257 branch---the @dfn{head revision} of that branch. The branches in the
1258 dot-pair example above have branch IDs 1.2.1 and 1.2.2.
1259
1260 @menu
1261 * Switching Branches:: How to get to another existing branch.
1262 * Creating Branches:: How to start a new branch.
1263 * Merging:: Transferring changes between branches.
1264 * Multi-User Branching:: Multiple users working at multiple branches
1265 in parallel.
1266 @end menu
1267
1268 @node Switching Branches
1269 @subsubsection Switching between Branches
1270
1271 To switch between branches, type @kbd{C-u C-x v v} and specify the
1272 revision ID you want to select. On a locking-based system, this
1273 version is then visited @emph{unlocked} (write-protected), so you can
1274 examine it before locking it. Switching branches in this way is allowed
1275 only when the file is not locked.
1276
1277 On a VCS with dot-pair IDs, you can omit the minor part, thus giving
1278 only the branch ID; this takes you to the head version on the
1279 chosen branch. If you only type @key{RET}, Emacs goes to the highest
1280 version on the trunk.
1281
1282 After you have switched to any branch (including the main branch), you
1283 stay on it for subsequent VC commands, until you explicitly select some
1284 other branch.
1285
1286 @node Creating Branches
1287 @subsubsection Creating New Branches
1288
1289 To create a new branch from a head revision (one that is the latest
1290 in the branch that contains it), first select that revision if
1291 necessary, lock it with @kbd{C-x v v}, and make whatever changes you
1292 want. Then, when you commit the changes, use @kbd{C-u C-x v v}. This
1293 lets you specify the revision ID for the new revision. You should
1294 specify a suitable branch ID for a branch starting at the current
1295 revision. For example, if the current revision is 2.5, the branch ID
1296 should be 2.5.1, 2.5.2, and so on, depending on the number of existing
1297 branches at that point.
1298
1299 To create a new branch at an older revision (one that is no longer the
1300 head of a branch), first select that revision (@pxref{Switching
1301 Branches}). Your procedure will then differ depending on whether you
1302 are using a locking or merging-based VCS.
1303
1304 On a locking VCS, you will need to lock the old revision branch with
1305 @kbd{C-x v v}. You'll be asked to confirm, when you lock the old
1306 revision, that you really mean to create a new branch---if you say no,
1307 you'll be offered a chance to lock the latest revision instead. On
1308 a merging-based VCS you will skip this step.
1309
1310 Then make your changes and type @kbd{C-x v v} again to commit a new
1311 revision. This automatically creates a new branch starting from the
1312 selected revision. You need not specially request a new branch,
1313 because that's the only way to add a new revision at a point that is
1314 not the head of a branch.
1315
1316 After the branch is created, you ``stay'' on it. That means that
1317 subsequent check-ins create new revisions on that branch. To leave the
1318 branch, you must explicitly select a different revision with @kbd{C-u C-x
1319 v v}. To transfer changes from one branch to another, use the merge
1320 command, described in the next section.
1321
1322 @node Merging
1323 @subsubsection Merging Branches
1324
1325 @cindex merging changes
1326 When you have finished the changes on a certain branch, you will
1327 often want to incorporate them into the file's main line of development
1328 (the trunk). This is not a trivial operation, because development might
1329 also have proceeded on the trunk, so that you must @dfn{merge} the
1330 changes into a file that has already been changed otherwise. VC allows
1331 you to do this (and other things) with the @code{vc-merge} command.
1332
1333 @table @kbd
1334 @item C-x v m (vc-merge)
1335 Merge changes into the work file.
1336 @end table
1337
1338 @kindex C-x v m
1339 @findex vc-merge
1340 @kbd{C-x v m} (@code{vc-merge}) takes a set of changes and merges it
1341 into the current version of the work file. It firsts asks you in the
1342 minibuffer where the changes should come from. If you just type
1343 @key{RET}, Emacs merges any changes that were made on the same branch
1344 since you checked the file out (we call this @dfn{merging the news}).
1345 This is the common way to pick up recent changes from the repository,
1346 regardless of whether you have already changed the file yourself.
1347
1348 You can also enter a branch ID or a pair of revision IDs in
1349 the minibuffer. Then @kbd{C-x v m} finds the changes from that
1350 branch, or the differences between the two revisions you specified, and
1351 merges them into the current revision of the current file.
1352
1353 As an example, suppose that you have finished a certain feature on
1354 branch 1.3.1. In the meantime, development on the trunk has proceeded
1355 to revision 1.5. To merge the changes from the branch to the trunk,
1356 first go to the head revision of the trunk, by typing @kbd{C-u C-x v v
1357 @key{RET}}. Revision 1.5 is now current. If locking is used for the file,
1358 type @kbd{C-x v v} to lock revision 1.5 so that you can change it. Next,
1359 type @kbd{C-x v m 1.3.1 @key{RET}}. This takes the entire set of changes on
1360 branch 1.3.1 (relative to revision 1.3, where the branch started, up to
1361 the last revision on the branch) and merges it into the current revision
1362 of the work file. You can now commit the changed file, thus creating
1363 revision 1.6 containing the changes from the branch.
1364
1365 It is possible to do further editing after merging the branch, before
1366 the next check-in. But it is usually wiser to commit the merged
1367 revision, then lock it and make the further changes. This will keep
1368 a better record of the history of changes.
1369
1370 @cindex conflicts
1371 @cindex resolving conflicts
1372 When you merge changes into a file that has itself been modified, the
1373 changes might overlap. We call this situation a @dfn{conflict}, and
1374 reconciling the conflicting changes is called @dfn{resolving a
1375 conflict}.
1376
1377 Whenever conflicts occur during merging, VC detects them, tells you
1378 about them in the echo area, and asks whether you want help in merging.
1379 If you say yes, it starts an Ediff session (@pxref{Top,
1380 Ediff, Ediff, ediff, The Ediff Manual}).
1381
1382 If you say no, the conflicting changes are both inserted into the
1383 file, surrounded by @dfn{conflict markers}. The example below shows how
1384 a conflict region looks; the file is called @samp{name} and the current
1385 master file revision with user B's changes in it is 1.11.
1386
1387 @c @w here is so CVS won't think this is a conflict.
1388 @smallexample
1389 @group
1390 @w{<}<<<<<< name
1391 @var{User A's version}
1392 =======
1393 @var{User B's version}
1394 @w{>}>>>>>> 1.11
1395 @end group
1396 @end smallexample
1397
1398 @findex vc-resolve-conflicts
1399 Then you can resolve the conflicts by editing the file manually. Or
1400 you can type @code{M-x vc-resolve-conflicts} after visiting the file.
1401 This starts an Ediff session, as described above. Don't forget to
1402 commit the merged version afterwards.
1403
1404 @findex vc-find-conflicted-file
1405 If there is more than one conflicted file in a merge, type @kbd{M-x
1406 vc-find-conflicted-file} after resolving the conflicts in each file.
1407 This command visits the next conflicted file, and moves point to the
1408 first conflict marker in that file.
1409
1410 @node Multi-User Branching
1411 @subsubsection Multi-User Branching
1412
1413 It is often useful for multiple developers to work simultaneously on
1414 different branches of a file. CVS and later systems allow this by
1415 default; for RCS, it is possible if you create multiple source
1416 directories. Each source directory should have a link named
1417 @file{RCS} which points to a common directory of RCS master files.
1418 Then each source directory can have its own choice of selected
1419 revisions, but all share the same common RCS records.
1420
1421 This technique works reliably and automatically, provided that the
1422 source files contain RCS version headers
1423 @iftex
1424 (@pxref{Version Headers,,,emacs-xtra, Specialized Emacs Features}).
1425 @end iftex
1426 @ifnottex
1427 (@pxref{Version Headers}).
1428 @end ifnottex
1429 The headers enable Emacs to be sure, at all times, which revision
1430 ID is present in the work file.
1431
1432 If the files do not have version headers, you must instead tell Emacs
1433 explicitly in each session which branch you are working on. To do this,
1434 first find the file, then type @kbd{C-u C-x v v} and specify the correct
1435 branch ID. This ensures that Emacs knows which branch it is using
1436 during this particular editing session.
1437
1438 @ifnottex
1439 @include vc1-xtra.texi
1440 @end ifnottex
1441
1442 @node Change Log
1443 @section Change Logs
1444
1445 @cindex change log
1446 A change log file contains a chronological record of when and why you
1447 have changed a program, consisting of a sequence of entries describing
1448 individual changes. Normally it is kept in a file called
1449 @file{ChangeLog} in the same directory as the file you are editing, or
1450 one of its parent directories. A single @file{ChangeLog} file can
1451 record changes for all the files in its directory and all its
1452 subdirectories.
1453
1454 @menu
1455 * Change Log Commands:: Commands for editing change log files.
1456 * Format of ChangeLog:: What the change log file looks like.
1457 @end menu
1458
1459 @node Change Log Commands
1460 @subsection Change Log Commands
1461
1462 @kindex C-x 4 a
1463 @findex add-change-log-entry-other-window
1464 The Emacs command @kbd{C-x 4 a} adds a new entry to the change log
1465 file for the file you are editing
1466 (@code{add-change-log-entry-other-window}). If that file is actually
1467 a backup file, it makes an entry appropriate for the file's
1468 parent---that is useful for making log entries for functions that
1469 have been deleted in the current version.
1470
1471 @kbd{C-x 4 a} visits the change log file and creates a new entry
1472 unless the most recent entry is for today's date and your name. It
1473 also creates a new item for the current file. For many languages, it
1474 can even guess the name of the function or other object that was
1475 changed.
1476
1477 @vindex add-log-keep-changes-together
1478 When the variable @code{add-log-keep-changes-together} is
1479 non-@code{nil}, @kbd{C-x 4 a} adds to any existing item for the file
1480 rather than starting a new item.
1481
1482 @vindex add-log-always-start-new-record
1483 If @code{add-log-always-start-new-record} is non-@code{nil},
1484 @kbd{C-x 4 a} always makes a new entry, even if the last entry
1485 was made by you and on the same date.
1486
1487 @vindex change-log-version-info-enabled
1488 @vindex change-log-version-number-regexp-list
1489 @cindex file version in change log entries
1490 If the value of the variable @code{change-log-version-info-enabled}
1491 is non-@code{nil}, @kbd{C-x 4 a} adds the file's version number to the
1492 change log entry. It finds the version number by searching the first
1493 ten percent of the file, using regular expressions from the variable
1494 @code{change-log-version-number-regexp-list}.
1495
1496 @cindex Change Log mode
1497 @findex change-log-mode
1498 The change log file is visited in Change Log mode. In this major
1499 mode, each bunch of grouped items counts as one paragraph, and each
1500 entry is considered a page. This facilitates editing the entries.
1501 @kbd{C-j} and auto-fill indent each new line like the previous line;
1502 this is convenient for entering the contents of an entry.
1503
1504 You can use the @code{next-error} command (by default bound to
1505 @kbd{C-x `}) to move between entries in the Change Log, when Change
1506 Log mode is on. You will jump to the actual site in the file that was
1507 changed, not just to the next Change Log entry. You can also use
1508 @code{previous-error} to move back in the same list.
1509
1510 @findex change-log-merge
1511 You can use the command @kbd{M-x change-log-merge} to merge other
1512 log files into a buffer in Change Log Mode, preserving the date
1513 ordering of entries.
1514
1515 Version control systems are another way to keep track of changes in
1516 your program and keep a change log. In the VC log buffer, typing
1517 @kbd{C-c C-a} (@code{log-edit-insert-changelog}) inserts the relevant
1518 Change Log entry, if one exists (@pxref{Log Buffer}). You can also
1519 insert a VC log entry into a Change Log buffer by typing @kbd{C-x v a}
1520 (@code{vc-update-change-log}) in the Change Log buffer
1521 @iftex
1522 (@pxref{Change Logs and VC,,,emacs-xtra, Specialized Emacs Features}).
1523 @end iftex
1524 @ifnottex
1525 (@pxref{Change Logs and VC}).
1526 @end ifnottex
1527
1528 @node Format of ChangeLog
1529 @subsection Format of ChangeLog
1530
1531 A change log entry starts with a header line that contains the current
1532 date, your name, and your email address (taken from the variable
1533 @code{add-log-mailing-address}). Aside from these header lines, every
1534 line in the change log starts with a space or a tab. The bulk of the
1535 entry consists of @dfn{items}, each of which starts with a line starting
1536 with whitespace and a star. Here are two entries, both dated in May
1537 1993, with two items and one item respectively.
1538
1539 @iftex
1540 @medbreak
1541 @end iftex
1542 @smallexample
1543 1993-05-25 Richard Stallman <rms@@gnu.org>
1544
1545 * man.el: Rename symbols `man-*' to `Man-*'.
1546 (manual-entry): Make prompt string clearer.
1547
1548 * simple.el (blink-matching-paren-distance):
1549 Change default to 12,000.
1550
1551 1993-05-24 Richard Stallman <rms@@gnu.org>
1552
1553 * vc.el (minor-mode-map-alist): Don't use it if it's void.
1554 (vc-cancel-version): Doc fix.
1555 @end smallexample
1556
1557 One entry can describe several changes; each change should have its
1558 own item, or its own line in an item. Normally there should be a
1559 blank line between items. When items are related (parts of the same
1560 change, in different places), group them by leaving no blank line
1561 between them.
1562
1563 You should put a copyright notice and permission notice at the
1564 end of the change log file. Here is an example:
1565
1566 @smallexample
1567 Copyright 1997, 1998 Free Software Foundation, Inc.
1568 Copying and distribution of this file, with or without modification, are
1569 permitted provided the copyright notice and this notice are preserved.
1570 @end smallexample
1571
1572 @noindent
1573 Of course, you should substitute the proper years and copyright holder.
1574
1575 @node Tags
1576 @section Tags Tables
1577 @cindex tags and tag tables
1578
1579 A @dfn{tag} is a reference to a subunit in a program or in a
1580 document. In program source code, tags reference syntactic elements
1581 of the program: functions, subroutines, data types, macros, etc. In a
1582 document, tags reference chapters, sections, appendices, etc. Each
1583 tag specifies the name of the file where the corresponding subunit is
1584 defined, and the position of the subunit's definition in that file.
1585
1586 A @dfn{tags table} records the tags extracted by scanning the source
1587 code of a certain program or a certain document. Tags extracted from
1588 generated files reference the original files, rather than the
1589 generated files that were scanned during tag extraction. Examples of
1590 generated files include C files generated from Cweb source files, from
1591 a Yacc parser, or from Lex scanner definitions; @file{.i} preprocessed
1592 C files; and Fortran files produced by preprocessing @file{.fpp}
1593 source files.
1594
1595 To produce a tags table, you use the @samp{etags} command,
1596 submitting it a document or the source code of a program.
1597 @samp{etags} writes the tags to a @dfn{tags table file}, or @dfn{tags
1598 file} in short. The conventional name for a tags file is @file{TAGS}.
1599
1600 Emacs uses the information recorded in tags tables in commands that
1601 search or replace through multiple source files: these commands use
1602 the names of the source files recorded in the tags table to know which
1603 files to search. Other commands, such as @kbd{M-.}, which finds the
1604 definition of a function, use the recorded information about the
1605 function names and positions to find the source file and the position
1606 within that file where the function is defined.
1607
1608 @cindex C++ class browser, tags
1609 @cindex tags, C++
1610 @cindex class browser, C++
1611 @cindex Ebrowse
1612 See also the Ebrowse facility, which is tailored for C++.
1613 @xref{Top,, Ebrowse, ebrowse, Ebrowse User's Manual}.
1614
1615 @menu
1616 * Tag Syntax:: Tag syntax for various types of code and text files.
1617 * Create Tags Table:: Creating a tags table with @code{etags}.
1618 * Etags Regexps:: Create arbitrary tags using regular expressions.
1619 * Select Tags Table:: How to visit a tags table.
1620 * Find Tag:: Commands to find the definition of a specific tag.
1621 * Tags Search:: Using a tags table for searching and replacing.
1622 * List Tags:: Listing and finding tags defined in a file.
1623 @end menu
1624
1625 @node Tag Syntax
1626 @subsection Source File Tag Syntax
1627
1628 Here is how tag syntax is defined for the most popular languages:
1629
1630 @itemize @bullet
1631 @item
1632 In C code, any C function or typedef is a tag, and so are definitions of
1633 @code{struct}, @code{union} and @code{enum}.
1634 @code{#define} macro definitions, @code{#undef} and @code{enum}
1635 constants are also
1636 tags, unless you specify @samp{--no-defines} when making the tags table.
1637 Similarly, global variables are tags, unless you specify
1638 @samp{--no-globals}, and so are struct members, unless you specify
1639 @samp{--no-members}. Use of @samp{--no-globals}, @samp{--no-defines}
1640 and @samp{--no-members} can make the tags table file much smaller.
1641
1642 You can tag function declarations and external variables in addition
1643 to function definitions by giving the @samp{--declarations} option to
1644 @code{etags}.
1645
1646 @item
1647 In C++ code, in addition to all the tag constructs of C code, member
1648 functions are also recognized; member variables are also recognized,
1649 unless you use the @samp{--no-members} option. Tags for variables and
1650 functions in classes are named @samp{@var{class}::@var{variable}} and
1651 @samp{@var{class}::@var{function}}. @code{operator} definitions have
1652 tag names like @samp{operator+}.
1653
1654 @item
1655 In Java code, tags include all the constructs recognized in C++, plus
1656 the @code{interface}, @code{extends} and @code{implements} constructs.
1657 Tags for variables and functions in classes are named
1658 @samp{@var{class}.@var{variable}} and @samp{@var{class}.@var{function}}.
1659
1660 @item
1661 In La@TeX{} text, the argument of any of the commands @code{\chapter},
1662 @code{\section}, @code{\subsection}, @code{\subsubsection},
1663 @code{\eqno}, @code{\label}, @code{\ref}, @code{\cite},
1664 @code{\bibitem}, @code{\part}, @code{\appendix}, @code{\entry},
1665 @code{\index}, @code{\def}, @code{\newcommand}, @code{\renewcommand},
1666 @code{\newenvironment} or @code{\renewenvironment} is a tag.@refill
1667
1668 Other commands can make tags as well, if you specify them in the
1669 environment variable @env{TEXTAGS} before invoking @code{etags}. The
1670 value of this environment variable should be a colon-separated list of
1671 command names. For example,
1672
1673 @example
1674 TEXTAGS="mycommand:myothercommand"
1675 export TEXTAGS
1676 @end example
1677
1678 @noindent
1679 specifies (using Bourne shell syntax) that the commands
1680 @samp{\mycommand} and @samp{\myothercommand} also define tags.
1681
1682 @item
1683 In Lisp code, any function defined with @code{defun}, any variable
1684 defined with @code{defvar} or @code{defconst}, and in general the first
1685 argument of any expression that starts with @samp{(def} in column zero is
1686 a tag.
1687
1688 @item
1689 In Scheme code, tags include anything defined with @code{def} or with a
1690 construct whose name starts with @samp{def}. They also include variables
1691 set with @code{set!} at top level in the file.
1692 @end itemize
1693
1694 Several other languages are also supported:
1695
1696 @itemize @bullet
1697
1698 @item
1699 In Ada code, functions, procedures, packages, tasks and types are
1700 tags. Use the @samp{--packages-only} option to create tags for
1701 packages only.
1702
1703 In Ada, the same name can be used for different kinds of entity
1704 (e.g.@:, for a procedure and for a function). Also, for things like
1705 packages, procedures and functions, there is the spec (i.e.@: the
1706 interface) and the body (i.e.@: the implementation). To make it
1707 easier to pick the definition you want, Ada tag name have suffixes
1708 indicating the type of entity:
1709
1710 @table @samp
1711 @item /b
1712 package body.
1713 @item /f
1714 function.
1715 @item /k
1716 task.
1717 @item /p
1718 procedure.
1719 @item /s
1720 package spec.
1721 @item /t
1722 type.
1723 @end table
1724
1725 Thus, @kbd{M-x find-tag @key{RET} bidule/b @key{RET}} will go
1726 directly to the body of the package @code{bidule}, while @kbd{M-x
1727 find-tag @key{RET} bidule @key{RET}} will just search for any tag
1728 @code{bidule}.
1729
1730 @item
1731 In assembler code, labels appearing at the beginning of a line,
1732 followed by a colon, are tags.
1733
1734 @item
1735 In Bison or Yacc input files, each rule defines as a tag the nonterminal
1736 it constructs. The portions of the file that contain C code are parsed
1737 as C code.
1738
1739 @item
1740 In Cobol code, tags are paragraph names; that is, any word starting in
1741 column 8 and followed by a period.
1742
1743 @item
1744 In Erlang code, the tags are the functions, records and macros defined
1745 in the file.
1746
1747 @item
1748 In Fortran code, functions, subroutines and block data are tags.
1749
1750 @item
1751 In HTML input files, the tags are the @code{title} and the @code{h1},
1752 @code{h2}, @code{h3} headers. Also, tags are @code{name=} in anchors
1753 and all occurrences of @code{id=}.
1754
1755 @item
1756 In Lua input files, all functions are tags.
1757
1758 @item
1759 In makefiles, targets are tags; additionally, variables are tags
1760 unless you specify @samp{--no-globals}.
1761
1762 @item
1763 In Objective C code, tags include Objective C definitions for classes,
1764 class categories, methods and protocols. Tags for variables and
1765 functions in classes are named @samp{@var{class}::@var{variable}} and
1766 @samp{@var{class}::@var{function}}.
1767
1768 @item
1769 In Pascal code, the tags are the functions and procedures defined in
1770 the file.
1771
1772 @item
1773 In Perl code, the tags are the packages, subroutines and variables
1774 defined by the @code{package}, @code{sub}, @code{my} and @code{local}
1775 keywords. Use @samp{--globals} if you want to tag global variables.
1776 Tags for subroutines are named @samp{@var{package}::@var{sub}}. The
1777 name for subroutines defined in the default package is
1778 @samp{main::@var{sub}}.
1779
1780 @item
1781 In PHP code, tags are functions, classes and defines. Vars are tags
1782 too, unless you use the @samp{--no-members} option.
1783
1784 @item
1785 In PostScript code, the tags are the functions.
1786
1787 @item
1788 In Prolog code, tags are predicates and rules at the beginning of
1789 line.
1790
1791 @item
1792 In Python code, @code{def} or @code{class} at the beginning of a line
1793 generate a tag.
1794 @end itemize
1795
1796 You can also generate tags based on regexp matching (@pxref{Etags
1797 Regexps}) to handle other formats and languages.
1798
1799 @node Create Tags Table
1800 @subsection Creating Tags Tables
1801 @cindex @code{etags} program
1802
1803 The @code{etags} program is used to create a tags table file. It knows
1804 the syntax of several languages, as described in
1805 @iftex
1806 the previous section.
1807 @end iftex
1808 @ifnottex
1809 @ref{Tag Syntax}.
1810 @end ifnottex
1811 Here is how to run @code{etags}:
1812
1813 @example
1814 etags @var{inputfiles}@dots{}
1815 @end example
1816
1817 @noindent
1818 The @code{etags} program reads the specified files, and writes a tags
1819 table named @file{TAGS} in the current working directory. You can
1820 optionally specify a different file name for the tags table by using the
1821 @samp{--output=@var{file}} option; specifying @file{-} as a file name
1822 prints the tags table to standard output.
1823
1824 If the specified files don't exist, @code{etags} looks for
1825 compressed versions of them and uncompresses them to read them. Under
1826 MS-DOS, @code{etags} also looks for file names like @file{mycode.cgz}
1827 if it is given @samp{mycode.c} on the command line and @file{mycode.c}
1828 does not exist.
1829
1830 @code{etags} recognizes the language used in an input file based on
1831 its file name and contents. You can specify the language with the
1832 @samp{--language=@var{name}} option, described below.
1833
1834 If the tags table data become outdated due to changes in the files
1835 described in the table, the way to update the tags table is the same
1836 way it was made in the first place. If the tags table fails to record
1837 a tag, or records it for the wrong file, then Emacs cannot possibly
1838 find its definition until you update the tags table. However, if the
1839 position recorded in the tags table becomes a little bit wrong (due to
1840 other editing), the worst consequence is a slight delay in finding the
1841 tag. Even if the stored position is very far wrong, Emacs will still
1842 find the tag, after searching most of the file for it. That delay is
1843 hardly noticeable with today's computers.
1844
1845 Thus, there is no need to update the tags table after each edit.
1846 You should update a tags table when you define new tags that you want
1847 to have listed, or when you move tag definitions from one file to
1848 another, or when changes become substantial.
1849
1850 One tags table can virtually include another. Specify the included
1851 tags file name with the @samp{--include=@var{file}} option when
1852 creating the file that is to include it. The latter file then acts as
1853 if it covered all the source files specified in the included file, as
1854 well as the files it directly contains.
1855
1856 If you specify the source files with relative file names when you run
1857 @code{etags}, the tags file will contain file names relative to the
1858 directory where the tags file was initially written. This way, you can
1859 move an entire directory tree containing both the tags file and the
1860 source files, and the tags file will still refer correctly to the source
1861 files. If the tags file is @file{-} or is in the @file{/dev} directory,
1862 however, the file names are
1863 made relative to the current working directory. This is useful, for
1864 example, when writing the tags to @file{/dev/stdout}.
1865
1866 When using a relative file name, it should not be a symbolic link
1867 pointing to a tags file in a different directory, because this would
1868 generally render the file names invalid.
1869
1870 If you specify absolute file names as arguments to @code{etags}, then
1871 the tags file will contain absolute file names. This way, the tags file
1872 will still refer to the same files even if you move it, as long as the
1873 source files remain in the same place. Absolute file names start with
1874 @samp{/}, or with @samp{@var{device}:/} on MS-DOS and MS-Windows.
1875
1876 When you want to make a tags table from a great number of files, you
1877 may have problems listing them on the command line, because some systems
1878 have a limit on its length. The simplest way to circumvent this limit
1879 is to tell @code{etags} to read the file names from its standard input,
1880 by typing a dash in place of the file names, like this:
1881
1882 @smallexample
1883 find . -name "*.[chCH]" -print | etags -
1884 @end smallexample
1885
1886 Use the option @samp{--language=@var{name}} to specify the language
1887 explicitly. You can intermix these options with file names; each one
1888 applies to the file names that follow it. Specify
1889 @samp{--language=auto} to tell @code{etags} to resume guessing the
1890 language from the file names and file contents. Specify
1891 @samp{--language=none} to turn off language-specific processing
1892 entirely; then @code{etags} recognizes tags by regexp matching alone
1893 (@pxref{Etags Regexps}).
1894
1895 The option @samp{--parse-stdin=@var{file}} is mostly useful when
1896 calling @code{etags} from programs. It can be used (only once) in
1897 place of a file name on the command line. @code{Etags} will read from
1898 standard input and mark the produced tags as belonging to the file
1899 @var{file}.
1900
1901 @samp{etags --help} outputs the list of the languages @code{etags}
1902 knows, and the file name rules for guessing the language. It also prints
1903 a list of all the available @code{etags} options, together with a short
1904 explanation. If followed by one or more @samp{--language=@var{lang}}
1905 options, it outputs detailed information about how tags are generated for
1906 @var{lang}.
1907
1908 @node Etags Regexps
1909 @subsection Etags Regexps
1910
1911 The @samp{--regex} option provides a general way of recognizing tags
1912 based on regexp matching. You can freely intermix this option with
1913 file names, and each one applies to the source files that follow it.
1914 If you specify multiple @samp{--regex} options, all of them are used
1915 in parallel. The syntax is:
1916
1917 @smallexample
1918 --regex=[@var{@{language@}}]/@var{tagregexp}/[@var{nameregexp}/]@var{modifiers}
1919 @end smallexample
1920
1921 The essential part of the option value is @var{tagregexp}, the
1922 regexp for matching tags. It is always used anchored, that is, it
1923 only matches at the beginning of a line. If you want to allow
1924 indented tags, use a regexp that matches initial whitespace; start it
1925 with @samp{[ \t]*}.
1926
1927 In these regular expressions, @samp{\} quotes the next character, and
1928 all the GCC character escape sequences are supported (@samp{\a} for
1929 bell, @samp{\b} for back space, @samp{\d} for delete, @samp{\e} for
1930 escape, @samp{\f} for formfeed, @samp{\n} for newline, @samp{\r} for
1931 carriage return, @samp{\t} for tab, and @samp{\v} for vertical tab).
1932
1933 Ideally, @var{tagregexp} should not match more characters than are
1934 needed to recognize what you want to tag. If the syntax requires you
1935 to write @var{tagregexp} so it matches more characters beyond the tag
1936 itself, you should add a @var{nameregexp}, to pick out just the tag.
1937 This will enable Emacs to find tags more accurately and to do
1938 completion on tag names more reliably. You can find some examples
1939 below.
1940
1941 The @var{modifiers} are a sequence of zero or more characters that
1942 modify the way @code{etags} does the matching. A regexp with no
1943 modifiers is applied sequentially to each line of the input file, in a
1944 case-sensitive way. The modifiers and their meanings are:
1945
1946 @table @samp
1947 @item i
1948 Ignore case when matching this regexp.
1949 @item m
1950 Match this regular expression against the whole file, so that
1951 multi-line matches are possible.
1952 @item s
1953 Match this regular expression against the whole file, and allow
1954 @samp{.} in @var{tagregexp} to match newlines.
1955 @end table
1956
1957 The @samp{-R} option cancels all the regexps defined by preceding
1958 @samp{--regex} options. It too applies to the file names following
1959 it. Here's an example:
1960
1961 @smallexample
1962 etags --regex=/@var{reg1}/i voo.doo --regex=/@var{reg2}/m \
1963 bar.ber -R --lang=lisp los.er
1964 @end smallexample
1965
1966 @noindent
1967 Here @code{etags} chooses the parsing language for @file{voo.doo} and
1968 @file{bar.ber} according to their contents. @code{etags} also uses
1969 @var{reg1} to recognize additional tags in @file{voo.doo}, and both
1970 @var{reg1} and @var{reg2} to recognize additional tags in
1971 @file{bar.ber}. @var{reg1} is checked against each line of
1972 @file{voo.doo} and @file{bar.ber}, in a case-insensitive way, while
1973 @var{reg2} is checked against the whole @file{bar.ber} file,
1974 permitting multi-line matches, in a case-sensitive way. @code{etags}
1975 uses only the Lisp tags rules, with no user-specified regexp matching,
1976 to recognize tags in @file{los.er}.
1977
1978 You can restrict a @samp{--regex} option to match only files of a
1979 given language by using the optional prefix @var{@{language@}}.
1980 (@samp{etags --help} prints the list of languages recognized by
1981 @code{etags}.) This is particularly useful when storing many
1982 predefined regular expressions for @code{etags} in a file. The
1983 following example tags the @code{DEFVAR} macros in the Emacs source
1984 files, for the C language only:
1985
1986 @smallexample
1987 --regex='@{c@}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/'
1988 @end smallexample
1989
1990 @noindent
1991 When you have complex regular expressions, you can store the list of
1992 them in a file. The following option syntax instructs @code{etags} to
1993 read two files of regular expressions. The regular expressions
1994 contained in the second file are matched without regard to case.
1995
1996 @smallexample
1997 --regex=@@@var{case-sensitive-file} --ignore-case-regex=@@@var{ignore-case-file}
1998 @end smallexample
1999
2000 @noindent
2001 A regex file for @code{etags} contains one regular expression per
2002 line. Empty lines, and lines beginning with space or tab are ignored.
2003 When the first character in a line is @samp{@@}, @code{etags} assumes
2004 that the rest of the line is the name of another file of regular
2005 expressions; thus, one such file can include another file. All the
2006 other lines are taken to be regular expressions. If the first
2007 non-whitespace text on the line is @samp{--}, that line is a comment.
2008
2009 For example, we can create a file called @samp{emacs.tags} with the
2010 following contents:
2011
2012 @smallexample
2013 -- This is for GNU Emacs C source files
2014 @{c@}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/\1/
2015 @end smallexample
2016
2017 @noindent
2018 and then use it like this:
2019
2020 @smallexample
2021 etags --regex=@@emacs.tags *.[ch] */*.[ch]
2022 @end smallexample
2023
2024 Here are some more examples. The regexps are quoted to protect them
2025 from shell interpretation.
2026
2027 @itemize @bullet
2028
2029 @item
2030 Tag Octave files:
2031
2032 @smallexample
2033 etags --language=none \
2034 --regex='/[ \t]*function.*=[ \t]*\([^ \t]*\)[ \t]*(/\1/' \
2035 --regex='/###key \(.*\)/\1/' \
2036 --regex='/[ \t]*global[ \t].*/' \
2037 *.m
2038 @end smallexample
2039
2040 @noindent
2041 Note that tags are not generated for scripts, so that you have to add
2042 a line by yourself of the form @samp{###key @var{scriptname}} if you
2043 want to jump to it.
2044
2045 @item
2046 Tag Tcl files:
2047
2048 @smallexample
2049 etags --language=none --regex='/proc[ \t]+\([^ \t]+\)/\1/' *.tcl
2050 @end smallexample
2051
2052 @item
2053 Tag VHDL files:
2054
2055 @smallexample
2056 etags --language=none \
2057 --regex='/[ \t]*\(ARCHITECTURE\|CONFIGURATION\) +[^ ]* +OF/' \
2058 --regex='/[ \t]*\(ATTRIBUTE\|ENTITY\|FUNCTION\|PACKAGE\
2059 \( BODY\)?\|PROCEDURE\|PROCESS\|TYPE\)[ \t]+\([^ \t(]+\)/\3/'
2060 @end smallexample
2061 @end itemize
2062
2063 @node Select Tags Table
2064 @subsection Selecting a Tags Table
2065
2066 @vindex tags-file-name
2067 @findex visit-tags-table
2068 Emacs has at any time one @dfn{selected} tags table, and all the
2069 commands for working with tags tables use the selected one. To select
2070 a tags table, type @kbd{M-x visit-tags-table}, which reads the tags
2071 table file name as an argument, with @file{TAGS} in the default
2072 directory as the default.
2073
2074 Emacs does not actually read in the tags table contents until you
2075 try to use them; all @code{visit-tags-table} does is store the file
2076 name in the variable @code{tags-file-name}, and setting the variable
2077 yourself is just as good. The variable's initial value is @code{nil};
2078 that value tells all the commands for working with tags tables that
2079 they must ask for a tags table file name to use.
2080
2081 Using @code{visit-tags-table} when a tags table is already loaded
2082 gives you a choice: you can add the new tags table to the current list
2083 of tags tables, or start a new list. The tags commands use all the tags
2084 tables in the current list. If you start a new list, the new tags table
2085 is used @emph{instead} of others. If you add the new table to the
2086 current list, it is used @emph{as well as} the others.
2087
2088 @vindex tags-table-list
2089 You can specify a precise list of tags tables by setting the variable
2090 @code{tags-table-list} to a list of strings, like this:
2091
2092 @c keep this on two lines for formatting in smallbook
2093 @example
2094 @group
2095 (setq tags-table-list
2096 '("~/emacs" "/usr/local/lib/emacs/src"))
2097 @end group
2098 @end example
2099
2100 @noindent
2101 This tells the tags commands to look at the @file{TAGS} files in your
2102 @file{~/emacs} directory and in the @file{/usr/local/lib/emacs/src}
2103 directory. The order depends on which file you are in and which tags
2104 table mentions that file, as explained above.
2105
2106 Do not set both @code{tags-file-name} and @code{tags-table-list}.
2107
2108 @node Find Tag
2109 @subsection Finding a Tag
2110
2111 The most important thing that a tags table enables you to do is to find
2112 the definition of a specific tag.
2113
2114 @table @kbd
2115 @item M-.@: @var{tag} @key{RET}
2116 Find first definition of @var{tag} (@code{find-tag}).
2117 @item C-u M-.
2118 Find next alternate definition of last tag specified.
2119 @item C-u - M-.
2120 Go back to previous tag found.
2121 @item C-M-. @var{pattern} @key{RET}
2122 Find a tag whose name matches @var{pattern} (@code{find-tag-regexp}).
2123 @item C-u C-M-.
2124 Find the next tag whose name matches the last pattern used.
2125 @item C-x 4 .@: @var{tag} @key{RET}
2126 Find first definition of @var{tag}, but display it in another window
2127 (@code{find-tag-other-window}).
2128 @item C-x 5 .@: @var{tag} @key{RET}
2129 Find first definition of @var{tag}, and create a new frame to select the
2130 buffer (@code{find-tag-other-frame}).
2131 @item M-*
2132 Pop back to where you previously invoked @kbd{M-.} and friends.
2133 @end table
2134
2135 @kindex M-.
2136 @findex find-tag
2137 @kbd{M-.}@: (@code{find-tag}) is the command to find the definition of
2138 a specified tag. It searches through the tags table for that tag, as a
2139 string, and then uses the tags table info to determine the file that the
2140 definition is in and the approximate character position in the file of
2141 the definition. Then @code{find-tag} visits that file, moves point to
2142 the approximate character position, and searches ever-increasing
2143 distances away to find the tag definition.
2144
2145 If an empty argument is given (just type @key{RET}), the balanced
2146 expression in the buffer before or around point is used as the
2147 @var{tag} argument. @xref{Expressions}.
2148
2149 You don't need to give @kbd{M-.} the full name of the tag; a part
2150 will do. This is because @kbd{M-.} finds tags in the table which
2151 contain @var{tag} as a substring. However, it prefers an exact match
2152 to a substring match. To find other tags that match the same
2153 substring, give @code{find-tag} a numeric argument, as in @kbd{C-u
2154 M-.}; this does not read a tag name, but continues searching the tags
2155 table's text for another tag containing the same substring last used.
2156 If you have a real @key{META} key, @kbd{M-0 M-.}@: is an easier
2157 alternative to @kbd{C-u M-.}.
2158
2159 @kindex C-x 4 .
2160 @findex find-tag-other-window
2161 @kindex C-x 5 .
2162 @findex find-tag-other-frame
2163 Like most commands that can switch buffers, @code{find-tag} has a
2164 variant that displays the new buffer in another window, and one that
2165 makes a new frame for it. The former is @w{@kbd{C-x 4 .}}, which invokes
2166 the command @code{find-tag-other-window}. The latter is @w{@kbd{C-x 5 .}},
2167 which invokes @code{find-tag-other-frame}.
2168
2169 To move back to places you've found tags recently, use @kbd{C-u -
2170 M-.}; more generally, @kbd{M-.} with a negative numeric argument. This
2171 command can take you to another buffer. @w{@kbd{C-x 4 .}} with a negative
2172 argument finds the previous tag location in another window.
2173
2174 @kindex M-*
2175 @findex pop-tag-mark
2176 @vindex find-tag-marker-ring-length
2177 As well as going back to places you've found tags recently, you can go
2178 back to places @emph{from where} you found them. Use @kbd{M-*}, which
2179 invokes the command @code{pop-tag-mark}, for this. Typically you would
2180 find and study the definition of something with @kbd{M-.} and then
2181 return to where you were with @kbd{M-*}.
2182
2183 Both @kbd{C-u - M-.} and @kbd{M-*} allow you to retrace your steps to
2184 a depth determined by the variable @code{find-tag-marker-ring-length}.
2185
2186 @findex find-tag-regexp
2187 @kindex C-M-.
2188 The command @kbd{C-M-.} (@code{find-tag-regexp}) visits the tags that
2189 match a specified regular expression. It is just like @kbd{M-.} except
2190 that it does regexp matching instead of substring matching.
2191
2192 @node Tags Search
2193 @subsection Searching and Replacing with Tags Tables
2194 @cindex search and replace in multiple files
2195 @cindex multiple-file search and replace
2196
2197 The commands in this section visit and search all the files listed
2198 in the selected tags table, one by one. For these commands, the tags
2199 table serves only to specify a sequence of files to search. These
2200 commands scan the list of tags tables starting with the first tags
2201 table (if any) that describes the current file, proceed from there to
2202 the end of the list, and then scan from the beginning of the list
2203 until they have covered all the tables in the list.
2204
2205 @table @kbd
2206 @item M-x tags-search @key{RET} @var{regexp} @key{RET}
2207 Search for @var{regexp} through the files in the selected tags
2208 table.
2209 @item M-x tags-query-replace @key{RET} @var{regexp} @key{RET} @var{replacement} @key{RET}
2210 Perform a @code{query-replace-regexp} on each file in the selected tags table.
2211 @item M-,
2212 Restart one of the commands above, from the current location of point
2213 (@code{tags-loop-continue}).
2214 @end table
2215
2216 @findex tags-search
2217 @kbd{M-x tags-search} reads a regexp using the minibuffer, then
2218 searches for matches in all the files in the selected tags table, one
2219 file at a time. It displays the name of the file being searched so you
2220 can follow its progress. As soon as it finds an occurrence,
2221 @code{tags-search} returns.
2222
2223 @kindex M-,
2224 @findex tags-loop-continue
2225 Having found one match, you probably want to find all the rest. To find
2226 one more match, type @kbd{M-,} (@code{tags-loop-continue}) to resume the
2227 @code{tags-search}. This searches the rest of the current buffer, followed
2228 by the remaining files of the tags table.@refill
2229
2230 @findex tags-query-replace
2231 @kbd{M-x tags-query-replace} performs a single
2232 @code{query-replace-regexp} through all the files in the tags table. It
2233 reads a regexp to search for and a string to replace with, just like
2234 ordinary @kbd{M-x query-replace-regexp}. It searches much like @kbd{M-x
2235 tags-search}, but repeatedly, processing matches according to your
2236 input. @xref{Replace}, for more information on query replace.
2237
2238 @vindex tags-case-fold-search
2239 @cindex case-sensitivity and tags search
2240 You can control the case-sensitivity of tags search commands by
2241 customizing the value of the variable @code{tags-case-fold-search}. The
2242 default is to use the same setting as the value of
2243 @code{case-fold-search} (@pxref{Search Case}).
2244
2245 It is possible to get through all the files in the tags table with a
2246 single invocation of @kbd{M-x tags-query-replace}. But often it is
2247 useful to exit temporarily, which you can do with any input event that
2248 has no special query replace meaning. You can resume the query
2249 replace subsequently by typing @kbd{M-,}; this command resumes the
2250 last tags search or replace command that you did. For instance, to
2251 skip the rest of the current file, you can type @kbd{M-> M-,}.
2252
2253 The commands in this section carry out much broader searches than the
2254 @code{find-tag} family. The @code{find-tag} commands search only for
2255 definitions of tags that match your substring or regexp. The commands
2256 @code{tags-search} and @code{tags-query-replace} find every occurrence
2257 of the regexp, as ordinary search commands and replace commands do in
2258 the current buffer.
2259
2260 These commands create buffers only temporarily for the files that they
2261 have to search (those which are not already visited in Emacs buffers).
2262 Buffers in which no match is found are quickly killed; the others
2263 continue to exist.
2264
2265 It may have struck you that @code{tags-search} is a lot like
2266 @code{grep}. You can also run @code{grep} itself as an inferior of
2267 Emacs and have Emacs show you the matching lines one by one.
2268 @xref{Grep Searching}.
2269
2270 @node List Tags
2271 @subsection Tags Table Inquiries
2272
2273 @table @kbd
2274 @item M-x list-tags @key{RET} @var{file} @key{RET}
2275 Display a list of the tags defined in the program file @var{file}.
2276 @item M-x tags-apropos @key{RET} @var{regexp} @key{RET}
2277 Display a list of all tags matching @var{regexp}.
2278 @end table
2279
2280 @findex list-tags
2281 @kbd{M-x list-tags} reads the name of one of the files described by
2282 the selected tags table, and displays a list of all the tags defined in
2283 that file. The ``file name'' argument is really just a string to
2284 compare against the file names recorded in the tags table; it is read as
2285 a string rather than as a file name. Therefore, completion and
2286 defaulting are not available, and you must enter the file name the same
2287 way it appears in the tags table. Do not include a directory as part of
2288 the file name unless the file name recorded in the tags table includes a
2289 directory.
2290
2291 @findex tags-apropos
2292 @vindex tags-apropos-verbose
2293 @kbd{M-x tags-apropos} is like @code{apropos} for tags
2294 (@pxref{Apropos}). It finds all the tags in the selected tags table
2295 whose entries match @var{regexp}, and displays them. If the variable
2296 @code{tags-apropos-verbose} is non-@code{nil}, it displays the names
2297 of the tags files together with the tag names.
2298
2299 @vindex tags-tag-face
2300 @vindex tags-apropos-additional-actions
2301 You can customize the appearance of the output by setting the
2302 variable @code{tags-tag-face} to a face. You can display additional
2303 output with @kbd{M-x tags-apropos} by customizing the variable
2304 @code{tags-apropos-additional-actions}---see its documentation for
2305 details.
2306
2307 You can also use the collection of tag names to complete a symbol
2308 name in the buffer. @xref{Symbol Completion}.
2309
2310 @node EDE
2311 @section Emacs Development Environment
2312 @cindex EDE (Emacs Development Environment)
2313 @cindex Emacs Development Environment
2314 @cindex Integrated development environment
2315
2316 EDE (@dfn{Emacs Development Environment}) is a package that simplifies
2317 the task of creating, building, and debugging large programs with
2318 Emacs. It provides some of the features of an IDE, or @dfn{Integrated
2319 Development Environment}, in Emacs.
2320
2321 This section provides a brief description of EDE usage.
2322 @ifnottex
2323 For full details, see @ref{Top, EDE,, ede, Emacs Development Environment}.
2324 @end ifnottex
2325 @iftex
2326 For full details on Ede, type @kbd{C-h i} and then select the EDE
2327 manual.
2328 @end iftex
2329
2330 EDE is implemented as a global minor mode (@pxref{Minor Modes}). To
2331 enable it, type @kbd{M-x global-ede-mode} or click on the
2332 @samp{Project Support (EDE)} item in the @samp{Tools} menu. You can
2333 also enable EDE each time you start Emacs, by adding the following
2334 line to your initialization file:
2335
2336 @smallexample
2337 (global-ede-mode t)
2338 @end smallexample
2339
2340 @noindent
2341 Activating EDE adds a menu named @samp{Development} to the menu bar.
2342 Many EDE commands, including the ones described below, can be invoked
2343 from this menu.
2344
2345 EDE organizes files into @dfn{projects}, which correspond to
2346 directory trees. The @dfn{project root} is the topmost directory of a
2347 project. To define a new project, visit a file in the desired project
2348 root and type @kbd{M-x ede-new}. This command prompts for a
2349 @dfn{project type}, which refers to the underlying method that EDE
2350 will use to manage the project (@pxref{Creating a Project, EDE,, ede,
2351 Emacs Development Environment}). The most common project types are
2352 @samp{Make}, which uses Makefiles, and @samp{Automake}, which uses GNU
2353 Automake (@pxref{Top, Automake,, automake, Automake}). In both cases,
2354 EDE also creates a file named @file{Project.ede}, which stores
2355 information about the project.
2356
2357 A project may contain one or more @dfn{targets}. A target can be an
2358 object file, executable program, or some other type of file, which is
2359 ``built'' from one or more of the files in the project.
2360
2361 To add a new @dfn{target} to a project, type @kbd{C-c . t}
2362 (@code{M-x ede-new-target}). This command also asks if you wish to
2363 ``add'' the current file to that target, which means that the target
2364 is to be built from that file. After you have defined a target, you
2365 can add more files to it by typing @kbd{C-c . a}
2366 (@code{ede-add-file}).
2367
2368 To build a target, type @kbd{C-c . c} (@code{ede-compile-target}).
2369 To build all the targets in the project, type @kbd{C-c . C}
2370 (@code{ede-compile-project}). EDE uses the file types to guess how
2371 the target should be built.
2372
2373 @ifnottex
2374 @include emerge-xtra.texi
2375 @end ifnottex
2376