(M-40132'): Unify GT-53970.
[chise/xemacs-chise.git-] / info / xemacs.info-8
1 This is ../info/xemacs.info, produced by makeinfo version 4.0b from
2 xemacs/xemacs.texi.
3
4 INFO-DIR-SECTION XEmacs Editor
5 START-INFO-DIR-ENTRY
6 * XEmacs: (xemacs).             XEmacs Editor.
7 END-INFO-DIR-ENTRY
8
9    This file documents the XEmacs editor.
10
11    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.  Copyright (C)
12 1991, 1992, 1993, 1994 Lucid, Inc.  Copyright (C) 1993, 1994 Sun
13 Microsystems, Inc.  Copyright (C) 1995 Amdahl Corporation.
14
15    Permission is granted to make and distribute verbatim copies of this
16 manual provided the copyright notice and this permission notice are
17 preserved on all copies.
18
19    Permission is granted to copy and distribute modified versions of
20 this manual under the conditions for verbatim copying, provided also
21 that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
22 General Public License" are included exactly as in the original, and
23 provided that the entire resulting derived work is distributed under the
24 terms of a permission notice identical to this one.
25
26    Permission is granted to copy and distribute translations of this
27 manual into another language, under the above conditions for modified
28 versions, except that the sections entitled "The GNU Manifesto",
29 "Distribution" and "GNU General Public License" may be included in a
30 translation approved by the author instead of in the original English.
31
32 \1f
33 File: xemacs.info,  Node: Backup Deletion,  Next: Backup Copying,  Prev: Backup Names,  Up: Backup
34
35 Automatic Deletion of Backups
36 .............................
37
38    To prevent unlimited consumption of disk space, Emacs can delete
39 numbered backup versions automatically.  Generally Emacs keeps the
40 first few backups and the latest few backups, deleting any in between.
41 This happens every time a new backup is made.  The two variables that
42 control the deletion are `kept-old-versions' and `kept-new-versions'.
43 Their values are, respectively the number of oldest (lowest-numbered)
44 backups to keep and the number of newest (highest-numbered) ones to
45 keep, each time a new backup is made.  The values are used just after a
46 new backup version is made; that newly made backup is included in the
47 count in `kept-new-versions'.  By default, both variables are 2.
48
49    If `delete-old-versions' is non-`nil',  excess middle versions are
50 deleted without notification.  If it is `nil', the default, you are
51 asked whether the excess middle versions should really be deleted.
52
53    You can also use Dired's `.' (Period) command to delete old versions.
54 *Note Dired::.
55
56 \1f
57 File: xemacs.info,  Node: Backup Copying,  Prev: Backup Deletion,  Up: Backup
58
59 Copying vs. Renaming
60 ....................
61
62    You can make backup files by copying the old file or by renaming it.
63 This makes a difference when the old file has multiple names.  If you
64 rename the old file into the backup file, the alternate names become
65 names for the backup file.  If you copy the old file instead, the
66 alternate names remain names for the file that you are editing, and the
67 contents accessed by those names will be the new contents.
68
69    How you make a backup file may also affect the file's owner and
70 group.  If you use copying, they do not change.  If renaming is used,
71 you become the file's owner, and the file's group becomes the default
72 (different operating systems have different defaults for the group).
73
74    Having the owner change is usually a good idea, because then the
75 owner is always the person who last edited the file.  Occasionally
76 there is a file whose owner should not change.  Since most files should
77 change owners, it is a good idea to use local variable lists to set
78 `backup-by-copying-when-mismatch' for the special cases where the owner
79 should not change (*note File Variables::).
80
81    Three variables control the choice of renaming or copying.
82 Normally, renaming is done.  If the variable `backup-by-copying' is
83 non-`nil', copying is used.  Otherwise, if the variable
84 `backup-by-copying-when-linked' is non-`nil', copying is done for files
85 that have multiple names, but renaming may still be done when the file
86 being edited has only one name.  If the variable
87 `backup-by-copying-when-mismatch' is non-`nil', copying is done if
88 renaming would cause the file's owner or group to change.
89
90 \1f
91 File: xemacs.info,  Node: Interlocking,  Prev: Backup,  Up: Saving
92
93 Protection Against Simultaneous Editing
94 ---------------------------------------
95
96    Simultaneous editing occurs when two users visit the same file, both
97 make changes, and both save their changes.  If no one was informed that
98 this was happening, and you saved first, you would later find that your
99 changes were lost.  On some systems, Emacs notices immediately when the
100 second user starts to change a file already being edited, and issues a
101 warning.  When this is not possible, or if the second user has started
102 to change the file despite the warning, Emacs checks when the file is
103 saved, and issues a second warning when a user is about to overwrite a
104 file containing another user's changes.  If you are the user editing the
105 file, you can take corrective action at this point and prevent actual
106 loss of work.
107
108    When you make the first modification in an Emacs buffer that is
109 visiting a file, Emacs records that you have locked the file.  (It does
110 this by writing another file in a directory reserved for this purpose.)
111 The lock is removed when you save the changes.  The idea is that the
112 file is locked whenever the buffer is modified.  If you begin to modify
113 the buffer while the visited file is locked by someone else, this
114 constitutes a collision, and Emacs asks you what to do.  It does this
115 by calling the Lisp function `ask-user-about-lock', which you can
116 redefine to customize what it does.  The standard definition of this
117 function asks you a question and accepts three possible answers:
118
119 `s'
120      Steal the lock.  Whoever was already changing the file loses the
121      lock, and you get the lock.
122
123 `p'
124      Proceed.  Go ahead and edit the file despite its being locked by
125      someone else.
126
127 `q'
128      Quit.  This causes an error (`file-locked') and the modification
129      you were trying to make in the buffer does not actually take place.
130
131    Note that locking works on the basis of a file name; if a file has
132 multiple names, Emacs does not realize that the two names are the same
133 file and cannot prevent two users from editing it simultaneously under
134 different names.  However, basing locking on names means that Emacs can
135 interlock the editing of new files that do not really exist until they
136 are saved.
137
138    Some systems are not configured to allow Emacs to make locks.  On
139 these systems, Emacs cannot detect trouble in advance, but it can still
140 detect it in time to prevent you from overwriting someone else's
141 changes.
142
143    Every time Emacs saves a buffer, it first checks the
144 last-modification date of the existing file on disk to see that it has
145 not changed since the file was last visited or saved.  If the date does
146 not match, it implies that changes were made in the file in some other
147 way, and these changes are about to be lost if Emacs actually does
148 save.  To prevent this, Emacs prints a warning message and asks for
149 confirmation before saving.  Occasionally you will know why the file
150 was changed and know that it does not matter; then you can answer `yes'
151 and proceed.  Otherwise, you should cancel the save with `C-g' and
152 investigate the situation.
153
154    The first thing you should do when notified that simultaneous editing
155 has already taken place is to list the directory with `C-u C-x C-d'
156 (*note Directory Listing: ListDir.).  This will show the file's current
157 author.  You should attempt to contact that person and ask him not to
158 continue editing.  Often the next step is to save the contents of your
159 Emacs buffer under a different name, and use `diff' to compare the two
160 files.
161
162    Simultaneous editing checks are also made when you visit a file that
163 is already visited with `C-x C-f' and when you start to modify a file.
164 This is not strictly necessary, but it is useful to find out about such
165 a problem as early as possible, when corrective action takes less work.
166
167    Another way to protect your file is to set the read, write, and
168 executable permissions for the file. Use the function
169 `set-default-file-modes' to set the UNIX `umask' value to the NMASK
170 argument. The `umask' value is the default protection mode for new
171 files.
172
173 \1f
174 File: xemacs.info,  Node: Reverting,  Next: Auto Save,  Prev: Saving,  Up: Files
175
176 Reverting a Buffer
177 ==================
178
179    If you have made extensive changes to a file and then change your
180 mind about them, you can get rid of all changes by reading in the
181 previous version of the file.  To do this, use `M-x revert-buffer',
182 which operates on the current buffer.  Since reverting a buffer can
183 result in very extensive changes, you must confirm it with `yes'.
184
185    If the current buffer has been auto-saved more recently than it has
186 been saved explicitly, `revert-buffer' offers to read the auto save file
187 instead of the visited file (*note Auto Save::).  Emacs asks you about
188 the auto-save file before the request for confirmation of the
189 `revert-buffer' operation, and demands `y' or `n' as an answer.  If you
190 have started to type `yes' for confirmation without realizing that the
191 auto-save question was going to be asked, the `y' will answer that
192 question, but the `es' will not be valid confirmation.  This gives you
193 a chance to cancel the operation with `C-g' and try again with the
194 answers you really intend.
195
196    `revert-buffer' keeps point at the same distance (measured in
197 characters) from the beginning of the file.  If the file was edited only
198 slightly, you will be at approximately the same piece of text after
199 reverting as before.  If you have made more extensive changes, the
200 value of point in the old file may bring you to a totally different
201 piece of text than your last editing point.
202
203    A buffer reverted from its visited file is marked "not modified"
204 until you make a change.
205
206    Some kinds of buffers whose contents reflect data bases other than
207 files, such as Dired buffers, can also be reverted.  For them,
208 reverting means recalculating their contents from the appropriate data.
209 Buffers created randomly with `C-x b' cannot be reverted;
210 `revert-buffer' reports an error when asked to do so.
211
212 \1f
213 File: xemacs.info,  Node: Auto Save,  Next: Version Control,  Prev: Reverting,  Up: Files
214
215 Auto-Saving: Protection Against Disasters
216 =========================================
217
218    Emacs saves all the visited files from time to time (based on
219 counting your keystrokes) without being asked.  This is called
220 "auto-saving".  It prevents you from losing more than a limited amount
221 of work if the system crashes.
222
223    When Emacs determines it is time for auto-saving, each buffer is
224 considered and is auto-saved if auto-saving is turned on for it and it
225 has changed since the last time it was auto-saved.  If any auto-saving
226 is done, the message `Auto-saving...' is displayed in the echo area
227 until auto-saving is finished.  Errors occurring during auto-saving are
228 caught so that they do not interfere with the execution of commands you
229 have been typing.
230
231 * Menu:
232
233 * Files: Auto Save Files.
234 * Control: Auto Save Control.
235 * Recover::             Recovering text from auto-save files.
236
237 \1f
238 File: xemacs.info,  Node: Auto Save Files,  Next: Auto Save Control,  Prev: Auto Save,  Up: Auto Save
239
240 Auto-Save Files
241 ---------------
242
243    Auto-saving does not normally write to the files you visited, because
244 it can be undesirable to save a program that is in an inconsistent
245 state when you have made only half of a planned change.  Instead,
246 auto-saving is done in a different file called the "auto-save file",
247 and the visited file is changed only when you save explicitly, for
248 example, with `C-x C-s'.
249
250    Normally, the name of the auto-save file is generated by appending
251 `#' to the front and back of the visited file name.  Thus, a buffer
252 visiting file `foo.c' would be auto-saved in a file `#foo.c#'.  Most
253 buffers that are not visiting files are auto-saved only if you request
254 it explicitly; when they are auto-saved, the auto-save file name is
255 generated by appending `#%' to the front and `#' to the back of buffer
256 name.  For example, the `*mail*' buffer in which you compose messages
257 to be sent is auto-saved in a file named `#%*mail*#'.  Names of
258 auto-save files are generated this way unless you customize the
259 functions `make-auto-save-file-name' and `auto-save-file-name-p' to do
260 something different.  The file name to be used for auto-saving a buffer
261 is calculated at the time auto-saving is turned on in that buffer.
262
263    If you want auto-saving to be done in the visited file, set the
264 variable `auto-save-visited-file-name' to be non-`nil'.  In this mode,
265 there is really no difference between auto-saving and explicit saving.
266
267    Emacs deletes a buffer's auto-save file when you explicitly save the
268 buffer.  To inhibit the deletion, set the variable
269 `delete-auto-save-files' to `nil'.  Changing the visited file name with
270 `C-x C-w' or `set-visited-file-name' renames any auto-save file to
271 correspond to the new visited name.
272
273 \1f
274 File: xemacs.info,  Node: Auto Save Control,  Next: Recover,  Prev: Auto Save Files,  Up: Auto Save
275
276 Controlling Auto-Saving
277 -----------------------
278
279    Each time you visit a file, auto-saving is turned on for that file's
280 buffer if the variable `auto-save-default' is non-`nil' (but not in
281 batch mode; *note Entering Emacs::).  The default for this variable is
282 `t', so Emacs auto-saves buffers that visit files by default.  You can
283 use the command `M-x auto-save-mode' to turn auto-saving for a buffer
284 on or off.  Like other minor mode commands, `M-x auto-save-mode' turns
285 auto-saving on with a positive argument, off with a zero or negative
286 argument; with no argument, it toggles.
287
288    Emacs performs auto-saving periodically based on counting how many
289 characters you have typed since the last time auto-saving happened.  The
290 variable `auto-save-interval' specifies the number of characters
291 between auto-saves.  By default, it is 300.  Emacs also auto-saves
292 whenever you call the function `do-auto-save'.
293
294    Emacs also does auto-saving whenever it gets a fatal error.  This
295 includes killing the Emacs job with a shell command such as `kill
296 -emacs', or disconnecting a phone line or network connection.
297
298    You can set the number of seconds of idle time before an auto-save is
299 done. Setting the value of the variable `auto-save-timeout' to zero or
300 `nil' will  disable auto-saving due to idleness.
301
302    The actual amount of idle time between auto-saves is logarithmically
303 related to the size of the current buffer.  This variable is the number
304 of seconds after which an auto-save will happen when the current buffer
305 is 50k or less; the timeout will be 2 1/4 times this in a 200k buffer, 3
306 3/4 times this in a 1000k buffer, and 4 1/2 times this in a 2000k
307 buffer.
308
309    For this variable to have any effect, you must do `(require 'timer)'.
310
311 \1f
312 File: xemacs.info,  Node: Recover,  Prev: Auto Save Control,  Up: Auto Save
313
314 Recovering Data from Auto-Saves
315 -------------------------------
316
317    If you want to use the contents of an auto-save file to recover from
318 a loss of data, use the command `M-x recover-file <RET> FILE <RET>'.
319 Emacs visits FILE and then (after your confirmation) restores the
320 contents from the auto-save file `#FILE#'.  You can then save the file
321 with `C-x C-s' to put the recovered text into FILE itself.  For
322 example, to recover file `foo.c' from its auto-save file `#foo.c#', do:
323
324      M-x recover-file <RET> foo.c <RET>
325      C-x C-s
326
327    Before asking for confirmation, `M-x recover-file' displays a
328 directory listing describing the specified file and the auto-save file,
329 so you can compare their sizes and dates.  If the auto-save file is
330 older, `M-x recover-file' does not offer to read it.
331
332    Auto-saving is disabled by `M-x recover-file' because using this
333 command implies that the auto-save file contains valuable data from a
334 past session.  If you save the data in the visited file and then go on
335 to make new changes, turn auto-saving back on with `M-x auto-save-mode'.
336
337 \1f
338 File: xemacs.info,  Node: Version Control,  Next: ListDir,  Prev: Auto Save,  Up: Files
339
340 Version Control
341 ===============
342
343    "Version control systems" are packages that can record multiple
344 versions of a source file, usually storing the unchanged parts of the
345 file just once.  Version control systems also record history information
346 such as the creation time of each version, who created it, and a
347 description of what was changed in that version.
348
349    The GNU project recommends the version control system known as RCS,
350 which is free software and available from the Free Software Foundation.
351 Emacs supports use of either RCS or SCCS (a proprietary, but widely
352 used, version control system that is not quite as powerful as RCS)
353 through a facility called VC.  The same Emacs commands work with either
354 RCS or SCCS, so you hardly have to know which one of them you are using.
355
356 * Menu:
357
358 * Concepts of VC::              Basic version control information;
359                                   checking files in and out.
360 * Editing with VC::             Commands for editing a file maintained
361                                   with version control.
362 * Variables for Check-in/out::  Variables that affect the commands used
363                                   to check files in or out.
364 * Log Entries::                 Logging your changes.
365 * Change Logs and VC::          Generating a change log file from log
366                                   entries.
367 * Old Versions::                Examining and comparing old versions.
368 * VC Status::                   Commands to view the VC status of files and
369                                   look at log entries.
370 * Renaming and VC::             A command to rename both the source and
371                                   master file correctly.
372 * Snapshots::                   How to make and use snapshots, a set of
373                                   file versions that can be treated as a unit.
374 * Version Headers::             Inserting version control headers into
375                                   working files.
376
377 \1f
378 File: xemacs.info,  Node: Concepts of VC,  Next: Editing with VC,  Prev: Version Control,  Up: Version Control
379
380 Concepts of Version Control
381 ---------------------------
382
383    When a file is under version control, we also say that it is
384 "registered" in the version control system.  Each registered file has a
385 corresponding "master file" which represents the file's present state
386 plus its change history, so that you can reconstruct from it either the
387 current version or any specified earlier version.  Usually the master
388 file also records a "log entry" for each version describing what was
389 changed in that version.
390
391    The file that is maintained under version control is sometimes called
392 the "work file" corresponding to its master file.
393
394    To examine a file, you "check it out".  This extracts a version of
395 the source file (typically, the most recent) from the master file.  If
396 you want to edit the file, you must check it out "locked".  Only one
397 user can do this at a time for any given source file.  (This kind of
398 locking is completely unrelated to the locking that Emacs uses to
399 detect simultaneous editing of a file.)
400
401    When you are done with your editing, you must "check in" the new
402 version.  This records the new version in the master file, and unlocks
403 the source file so that other people can lock it and thus modify it.
404
405    Checkin and checkout are the basic operations of version control.
406 You can do both of them with a single Emacs command: `C-x C-q'
407 (`vc-toggle-read-only').
408
409    A "snapshot" is a coherent collection of versions of the various
410 files that make up a program.  *Note Snapshots::.
411
412 \1f
413 File: xemacs.info,  Node: Editing with VC,  Next: Variables for Check-in/out,  Prev: Concepts of VC,  Up: Version Control
414
415 Editing with Version Control
416 ----------------------------
417
418    When you visit a file that is maintained using version control, the
419 mode line displays `RCS' or `SCCS' to inform you that version control
420 is in use, and also (in case you care) which low-level system the file
421 is actually stored in.  Normally, such a source file is read-only, and
422 the mode line indicates this with `%%'.  With RCS, the mode line also
423 indicates the number of the head version, which is normally also the
424 version you are looking at.
425
426    These are the commands for editing a file maintained with version
427 control:
428
429 `C-x C-q'
430      Check the visited file in or out.
431
432 `C-x v u'
433      Revert the buffer and the file to the last checked in version.
434
435 `C-x v c'
436      Remove the last-entered change from the master for the visited
437      file.  This undoes your last check-in.
438
439 `C-x v i'
440      Register the visited file in version control.
441
442 (`C-x v' is the prefix key for version control commands; all of these
443 commands except for `C-x C-q' start with `C-x v'.)
444
445    When you want to modify a file maintained with version control, type
446 `C-x C-q' (`vc-toggle-read-only').  This "checks out" the file, and
447 tells RCS or SCCS to lock the file.  This means making the file
448 writable for you (but not for anyone else).
449
450    When you are finished editing the file, type `C-x C-q' again.  When
451 used on a file that is checked out, this command checks the file in.
452 But check-in does not start immediately; first, you must enter the "log
453 entry"--a description of the changes in the new version.  `C-x C-q'
454 pops up a buffer for you to enter this in.  When you are finished
455 typing in the log entry, type `C-c C-c' to terminate it; this is when
456 actual check-in takes place.
457
458    Once you have checked in your changes, the file is unlocked, so that
459 other users can lock it and modify it.
460
461    Emacs does not save backup files for source files that are maintained
462 with version control.  If you want to make backup files despite version
463 control, set the variable `vc-make-backup-files' to a non-`nil' value.
464
465    Normally the work file exists all the time, whether it is locked or
466 not.  If you set `vc-keep-workfiles' to `nil', then checking in a new
467 version with `C-x C-q' deletes the work file; but any attempt to visit
468 the file with Emacs creates it again.
469
470    It is not impossible to lock a file that someone else has locked.  If
471 you try to check out a file that is locked, `C-x C-q' asks you whether
472 you want to "steal the lock."  If you say yes, the file becomes locked
473 by you, but a message is sent to the person who had formerly locked the
474 file, to inform him of what has happened.  The mode line indicates that
475 a file is locked by someone else by displaying the login name of that
476 person, before the version number.
477
478    If you want to discard your current set of changes and revert to the
479 last version checked in, use `C-x v u' (`vc-revert-buffer').  This
480 cancels your last check-out, leaving the file unlocked.  If you want to
481 make a different set of changes, you must first check the file out
482 again.  `C-x v u' requires confirmation, unless it sees that you
483 haven't made any changes since the last checked-in version.
484
485    `C-x v u' is also the command to use if you lock a file and then
486 don't actually change it.
487
488    You can cancel a change after checking it in, with `C-x v c'
489 (`vc-cancel-version').  This command discards all record of the most
490 recent checked in version, so be careful about using it.  It requires
491 confirmation with `yes'.  By default, `C-x v c' reverts your workfile
492 and buffer to the previous version (the one that precedes the version
493 that is deleted), but you can prevent the reversion by giving the
494 command a prefix argument.  Then the buffer does not change.
495
496    This command with a prefix argument is useful when you have checked
497 in a change and then discover a trivial error in it; you can cancel the
498 erroneous check-in, fix the error, and repeat the check-in.
499
500    Be careful when invoking `C-x v c', as it is easy to throw away a
501 lot of work with it.  To help you be careful, this command always
502 requires confirmation with `yes'.
503
504    You can register the visited file for version control using
505 `C-x v i' (`vc-register').  If the variable `vc-default-back-end' is
506 non-`nil', it specifies which version control system to use; otherwise,
507 this uses RCS if it is installed on your system and SCCS if not.  After
508 `C-x v i', the file is unlocked and read-only.  Type `C-x C-q' if you
509 wish to edit it.
510
511    By default, the initial version number is 1.1.  If you want to use a
512 different number, give `C-x v i' a prefix argument; then it reads the
513 initial version number using the minibuffer.
514
515    If `vc-initial-comment' is non-`nil', `C-x v i' reads an initial
516 comment (much like a log entry) to describe the purpose of this source
517 file.
518
519    To specify the version number for a subsequent checkin, use the
520 command `C-u C-x v v'.  `C-x v v' (`vc-next-action') is the command
521 that `C-x C-q' uses to do the "real work" when the visited file uses
522 version control.  When used for checkin, and given a prefix argument,
523 it reads the version number with the minibuffer.
524
525 \1f
526 File: xemacs.info,  Node: Variables for Check-in/out,  Next: Log Entries,  Prev: Editing with VC,  Up: Version Control
527
528 Variables Affecting Check-in and Check-out
529 ------------------------------------------
530
531    If `vc-suppress-confirm' is non-`nil', then `C-x C-q' and `C-x v i'
532 can save the current buffer without asking, and `C-x v u' also operates
533 without asking for confirmation.  (This variable does not affect `C-x v
534 c'; that is so drastic that it should always ask for confirmation.)
535
536    VC mode does much of its work by running the shell commands for RCS
537 and SCCS.  If `vc-command-messages' is non-`nil', VC displays messages
538 to indicate which shell commands it runs, and additional messages when
539 the commands finish.
540
541    Normally, VC assumes that it can deduce the locked/unlocked state of
542 files by looking at the file permissions of the work file; this is
543 fast.  However, if the `RCS' or `SCCS' subdirectory is actually a
544 symbolic link, then VC does not trust the file permissions to reflect
545 this status.
546
547    You can specify the criterion for whether to trust the file
548 permissions by setting the variable `vc-mistrust-permissions'.  Its
549 value may be `t' (always mistrust the file permissions and check the
550 master file), `nil' (always trust the file permissions), or a function
551 of one argument which makes the decision.  The argument is the directory
552 name of the `RCS' or `SCCS' subdirectory.  A non-`nil' value from the
553 function says to mistrust the file permissions.
554
555    If you find that the file permissions of work files are changed
556 erroneously, set `vc-mistrust-permissions' to `t'.  Then VC always
557 checks the master file to determine the file's status.
558
559    You can specify additional directories to search for version control
560 programs by setting the variable `vc-path'.  These directories are
561 searched before the usual search path.  The proper result usually
562 happens automatically.
563
564 \1f
565 File: xemacs.info,  Node: Log Entries,  Next: Change Logs and VC,  Prev: Variables for Check-in/out,  Up: Version Control
566
567 Log Entries
568 -----------
569
570    When you're editing an initial comment or log entry for inclusion in
571 a master file, finish your entry by typing `C-c C-c'.
572
573 `C-c C-c'
574      Finish the comment edit normally (`vc-finish-logentry').  This
575      finishes check-in.
576
577    To abort check-in, just don't type `C-c C-c' in that buffer.  You
578 can switch buffers and do other editing.  As long as you don't try to
579 check in another file, the entry you were editing remains in its
580 buffer, and you can go back to that buffer at any time to complete the
581 check-in.
582
583    If you change several source files for the same reason, it is often
584 convenient to specify the same log entry for many of the files.  To do
585 this, use the history of previous log entries.  The commands `M-n',
586 `M-p', `M-s' and `M-r' for doing this work just like the minibuffer
587 history commands (except that these versions are used outside the
588 minibuffer).
589
590    Each time you check in a file, the log entry buffer is put into VC
591 Log mode, which involves running two hooks: `text-mode-hook' and
592 `vc-log-mode-hook'.
593
594 \1f
595 File: xemacs.info,  Node: Change Logs and VC,  Next: Old Versions,  Prev: Log Entries,  Up: Version Control
596
597 Change Logs and VC
598 ------------------
599
600    If you use RCS for a program and also maintain a change log file for
601 it (*note Change Log::), you can generate change log entries
602 automatically from the version control log entries:
603
604 `C-x v a'
605      Visit the current directory's change log file and create new
606      entries for versions checked in since the most recent entry in the
607      change log file (`vc-update-change-log').
608
609      This command works with RCS only; it does not work with SCCS.
610
611    For example, suppose the first line of `ChangeLog' is dated 10 April
612 1992, and that the only check-in since then was by Nathaniel Bowditch
613 to `rcs2log' on 8 May 1992 with log text `Ignore log messages that
614 start with `#'.'.  Then `C-x v a' visits `ChangeLog' and inserts text
615 like this:
616
617      Fri May  8 21:45:00 1992  Nathaniel Bowditch  (nat@apn.org)
618      
619              * rcs2log: Ignore log messages that start with `#'.
620
621 You can then edit the new change log entry further as you wish.
622
623    Normally, the log entry for file `foo' is displayed as `* foo: TEXT
624 OF LOG ENTRY'.  The `:' after `foo' is omitted if the text of the log
625 entry starts with `(FUNCTIONNAME): '.  For example, if the log entry
626 for `vc.el' is `(vc-do-command): Check call-process status.', then the
627 text in `ChangeLog' looks like this:
628
629      Wed May  6 10:53:00 1992  Nathaniel Bowditch  (nat@apn.org)
630      
631              * vc.el (vc-do-command): Check call-process status.
632
633    When `C-x v a' adds several change log entries at once, it groups
634 related log entries together if they all are checked in by the same
635 author at nearly the same time.  If the log entries for several such
636 files all have the same text, it coalesces them into a single entry.
637 For example, suppose the most recent checkins have the following log
638 entries:
639
640 For `vc.texinfo':
641      Fix expansion typos.
642 For `vc.el':
643      Don't call expand-file-name.
644 For `vc-hooks.el':
645      Don't call expand-file-name.
646
647    They appear like this in `ChangeLog':
648
649      Wed Apr  1 08:57:59 1992  Nathaniel Bowditch  (nat@apn.org)
650      
651              * vc.texinfo: Fix expansion typos.
652      
653              * vc.el, vc-hooks.el: Don't call expand-file-name.
654
655    Normally, `C-x v a' separates log entries by a blank line, but you
656 can mark several related log entries to be clumped together (without an
657 intervening blank line) by starting the text of each related log entry
658 with a label of the form `{CLUMPNAME} '.  The label itself is not
659 copied to `ChangeLog'.  For example, suppose the log entries are:
660
661 For `vc.texinfo':
662      {expand} Fix expansion typos.
663 For `vc.el':
664      {expand} Don't call expand-file-name.
665 For `vc-hooks.el':
666      {expand} Don't call expand-file-name.
667
668 Then the text in `ChangeLog' looks like this:
669
670      Wed Apr  1 08:57:59 1992  Nathaniel Bowditch  (nat@apn.org)
671      
672              * vc.texinfo: Fix expansion typos.
673              * vc.el, vc-hooks.el: Don't call expand-file-name.
674
675    A log entry whose text begins with `#' is not copied to `ChangeLog'.
676 For example, if you merely fix some misspellings in comments, you can
677 log the change with an entry beginning with `#' to avoid putting such
678 trivia into `ChangeLog'.
679
680 \1f
681 File: xemacs.info,  Node: Old Versions,  Next: VC Status,  Prev: Change Logs and VC,  Up: Version Control
682
683 Examining And Comparing Old Versions
684 ------------------------------------
685
686 `C-x v ~ VERSION <RET>'
687      Examine version VERSION of the visited file, in a buffer of its
688      own (`vc-version-other-window').
689
690 `C-x v ='
691      Compare the current buffer contents with the latest checked-in
692      version of the file.
693
694 `C-u C-x v = FILE <RET> OLDVERS <RET> NEWVERS <RET>'
695      Compare the specified two versions of FILE.
696
697    You can examine any version of a file by first visiting it, and then
698 using `C-x v ~ VERSION <RET>' (`vc-version-other-window').  This puts
699 the text of version VERSION in a file named `FILENAME.~VERSION~', then
700 visits it in a separate window.
701
702    To compare two versions of a file, use the command `C-x v ='
703 (`vc-diff').
704
705    Plain `C-x v =' compares the current buffer contents (saving them in
706 the file if necessary) with the last checked-in version of the file.
707 With a prefix argument, `C-x v =' reads a file name and two version
708 numbers, then compares those versions of the specified file.
709
710    If you supply a directory name instead of the name of a work file,
711 this command compares the two specified versions of all registered files
712 in that directory and its subdirectories.  You can also specify a
713 snapshot name (*note Snapshots::) instead of one or both version
714 numbers.
715
716    You can specify a checked-in version by its number; you can specify
717 the most recent checked-in version with an empty version number.
718
719    This command works by running the `vcdiff' utility, getting the
720 options from the variable `diff-switches'.  It displays the output in a
721 special buffer in another window.  Unlike the `M-x diff' command, `C-x
722 v =' does not try to find the changes in the old and new versions.
723 This is because one or both versions normally do not exist as files.
724 They exist only in the records of the master file.  *Note Comparing
725 Files::, for more information about `M-x diff'.
726
727 \1f
728 File: xemacs.info,  Node: VC Status,  Next: Renaming and VC,  Prev: Old Versions,  Up: Version Control
729
730 VC Status Commands
731 ------------------
732
733    To view the detailed version control status and history of a file,
734 type `C-x v l' (`vc-print-log').  It displays the history of changes to
735 the current file, including the text of the log entries.  The output
736 appears in a separate window.
737
738    When you are working on a large program, it's often useful to find
739 all the files that are currently locked, or all the files maintained in
740 version control at all.  You can use `C-x v d' (`vc-directory') to show
741 all the locked files in or beneath the current directory.  This
742 includes all files that are locked by any user.  `C-u C-x v d' lists
743 all files in or beneath the current directory that are maintained with
744 version control.
745
746    The list of files is displayed as a buffer that uses an augmented
747 Dired mode.  The names of the users locking various files are shown (in
748 parentheses) in place of the owner and group.  All the normal Dired
749 commands work in this buffer.  Most interactive VC commands work also,
750 and apply to the file name on the current line.
751
752    The `C-x v v' command (`vc-next-action'), when used in the augmented
753 Dired buffer, operates on all the marked files (or the file on the
754 current line).  If it operates on more than one file, it handles each
755 file according to its current state; thus, it may check out one file
756 and check in another (because it is already checked out).  If it has to
757 check in any files, it reads a single log entry, then uses that text
758 for all the files being checked in.  This can be convenient for
759 registering or checking in several files at once, as part of the same
760 change.
761
762 \1f
763 File: xemacs.info,  Node: Renaming and VC,  Next: Snapshots,  Prev: VC Status,  Up: Version Control
764
765 Renaming VC Work Files and Master Files
766 ---------------------------------------
767
768    When you rename a registered file, you must also rename its master
769 file correspondingly to get proper results.  Use `vc-rename-file' to
770 rename the source file as you specify, and rename its master file
771 accordingly.  It also updates any snapshots (*note Snapshots::) that
772 mention the file, so that they use the new name; despite this, the
773 snapshot thus modified may not completely work (*note Snapshot
774 Caveats::).
775
776    You cannot use `vc-rename-file' on a file that is locked by someone
777 else.
778
779 \1f
780 File: xemacs.info,  Node: Snapshots,  Next: Version Headers,  Prev: Renaming and VC,  Up: Version Control
781
782 Snapshots
783 ---------
784
785    A "snapshot" is a named set of file versions (one for each
786 registered file) that you can treat as a unit.  One important kind of
787 snapshot is a "release", a (theoretically) stable version of the system
788 that is ready for distribution to users.
789
790 * Menu:
791
792 * Making Snapshots::            The snapshot facilities.
793 * Snapshot Caveats::            Things to be careful of when using snapshots.
794
795 \1f
796 File: xemacs.info,  Node: Making Snapshots,  Next: Snapshot Caveats,  Prev: Snapshots,  Up: Snapshots
797
798 Making and Using Snapshots
799 ..........................
800
801    There are two basic commands for snapshots; one makes a snapshot
802 with a given name, the other retrieves a named snapshot.
803
804 `C-x v s NAME <RET>'
805      Define the last saved versions of every registered file in or
806      under the current directory as a snapshot named NAME
807      (`vc-create-snapshot').
808
809 `C-x v r NAME <RET>'
810      Check out all registered files at or below the current directory
811      level using whatever versions correspond to the snapshot NAME
812      (`vc-retrieve-snapshot').
813
814      This command reports an error if any files are locked at or below
815      the current directory, without changing anything; this is to avoid
816      overwriting work in progress.
817
818    A snapshot uses a very small amount of resources--just enough to
819 record the list of file names and which version belongs to the
820 snapshot.  Thus, you need not hesitate to create snapshots whenever
821 they are useful.
822
823    You can give a snapshot name as an argument to `C-x v =' or `C-x v
824 ~' (*note Old Versions::).  Thus, you can use it to compare a snapshot
825 against the current files, or two snapshots against each other, or a
826 snapshot against a named version.
827
828 \1f
829 File: xemacs.info,  Node: Snapshot Caveats,  Prev: Making Snapshots,  Up: Snapshots
830
831 Snapshot Caveats
832 ................
833
834    VC's snapshot facilities are modeled on RCS's named-configuration
835 support.  They use RCS's native facilities for this, so under VC
836 snapshots made using RCS are visible even when you bypass VC.
837
838    For SCCS, VC implements snapshots itself.  The files it uses contain
839 name/file/version-number triples.  These snapshots are visible only
840 through VC.
841
842    A snapshot is a set of checked-in versions.  So make sure that all
843 the files are checked in and not locked when you make a snapshot.
844
845    File renaming and deletion can create some difficulties with
846 snapshots.  This is not a VC-specific problem, but a general design
847 issue in version control systems that no one has solved very well yet.
848
849    If you rename a registered file, you need to rename its master along
850 with it (the command `vc-rename-file' does this automatically).  If you
851 are using SCCS, you must also update the records of the snapshot, to
852 mention the file by its new name (`vc-rename-file' does this, too).  An
853 old snapshot that refers to a master file that no longer exists under
854 the recorded name is invalid; VC can no longer retrieve it.  It would
855 be beyond the scope of this manual to explain enough about RCS and SCCS
856 to explain how to update the snapshots by hand.
857
858    Using `vc-rename-file' makes the snapshot remain valid for
859 retrieval, but it does not solve all problems.  For example, some of the
860 files in the program probably refer to others by name.  At the very
861 least, the makefile probably mentions the file that you renamed.  If you
862 retrieve an old snapshot, the renamed file is retrieved under its new
863 name, which is not the name that the makefile expects.  So the program
864 won't really work as retrieved.
865
866 \1f
867 File: xemacs.info,  Node: Version Headers,  Prev: Snapshots,  Up: Version Control
868
869 Inserting Version Control Headers
870 ---------------------------------
871
872    Sometimes it is convenient to put version identification strings
873 directly into working files.  Certain special strings called "version
874 headers" are replaced in each successive version by the number of that
875 version.
876
877    You can use the `C-x v h' command (`vc-insert-headers') to insert a
878 suitable header string.
879
880 `C-x v h'
881      Insert headers in a file for use with your version-control system.
882
883    The default header string is `\$Id\$' for RCS and `\%W\%' for SCCS.
884 (The actual strings inserted do not have the backslashes in them.  They
885 were placed in the Info source file so that the strings don't get
886 interpreted as version-control headers when the Info source files are
887 maintained under version control.) You can specify other headers to
888 insert by setting the variable `vc-header-alist'.  Its value is a list
889 of elements of the form `(PROGRAM . STRING)' where PROGRAM is `RCS' or
890 `SCCS' and STRING is the string to use.
891
892    Instead of a single string, you can specify a list of strings; then
893 each string in the list is inserted as a separate header on a line of
894 its own.
895
896    It is often necessary to use "superfluous" backslashes when writing
897 the strings that you put in this variable.  This is to prevent the
898 string in the constant from being interpreted as a header itself if the
899 Emacs Lisp file containing it is maintained with version control.
900
901    Each header is inserted surrounded by tabs, inside comment
902 delimiters, on a new line at the start of the buffer.  Normally the
903 ordinary comment start and comment end strings of the current mode are
904 used, but for certain modes, there are special comment delimiters for
905 this purpose; the variable `vc-comment-alist' specifies them.  Each
906 element of this list has the form `(MODE STARTER ENDER)'.
907
908    The variable `vc-static-header-alist' specifies further strings to
909 add based on the name of the buffer.  Its value should be a list of
910 elements of the form `(REGEXP . FORMAT)'.  Whenever REGEXP matches the
911 buffer name, FORMAT is inserted as part of the header.  A header line
912 is inserted for each element that matches the buffer name, and for each
913 string specified by `vc-header-alist'.  The header line is made by
914 processing the string from `vc-header-alist' with the format taken from
915 the element.  The default value for `vc-static-header-alist' is:
916
917      (("\\.c$" .
918        "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
919      #endif /* lint */\n"))
920
921 which specifies insertion of a string of this form:
922
923
924      #ifndef lint
925      static char vcid[] = "STRING";
926      #endif /* lint */
927
928 \1f
929 File: xemacs.info,  Node: ListDir,  Next: Comparing Files,  Prev: Version Control,  Up: Files
930
931 Listing a File Directory
932 ========================
933
934    Files are organized by Unix into "directories".  A "directory
935 listing" is a list of all the files in a directory.  Emacs provides
936 directory listings in brief format (file names only) and verbose format
937 (sizes, dates, and authors included).
938
939 `C-x C-d DIR-OR-PATTERN'
940      Print a brief directory listing (`list-directory').
941
942 `C-u C-x C-d DIR-OR-PATTERN'
943      Print a verbose directory listing.
944
945    To print a directory listing, use `C-x C-d' (`list-directory').
946 This command prompts in the minibuffer for a file name which is either
947 a  directory to be listed or pattern containing wildcards for the files
948 to be listed.  For example,
949
950      C-x C-d /u2/emacs/etc <RET>
951
952 lists all the files in directory `/u2/emacs/etc'.  An example of
953 specifying a file name pattern is:
954
955      C-x C-d /u2/emacs/src/*.c <RET>
956
957    Normally, `C-x C-d' prints a brief directory listing containing just
958 file names.  A numeric argument (regardless of value) tells it to print
959 a verbose listing (like `ls -l').
960
961    Emacs obtains the text of a directory listing by running `ls' in an
962 inferior process.  Two Emacs variables control the switches passed to
963 `ls': `list-directory-brief-switches' is a string giving the switches
964 to use in brief listings (`"-CF"' by default).
965 `list-directory-verbose-switches' is a string giving the switches to
966 use in a verbose listing (`"-l"' by default).
967
968    The variable `directory-abbrev-alist' is an alist of abbreviations
969 for file directories.  The list consists of elements of the form `(FROM
970 .  TO)', each meaning to replace `FROM' with `TO' when it appears in a
971 directory name.  This replacement is done when setting up the default
972 directory of a newly visited file.  Every `FROM' string should start
973 with ``^''.
974
975    Use this feature when you have directories which you normally refer
976 to via absolute symbolic links.  Make `TO' the name of the link, and
977 `FROM' the name it is linked to.
978
979 \1f
980 File: xemacs.info,  Node: Comparing Files,  Next: Dired,  Prev: ListDir,  Up: Files
981
982 Comparing Files
983 ===============
984
985    The command `M-x diff' compares two files, displaying the
986 differences in an Emacs buffer named `*Diff*'.  It works by running the
987 `diff' program, using options taken from the variable `diff-switches',
988 whose value should be a string.
989
990    The buffer `*Diff*' has Compilation mode as its major mode, so you
991 can use `C-x `' to visit successive changed locations in the two source
992 files.  You can also move to a particular hunk of changes and type `C-c
993 C-c' to find the corresponding source location.  You can also use the
994 other special commands of Compilation mode: <SPC> and <DEL> for
995 scrolling, and `M-p' and `M-n' for cursor motion.  *Note Compilation::.
996
997    The command `M-x diff-backup' compares a specified file with its most
998 recent backup.  If you specify the name of a backup file, `diff-backup'
999 compares it with the source file that it is a backup of.
1000
1001    The command `M-x compare-windows' compares the text in the current
1002 window with that in the next window.  Comparison starts at point in each
1003 window.  Point moves forward in each window, a character at a time in
1004 each window, until the next characters in the two windows are
1005 different.  Then the command is finished.  For more information about
1006 windows in Emacs, *Note Windows::.
1007
1008    With a numeric argument, `compare-windows' ignores changes in
1009 whitespace.  If the variable `compare-ignore-case' is non-`nil', it
1010 ignores differences in case as well.
1011
1012 \1f
1013 File: xemacs.info,  Node: Dired,  Next: Misc File Ops,  Prev: Comparing Files,  Up: Files
1014
1015 Dired, the Directory Editor
1016 ===========================
1017
1018    Dired makes it easy to delete or visit many of the files in a single
1019 directory at once.  It creates an Emacs buffer containing a listing of
1020 the directory.  You can use the normal Emacs commands to move around in
1021 this buffer and special Dired commands to operate on the files.
1022
1023 * Menu:
1024
1025 * Enter: Dired Enter.         How to invoke Dired.
1026 * Edit: Dired Edit.           Editing the Dired buffer.
1027 * Deletion: Dired Deletion.   Deleting files with Dired.
1028 * Immed: Dired Immed.         Other file operations through Dired.
1029
1030 \1f
1031 File: xemacs.info,  Node: Dired Enter,  Next: Dired Edit,  Prev: Dired,  Up: Dired
1032
1033 Entering Dired
1034 --------------
1035
1036    To invoke dired, type `C-x d' or `M-x dired'.  The command reads a
1037 directory name or wildcard file name pattern as a minibuffer argument
1038 just like the `list-directory' command, `C-x C-d'.  Where `dired'
1039 differs from `list-directory' is in naming the buffer after the
1040 directory name or the wildcard pattern used for the listing, and putting
1041 the buffer into Dired mode so that the special commands of Dired are
1042 available in it.  The variable `dired-listing-switches' is a string
1043 used as an argument to `ls' in making the directory; this string must
1044 contain `-l'.
1045
1046    To display the Dired buffer in another window rather than in the
1047 selected window, use `C-x 4 d' (`dired-other-window)' instead of `C-x
1048 d'.
1049
1050 \1f
1051 File: xemacs.info,  Node: Dired Edit,  Next: Dired Deletion,  Prev: Dired Enter,  Up: Dired
1052
1053 Editing in Dired
1054 ----------------
1055
1056    Once the Dired buffer exists, you can switch freely between it and
1057 other Emacs buffers.  Whenever the Dired buffer is selected, certain
1058 special commands are provided that operate on files that are listed.
1059 The Dired buffer is "read-only", and inserting text in it is not
1060 useful, so ordinary printing characters such as `d' and `x' are used
1061 for Dired commands.  Most Dired commands operate on the file described
1062 by the line that point is on.  Some commands perform operations
1063 immediately; others "flag" a file to be operated on later.
1064
1065    Most Dired commands that operate on the current line's file also
1066 treat a numeric argument as a repeat count, meaning to act on the files
1067 of the next few lines.  A negative argument means to operate on the
1068 files of the preceding lines, and leave point on the first of those
1069 lines.
1070
1071    All the usual Emacs cursor motion commands are available in Dired
1072 buffers.  Some special purpose commands are also provided.  The keys
1073 `C-n' and `C-p' are redefined so that they try to position the cursor
1074 at the beginning of the filename on the line, rather than at the
1075 beginning of the line.
1076
1077    For extra convenience, <SPC> and `n' in Dired are equivalent to
1078 `C-n'.  `p' is equivalent to `C-p'.  Moving by lines is done so often
1079 in Dired that it deserves to be easy to type.  <DEL> (move up and
1080 unflag) is often useful simply for moving up.
1081
1082    The `g' command in Dired runs `revert-buffer' to reinitialize the
1083 buffer from the actual disk directory and show any changes made in the
1084 directory by programs other than Dired.  All deletion flags in the Dired
1085 buffer are lost when this is done.
1086