home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / emacs-19.000 / emacs-19 / usr / local / info / emacs-6 < prev    next >
Encoding:
GNU Info File  |  1995-09-11  |  48.6 KB  |  1,125 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.55 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: Transpose,  Next: Fixing Case,  Prev: Kill Errors,  Up: Fixit
  6.  
  7. Transposing Text
  8. ================
  9.  
  10. `C-t'
  11.      Transpose two characters (`transpose-chars').
  12.  
  13. `M-t'
  14.      Transpose two words (`transpose-words').
  15.  
  16. `C-M-t'
  17.      Transpose two balanced expressions (`transpose-sexps').
  18.  
  19. `C-x C-t'
  20.      Transpose two lines (`transpose-lines').
  21.  
  22.    The common error of transposing two characters can be fixed, when
  23. they are adjacent, with the `C-t' command (`transpose-chars').
  24. Normally, `C-t' transposes the two characters on either side of point.
  25. When given at the end of a line, rather than transposing the last
  26. character of the line with the newline, which would be useless, `C-t'
  27. transposes the last two characters on the line.  So, if you catch your
  28. transposition error right away, you can fix it with just a `C-t'.  If
  29. you don't catch it so fast, you must move the cursor back to between
  30. the two transposed characters.  If you transposed a space with the last
  31. character of the word before it, the word motion commands are a good
  32. way of getting there.  Otherwise, a reverse search (`C-r') is often the
  33. best way.  *Note Search::.
  34.  
  35.    `M-t' (`transpose-words') transposes the word before point with the
  36. word after point.  It moves point forward over a word, dragging the
  37. word preceding or containing point forward as well.  The punctuation
  38. characters between the words do not move.  For example, `FOO, BAR'
  39. transposes into `BAR, FOO' rather than `BAR FOO,'.
  40.  
  41.    `C-M-t' (`transpose-sexps') is a similar command for transposing two
  42. expressions (*note Lists::.), and `C-x C-t' (`transpose-lines')
  43. exchanges lines.  They work like `M-t' except in determining the
  44. division of the text into syntactic units.
  45.  
  46.    A numeric argument to a transpose command serves as a repeat count:
  47. it tells the transpose command to move the character (word, sexp, line)
  48. before or containing point across several other characters (words,
  49. sexps, lines).  For example, `C-u 3 C-t' moves the character before
  50. point forward across three other characters.  It would change
  51. `f-!-oobar' into `oobf-!-ar'.  This is equivalent to repeating `C-t'
  52. three times.  `C-u - 4 M-t' moves the word before point backward across
  53. four words.  `C-u - C-M-t' would cancel the effect of plain `C-M-t'.
  54.  
  55.    A numeric argument of zero is assigned a special meaning (because
  56. otherwise a command with a repeat count of zero would do nothing): to
  57. transpose the character (word, sexp, line) ending after point with the
  58. one ending after the mark.
  59.  
  60. 
  61. File: emacs,  Node: Fixing Case,  Next: Spelling,  Prev: Transpose,  Up: Fixit
  62.  
  63. Case Conversion
  64. ===============
  65.  
  66. `M-- M-l'
  67.      Convert last word to lower case.  Note `Meta--' is Meta-minus.
  68.  
  69. `M-- M-u'
  70.      Convert last word to all upper case.
  71.  
  72. `M-- M-c'
  73.      Convert last word to lower case with capital initial.
  74.  
  75.    A very common error is to type words in the wrong case.  Because of
  76. this, the word case-conversion commands `M-l', `M-u' and `M-c' have a
  77. special feature when used with a negative argument: they do not move the
  78. cursor.  As soon as you see you have mistyped the last word, you can
  79. simply case-convert it and go on typing.  *Note Case::.
  80.  
  81. 
  82. File: emacs,  Node: Spelling,  Prev: Fixing Case,  Up: Fixit
  83.  
  84. Checking and Correcting Spelling
  85. ================================
  86.  
  87.    This section describes the commands to check the spelling of a single
  88. word or of a portion of a buffer.  These commands work with the spelling
  89. checker program Ispell, which is not part of Emacs.  *Note Ispell: (The
  90. Ispell Manual)Top.
  91.  
  92. `M-$'
  93.      Check and correct spelling of word at point (`ispell-word').
  94.  
  95. `M-TAB'
  96.      Complete the word before point based on the spelling dictionary
  97.      (`ispell-complete-word').
  98.  
  99. `M-x ispell-buffer'
  100.      Check and correct spelling of each word in the buffer.
  101.  
  102. `M-x ispell-region'
  103.      Check and correct spelling of each word in the region.
  104.  
  105. `M-x ispell-message'
  106.      Check and correct spelling of each word in a draft mail message,
  107.      excluding cited material.
  108.  
  109. `M-x ispell-change-dictionary RET DICT RET'
  110.      Restart the ispell process, using DICT as the dictionary.
  111.  
  112. `M-x ispell-kill-ispell'
  113.      Kill the Ispell subprocess.
  114.  
  115.    To check the spelling of the word around or next to point, and
  116. optionally correct it as well, use the command `M-$' (`ispell-word').
  117. If the word is not correct, the command offers you various alternatives
  118. for what to do about it.
  119.  
  120.    To check the entire current buffer, use `M-x ispell-buffer'.  Use
  121. `M-x ispell-region' to check just the current region.  To check
  122. spelling in an email message you are writing, use `M-x ispell-message';
  123. that checks the whole buffer, but does not check material that is
  124. indented or appears to be cited from other messages.
  125.  
  126.    Each time these commands encounter an incorrect word, they ask you
  127. what to do.  It displays a list of alternatives, usually including
  128. several "near-misses"--words that are close to the word being checked.
  129. Then you must type a character.  Here are the valid responses:
  130.  
  131. `SPC'
  132.      Skip this word--continue to consider it incorrect, but don't
  133.      change it here.
  134.  
  135. `r NEW RET'
  136.      Replace the word (just this time) with NEW.
  137.  
  138. `R NEW RET'
  139.      Replace the word with NEW, and do a `query-replace' so you can
  140.      replace it elsewhere in the buffer if you wish.
  141.  
  142. `DIGIT'
  143.      Replace the word (just this time) with one of the displayed
  144.      near-misses.  Each near-miss is listed with a digit; type that
  145.      digit to select it.
  146.  
  147. `a'
  148.      Accept the incorrect word--treat it as correct, but only in this
  149.      editing session.
  150.  
  151. `A'
  152.      Accept the incorrect word--treat it as correct, but only in this
  153.      editing session and for this buffer.
  154.  
  155. `i'
  156.      Insert this word in your private dictionary file so that Ispell
  157.      will consider it correct it from now on, even in future sessions.
  158.  
  159. `u'
  160.      Insert a lower-case version of this word in your private dictionary
  161.      file.
  162.  
  163. `m'
  164.      Like `i', but you can also specify dictionary completion
  165.      information.
  166.  
  167. `l WORD RET'
  168.      Look in the dictionary for words that match WORD.  These words
  169.      become the new list of "near-misses"; you can select one of them to
  170.      replace with by typing a digit.  You can use `*' in WORD as a
  171.      wildcard.
  172.  
  173. `C-g'
  174.      Quit interactive spell checking.  You can restart it again
  175.      afterward with `C-u M-$'.
  176.  
  177. `X'
  178.      Same as `C-g'.
  179.  
  180. `x'
  181.      Quit interactive spell checking and move point back to where it was
  182.      when you started spell checking.
  183.  
  184. `q'
  185.      Quit interactive spell checking and kill the Ispell subprocess.
  186.  
  187. `C-l'
  188.      Refresh the screen.
  189.  
  190. `C-z'
  191.      This key has its normal command meaning (suspend Emacs or iconify
  192.      this frame).
  193.  
  194.    The command `ispell-complete-word', which is bound to the key
  195. `M-TAB' in Text mode and related modes, shows a list of completions
  196. based on spelling correction.  Insert the beginning of a word, and then
  197. type `M-TAB'; the command displays a completion list window.  To choose
  198. one of the completions listed, click `Mouse-2' on it, or move the
  199. cursor there in the completions window and type RET.  *Note Text Mode::.
  200.  
  201.    Once started, the Ispell subprocess continues to run (waiting for
  202. something to do), so that subsequent spell checking commands complete
  203. more quickly.  If you want to get rid of the Ispell process, use `M-x
  204. ispell-kill-ispell'.  This is not usually necessary, since the process
  205. uses no time except when you do spelling correction.
  206.  
  207.    Ispell uses two dictionaries: the standard dictionary and your
  208. private dictionary.  The variable `ispell-dictionary' specifies the file
  209. name of the standard dictionary to use.  A value of `nil' says to use
  210. the default dictionary.  The command `M-x ispell-change-dictionary'
  211. sets this variable and then restarts the Ispell subprocess, so that it
  212. will use a different dictionary.
  213.  
  214. 
  215. File: emacs,  Node: Files,  Next: Buffers,  Prev: Fixit,  Up: Top
  216.  
  217. File Handling
  218. *************
  219.  
  220.    The operating system stores data permanently in named "files".  So
  221. most of the text you edit with Emacs comes from a file and is ultimately
  222. stored in a file.
  223.  
  224.    To edit a file, you must tell Emacs to read the file and prepare a
  225. buffer containing a copy of the file's text.  This is called "visiting"
  226. the file.  Editing commands apply directly to text in the buffer; that
  227. is, to the copy inside Emacs.  Your changes appear in the file itself
  228. only when you "save" the buffer back into the file.
  229.  
  230.    In addition to visiting and saving files, Emacs can delete, copy,
  231. rename, and append to files, keep multiple versions of them, and operate
  232. on file directories.
  233.  
  234. * Menu:
  235.  
  236. * File Names::       How to type and edit file name arguments.
  237. * Visiting::         Visiting a file prepares Emacs to edit the file.
  238. * Saving::           Saving makes your changes permanent.
  239. * Reverting::        Reverting cancels all the changes not saved.
  240. * Auto Save::        Auto Save periodically protects against loss of data.
  241. * File Aliases::     Handling multiple names for one file.
  242. * Version Control::  Version control systems (RCS, CVS and SCCS).
  243. * Directories::      Creating, deleting and listing file directories.
  244. * Comparing Files::  Finding where two files differ.
  245. * Misc File Ops::    Other things you can do on files.
  246.  
  247. 
  248. File: emacs,  Node: File Names,  Next: Visiting,  Up: Files
  249.  
  250. File Names
  251. ==========
  252.  
  253.    Most Emacs commands that operate on a file require you to specify the
  254. file name.  (Saving and reverting are exceptions; the buffer knows which
  255. file name to use for them.)  You enter the file name using the
  256. minibuffer (*note Minibuffer::.).  "Completion" is available, to make
  257. it easier to specify long file names.  *Note Completion::.
  258.  
  259.    For most operations, there is a "default file name" which is used if
  260. you type just RET to enter an empty argument.  Normally the default
  261. file name is the name of the file visited in the current buffer; this
  262. makes it easy to operate on that file with any of the Emacs file
  263. commands.
  264.  
  265.    Each buffer has a default directory, normally the same as the
  266. directory of the file visited in that buffer.  When you enter a file
  267. name without a directory, the default directory is used.  If you specify
  268. a directory in a relative fashion, with a name that does not start with
  269. a slash, it is interpreted with respect to the default directory.  The
  270. default directory is kept in the variable `default-directory', which
  271. has a separate value in every buffer.
  272.  
  273.    For example, if the default file name is `/u/rms/gnu/gnu.tasks' then
  274. the default directory is `/u/rms/gnu/'.  If you type just `foo', which
  275. does not specify a directory, it is short for `/u/rms/gnu/foo'.
  276. `../.login' would stand for `/u/rms/.login'.  `new/foo' would stand for
  277. the file name `/u/rms/gnu/new/foo'.
  278.  
  279.    The command `M-x pwd' prints the current buffer's default directory,
  280. and the command `M-x cd' sets it (to a value read using the
  281. minibuffer).  A buffer's default directory changes only when the `cd'
  282. command is used.  A file-visiting buffer's default directory is
  283. initialized to the directory of the file that is visited there.  If you
  284. create a buffer with `C-x b', its default directory is copied from that
  285. of the buffer that was current at the time.
  286.  
  287.    The default directory actually appears in the minibuffer when the
  288. minibuffer becomes active to read a file name.  This serves two
  289. purposes: it *shows* you what the default is, so that you can type a
  290. relative file name and know with certainty what it will mean, and it
  291. allows you to *edit* the default to specify a different directory.
  292. This insertion of the default directory is inhibited if the variable
  293. `insert-default-directory' is set to `nil'.
  294.  
  295.    Note that it is legitimate to type an absolute file name after you
  296. enter the minibuffer, ignoring the presence of the default directory
  297. name as part of the text.  The final minibuffer contents may look
  298. invalid, but that is not so.  For example, if the minibuffer starts out
  299. with `/usr/tmp/' and you add `/x1/rms/foo', you get
  300. `/usr/tmp//x1/rms/foo'; but Emacs ignores everything through the first
  301. slash in the double slash; the result is `/x1/rms/foo'.  *Note
  302. Minibuffer File::.
  303.  
  304.    You can refer to files on other machines using a special file name
  305. syntax:
  306.  
  307.      /HOST:FILENAME
  308.      /USER@HOST:FILENAME
  309.  
  310. When you do this, Emacs uses the FTP program to read and write files on
  311. the specified host.  It logs in through FTP using your user name or the
  312. name USER.  It may ask you for a password from time to time; this is
  313. used for logging in on HOST.
  314.  
  315.    You can turn off the FTP file name feature by setting the variable
  316. `file-name-handler-alist' to `nil'.
  317.  
  318.    `$' in a file name is used to substitute environment variables.  For
  319. example, if you have used the shell command `export FOO=rms/hacks' to
  320. set up an environment variable named `FOO', then you can use
  321. `/u/$FOO/test.c' or `/u/${FOO}/test.c' as an abbreviation for
  322. `/u/rms/hacks/test.c'.  The environment variable name consists of all
  323. the alphanumeric characters after the `$'; alternatively, it may be
  324. enclosed in braces after the `$'.  Note that shell commands to set
  325. environment variables affect Emacs only if done before Emacs is started.
  326.  
  327.    To access a file with `$' in its name, type `$$'.  This pair is
  328. converted to a single `$' at the same time as variable substitution is
  329. performed for single `$'.  The Lisp function that performs the
  330. substitution is called `substitute-in-file-name'.  The substitution is
  331. performed only on file names read as such using the minibuffer.
  332.  
  333. 
  334. File: emacs,  Node: Visiting,  Next: Saving,  Prev: File Names,  Up: Files
  335.  
  336. Visiting Files
  337. ==============
  338.  
  339. `C-x C-f'
  340.      Visit a file (`find-file').
  341.  
  342. `C-x C-r'
  343.      Visit a file for viewing, without allowing changes to it
  344.      (`find-file-read-only').
  345.  
  346. `C-x C-v'
  347.      Visit a different file instead of the one visited last
  348.      (`find-alternate-file').
  349.  
  350. `C-x 4 C-f'
  351.      Visit a file, in another window (`find-file-other-window').  Don't
  352.      change the selected window.
  353.  
  354. `C-x 5 C-f'
  355.      Visit a file, in a new frame (`find-file-other-frame').  Don't
  356.      change the selected frame.
  357.  
  358.    "Visiting" a file means copying its contents into an Emacs buffer so
  359. you can edit them.  Emacs makes a new buffer for each file that you
  360. visit.  We say that this buffer is visiting the file that it was created
  361. to hold.  Emacs constructs the buffer name from the file name by
  362. throwing away the directory, keeping just the name proper.  For example,
  363. a file named `/usr/rms/emacs.tex' would get a buffer named `emacs.tex'.
  364. If there is already a buffer with that name, a unique name is
  365. constructed by appending `<2>', `<3>', or so on, using the lowest
  366. number that makes a name that is not already in use.
  367.  
  368.    Each window's mode line shows the name of the buffer that is being
  369. displayed in that window, so you can always tell what buffer you are
  370. editing.
  371.  
  372.    The changes you make with editing commands are made in the Emacs
  373. buffer.  They do not take effect in the file that you visited, or any
  374. place permanent, until you "save" the buffer.  Saving the buffer means
  375. that Emacs writes the current contents of the buffer into its visited
  376. file.  *Note Saving::.
  377.  
  378.    If a buffer contains changes that have not been saved, we say the
  379. buffer is "modified".  This is important because it implies that some
  380. changes will be lost if the buffer is not saved.  The mode line
  381. displays two stars near the left margin to indicate that the buffer is
  382. modified.
  383.  
  384.    To visit a file, use the command `C-x C-f' (`find-file').  Follow
  385. the command with the name of the file you wish to visit, terminated by a
  386. RET.
  387.  
  388.    The file name is read using the minibuffer (*note Minibuffer::.),
  389. with defaulting and completion in the standard manner (*note File
  390. Names::.).  While in the minibuffer, you can abort `C-x C-f' by typing
  391. `C-g'.
  392.  
  393.    Your confirmation that `C-x C-f' has completed successfully is the
  394. appearance of new text on the screen and a new buffer name in the mode
  395. line.  If the specified file does not exist and could not be created, or
  396. cannot be read, then you get an error, with an error message displayed
  397. in the echo area.
  398.  
  399.    If you visit a file that is already in Emacs, `C-x C-f' does not make
  400. another copy.  It selects the existing buffer containing that file.
  401. However, before doing so, it checks that the file itself has not changed
  402. since you visited or saved it last.  If the file has changed, a warning
  403. message is printed.  *Note Simultaneous Editing: Interlocking.
  404.  
  405.    What if you want to create a new file?  Just visit it.  Emacs prints
  406. `(New File)' in the echo area, but in other respects behaves as if you
  407. had visited an existing empty file.  If you make any changes and save
  408. them, the file is created.
  409.  
  410.    If the file you specify is actually a directory, `C-x C-f' invokes
  411. Dired, the Emacs directory browser so that you can "edit" the contents
  412. of the directory (*note Dired::.).  Dired is a convenient way to delete,
  413. look at, or operate on the files in the directory.  However, if the
  414. variable `find-file-run-dired' is `nil', then it is an error to try to
  415. visit a directory.
  416.  
  417.    If you visit a file that the operating system won't let you modify,
  418. Emacs makes the buffer read-only, so that you won't go ahead and make
  419. changes that you'll have trouble saving afterward.  You can make the
  420. buffer writable with `C-x C-q' (`vc-toggle-read-only').  *Note Misc
  421. Buffer::.
  422.  
  423.    Occasionally you might want to visit a file as read-only in order to
  424. protect yourself from entering changes accidentally; do so by visiting
  425. the file with the command `C-x C-r' (`find-file-read-only').
  426.  
  427.    If you visit a nonexistent file unintentionally (because you typed
  428. the wrong file name), use the `C-x C-v' command (`find-alternate-file')
  429. to visit the file you really wanted.  `C-x C-v' is similar to `C-x
  430. C-f', but it kills the current buffer (after first offering to save it
  431. if it is modified).  When it reads the file name to visit, it inserts
  432. the entire default file name in the buffer, with point just after the
  433. directory part; this is convenient if you made a slight error in typing
  434. the name.
  435.  
  436.    `C-x 4 f' (`find-file-other-window') is like `C-x C-f' except that
  437. the buffer containing the specified file is selected in another window.
  438. The window that was selected before `C-x 4 f' continues to show the
  439. same buffer it was already showing.  If this command is used when only
  440. one window is being displayed, that window is split in two, with one
  441. window showing the same buffer as before, and the other one showing the
  442. newly requested file.  *Note Windows::.
  443.  
  444.    `C-x 5 f' (`find-file-other-frame') is similar, but opens a new
  445. frame, or makes visible any existing frame showing the file you seek.
  446. This feature is available only when you are using a window system.
  447. *Note Frames::.
  448.  
  449.    Two special hook variables allow extensions to modify the operation
  450. of visiting files.  Visiting a file that does not exist runs the
  451. functions in the list `find-file-not-found-hooks'; this variable holds
  452. a list of functions, and the functions are called one by one until one
  453. of them returns non-`nil'.  Any visiting of a file, whether extant or
  454. not, expects `find-file-hooks' to contain a list of functions and calls
  455. them all, one by one.  In both cases the functions receive no
  456. arguments.  Of these two variables, `find-file-not-found-hooks' takes
  457. effect first.  These variables are *not* normal hooks, and their names
  458. end in `-hooks' rather than `-hook' to indicate that fact.  *Note
  459. Hooks::.
  460.  
  461.    There are several ways to specify automatically the major mode for
  462. editing the file (*note Choosing Modes::.), and to specify local
  463. variables defined for that file (*note File Variables::.).
  464.  
  465. 
  466. File: emacs,  Node: Saving,  Next: Reverting,  Prev: Visiting,  Up: Files
  467.  
  468. Saving Files
  469. ============
  470.  
  471.    "Saving" a buffer in Emacs means writing its contents back into the
  472. file that was visited in the buffer.
  473.  
  474. `C-x C-s'
  475.      Save the current buffer in its visited file (`save-buffer').
  476.  
  477. `C-x s'
  478.      Save any or all buffers in their visited files
  479.      (`save-some-buffers').
  480.  
  481. `M-~'
  482.      Forget that the current buffer has been changed (`not-modified').
  483.  
  484. `C-x C-w'
  485.      Save the current buffer in a specified file (`write-file').
  486.  
  487. `M-x set-visited-file-name'
  488.      Change file the name under which the current buffer will be saved.
  489.  
  490.    When you wish to save the file and make your changes permanent, type
  491. `C-x C-s' (`save-buffer').  After saving is finished, `C-x C-s'
  492. displays a message like this:
  493.  
  494.      Wrote /u/rms/gnu/gnu.tasks
  495.  
  496. If the selected buffer is not modified (no changes have been made in it
  497. since the buffer was created or last saved), saving is not really done,
  498. because it would have no effect.  Instead, `C-x C-s' displays a message
  499. like this in the echo area:
  500.  
  501.      (No changes need to be written)
  502.  
  503.    The command `C-x s' (`save-some-buffers') offers to save any or all
  504. modified buffers.  It asks you what to do with each buffer.  The
  505. possible responses are analogous to those of `query-replace':
  506.  
  507. `y'
  508.      Save this buffer and ask about the rest of the buffers.
  509.  
  510. `n'
  511.      Don't save this buffer, but ask about the rest of the buffers.
  512.  
  513. `!'
  514.      Save this buffer and all the rest with no more questions.
  515.  
  516. `RET'
  517.      Terminate `save-some-buffers' without any more saving.
  518.  
  519. `.'
  520.      Save this buffer, then exit `save-some-buffers' without even asking
  521.      about other buffers.
  522.  
  523. `C-r'
  524.      View the buffer that you are currently being asked about.  When
  525.      you exit View mode, you get back to `save-some-buffers', which
  526.      asks the question again.
  527.  
  528. `C-h'
  529.      Display a help message about these options.
  530.  
  531.    `C-x C-c', the key sequence to exit Emacs, invokes
  532. `save-some-buffers' and therefore asks the same questions.
  533.  
  534.    If you have changed a buffer but you do not want to save the changes,
  535. you should take some action to prevent it.  Otherwise, each time you use
  536. `C-x s' or `C-x C-c', you are liable to save this buffer by mistake.
  537. One thing you can do is type `M-~' (`not-modified'), which clears out
  538. the indication that the buffer is modified.  If you do this, none of
  539. the save commands will believe that the buffer needs to be saved.  (`~'
  540. is often used as a mathematical symbol for `not'; thus `M-~' is `not',
  541. metafied.)  You could also use `set-visited-file-name' (see below) to
  542. mark the buffer as visiting a different file name, one which is not in
  543. use for anything important.  Alternatively, you can cancel all the
  544. changes made since the file was visited or saved, by reading the text
  545. from the file again.  This is called "reverting".  *Note Reverting::.
  546. You could also undo all the changes by repeating the undo command `C-x
  547. u' until you have undone all the changes; but reverting is easier.
  548.  
  549.    `M-x set-visited-file-name' alters the name of the file that the
  550. current buffer is visiting.  It reads the new file name using the
  551. minibuffer.  Then it specifies the visited file name and changes the
  552. buffer name correspondingly (as long as the new name is not in use).
  553. `set-visited-file-name' does not save the buffer in the newly visited
  554. file; it just alters the records inside Emacs in case you do save
  555. later.  It also marks the buffer as "modified" so that `C-x C-s' in
  556. that buffer *will* save.
  557.  
  558.    If you wish to mark the buffer as visiting a different file and save
  559. it right away, use `C-x C-w' (`write-file').  It is precisely
  560. equivalent to `set-visited-file-name' followed by `C-x C-s'.  `C-x C-s'
  561. used on a buffer that is not visiting with a file has the same effect
  562. as `C-x C-w'; that is, it reads a file name, marks the buffer as
  563. visiting that file, and saves it there.  The default file name in a
  564. buffer that is not visiting a file is made by combining the buffer name
  565. with the buffer's default directory.
  566.  
  567.    If Emacs is about to save a file and sees that the date of the latest
  568. version on disk does not match what Emacs last read or wrote, Emacs
  569. notifies you of this fact, because it probably indicates a problem
  570. caused by simultaneous editing and requires your immediate attention.
  571. *Note Simultaneous Editing: Interlocking.
  572.  
  573.    If the variable `require-final-newline' is non-`nil', Emacs puts a
  574. newline at the end of any file that doesn't already end in one, every
  575. time a file is saved or written.
  576.  
  577. * Menu:
  578.  
  579. * Backup::        How Emacs saves the old version of your file.
  580. * Interlocking::  How Emacs protects against simultaneous editing
  581.                     of one file by two users.
  582.  
  583. 
  584. File: emacs,  Node: Backup,  Next: Interlocking,  Up: Saving
  585.  
  586. Backup Files
  587. ------------
  588.  
  589.    On most operating systems, rewriting a file automatically destroys
  590. all record of what the file used to contain.  Thus, saving a file from
  591. Emacs throws away the old contents of the file--or it would, except that
  592. Emacs carefully copies the old contents to another file, called the
  593. "backup" file, before actually saving.  (This assumes that the variable
  594. `make-backup-files' is non-`nil'.  Backup files are not written if this
  595. variable is `nil'.)
  596.  
  597.    At your option, Emacs can keep either a single backup file or a
  598. series of numbered backup files for each file that you edit.
  599.  
  600.    Emacs makes a backup for a file only the first time the file is saved
  601. from one buffer.  No matter how many times you save a file, its backup
  602. file continues to contain the contents from before the file was visited.
  603. Normally this means that the backup file contains the contents from
  604. before the current editing session; however, if you kill the buffer and
  605. then visit the file again, a new backup file will be made by the next
  606. save.
  607.  
  608. * Menu:
  609.  
  610. * Names: Backup Names.        How backup files are named;
  611.                   choosing single or numbered backup files.
  612. * Deletion: Backup Deletion.    Emacs deletes excess numbered backups.
  613. * Copying: Backup Copying.    Backups can be made by copying or renaming.
  614.  
  615. 
  616. File: emacs,  Node: Backup Names,  Next: Backup Deletion,  Up: Backup
  617.  
  618. Single or Numbered Backups
  619. ..........................
  620.  
  621.    If you choose to have a single backup file (this is the default),
  622. the backup file's name is constructed by appending `~' to the file name
  623. being edited; thus, the backup file for `eval.c' would be `eval.c~'.
  624.  
  625.    If you choose to have a series of numbered backup files, backup file
  626. names are made by appending `.~', the number, and another `~' to the
  627. original file name.  Thus, the backup files of `eval.c' would be called
  628. `eval.c.~1~', `eval.c.~2~', and so on, through names like
  629. `eval.c.~259~' and beyond.
  630.  
  631.    If protection stops you from writing backup files under the usual
  632. names, the backup file is written as `%backup%~' in your home directory.
  633. Only one such file can exist, so only the most recently made such
  634. backup is available.
  635.  
  636.    The choice of single backup or numbered backups is controlled by the
  637. variable `version-control'.  Its possible values are
  638.  
  639. `t'
  640.      Make numbered backups.
  641.  
  642. `nil'
  643.      Make numbered backups for files that have numbered backups already.
  644.      Otherwise, make single backups.
  645.  
  646. `never'
  647.      Do not in any case make numbered backups; always make single
  648.      backups.
  649.  
  650. You can set `version-control' locally in an individual buffer to
  651. control the making of backups for that buffer's file.  For example,
  652. Rmail mode locally sets `version-control' to `never' to make sure that
  653. there is only one backup for an Rmail file.  *Note Locals::.
  654.  
  655.    If you set the environment variable `VERSION_CONTROL', to tell
  656. various GNU utilities what to do with backup files, Emacs also obeys the
  657. environment variable by setting the Lisp variable `version-control'
  658. accordingly at startup.  If the environment variable's value is `t' or
  659. `numbered', then `version-control' becomes `t'; if the value is `nil'
  660. or `existing', then `version-control' becomes `nil'; if it is `never'
  661. or `simple', then `version-control' becomes `never'.
  662.  
  663.    For files under version control (*note Version Control::.), the
  664. variable `vc-make-backup-files' determines whether to make backup
  665. files.  By default, it is `nil', since backup files are redundant when
  666. you store all the previous versions in a version control system.  *Note
  667. Editing with VC::.
  668.  
  669. 
  670. File: emacs,  Node: Backup Deletion,  Next: Backup Copying,  Prev: Backup Names,  Up: Backup
  671.  
  672. Automatic Deletion of Backups
  673. .............................
  674.  
  675.    To prevent unlimited consumption of disk space, Emacs can delete
  676. numbered backup versions automatically.  Generally Emacs keeps the
  677. first few backups and the latest few backups, deleting any in between.
  678. This happens every time a new backup is made.
  679.  
  680.    The two variables `kept-old-versions' and `kept-new-versions'
  681. control this deletion.  Their values are, respectively the number of
  682. oldest (lowest-numbered) backups to keep and the number of newest
  683. (highest-numbered) ones to keep, each time a new backup is made.
  684. Recall that these values are used just after a new backup version is
  685. made; that newly made backup is included in the count in
  686. `kept-new-versions'.  By default, both variables are 2.
  687.  
  688.    If `delete-old-versions' is non-`nil', the excess middle versions
  689. are deleted without a murmur.  If it is `nil', the default, then you
  690. are asked whether the excess middle versions should really be deleted.
  691.  
  692.    Dired's `.' (Period) command can also be used to delete old versions.
  693. *Note Dired Deletion::.
  694.  
  695. 
  696. File: emacs,  Node: Backup Copying,  Prev: Backup Deletion,  Up: Backup
  697.  
  698. Copying vs. Renaming
  699. ....................
  700.  
  701.    Backup files can be made by copying the old file or by renaming it.
  702. This makes a difference when the old file has multiple names.  If the
  703. old file is renamed into the backup file, then the alternate names
  704. become names for the backup file.  If the old file is copied instead,
  705. then the alternate names remain names for the file that you are
  706. editing, and the contents accessed by those names will be the new
  707. contents.
  708.  
  709.    The method of making a backup file may also affect the file's owner
  710. and group.  If copying is used, these do not change.  If renaming is
  711. used, you become the file's owner, and the file's group becomes the
  712. default (different operating systems have different defaults for the
  713. group).
  714.  
  715.    Having the owner change is usually a good idea, because then the
  716. owner always shows who last edited the file.  Also, the owners of the
  717. backups show who produced those versions.  Occasionally there is a file
  718. whose owner should not change; it is a good idea for such files to
  719. contain local variable lists to set `backup-by-copying-when-mismatch'
  720. locally (*note File Variables::.).
  721.  
  722.    The choice of renaming or copying is controlled by three variables.
  723. Renaming is the default choice.  If the variable `backup-by-copying' is
  724. non-`nil', copying is used.  Otherwise, if the variable
  725. `backup-by-copying-when-linked' is non-`nil', then copying is used for
  726. files that have multiple names, but renaming may still used when the
  727. file being edited has only one name.  If the variable
  728. `backup-by-copying-when-mismatch' is non-`nil', then copying is used if
  729. renaming would cause the file's owner or group to change.
  730.  
  731. 
  732. File: emacs,  Node: Interlocking,  Prev: Backup,  Up: Saving
  733.  
  734. Protection against Simultaneous Editing
  735. ---------------------------------------
  736.  
  737.    Simultaneous editing occurs when two users visit the same file, both
  738. make changes, and then both save them.  If nobody were informed that
  739. this was happening, whichever user saved first would later find that his
  740. changes were lost.  On some systems, Emacs notices immediately when the
  741. second user starts to change the file, and issues an immediate warning.
  742.  
  743.    For the sake of systems where that is not possible, and in case
  744. someone else proceeds to change the file despite the warning, Emacs also
  745. checks when the file is saved, and issues a second warning if you are
  746. about to overwrite a file containing another user's changes.  You can
  747. prevent loss of the other user's work by taking the proper corrective
  748. action at that time.
  749.  
  750.    When you make the first modification in an Emacs buffer that is
  751. visiting a file, Emacs records that  the file is "locked" by you.  (It
  752. does this by writing another file in a directory reserved for this
  753. purpose.)  The lock is removed when you save the changes.  The idea is
  754. that the file is locked whenever an Emacs buffer visiting it has
  755. unsaved changes.
  756.  
  757.    If you begin to modify the buffer while the visited file is locked by
  758. someone else, this constitutes a "collision".  When Emacs detects a
  759. collision, it asks you what to do, by calling the Lisp function
  760. `ask-user-about-lock'.  You can redefine this function for the sake of
  761. customization.  The standard definition of this function asks you a
  762. question and accepts three possible answers:
  763.  
  764. `s'
  765.      Steal the lock.  Whoever was already changing the file loses the
  766.      lock, and you gain the lock.
  767.  
  768. `p'
  769.      Proceed.  Go ahead and edit the file despite its being locked by
  770.      someone else.
  771.  
  772. `q'
  773.      Quit.  This causes an error (`file-locked') and the modification
  774.      you were trying to make in the buffer does not actually take place.
  775.  
  776.    Note that locking works on the basis of a file name; if a file has
  777. multiple names, Emacs does not realize that the two names are the same
  778. file and cannot prevent two users from editing it simultaneously under
  779. different names.  However, basing locking on names means that Emacs can
  780. interlock the editing of new files that will not really exist until
  781. they are saved.
  782.  
  783.    Some systems are not configured to allow Emacs to make locks.  On
  784. these systems, Emacs cannot detect trouble in advance, but it still can
  785. detect the collision when you try to save a file and overwrite someone
  786. else's changes.
  787.  
  788.    Every time Emacs saves a buffer, it first checks the
  789. last-modification date of the existing file on disk to verify that it
  790. has not changed since the file was last visited or saved.  If the date
  791. does not match, it implies that changes were made in the file in some
  792. other way, and these changes are about to be lost if Emacs actually
  793. does save.  To prevent this, Emacs prints a warning message and asks
  794. for confirmation before saving.  Occasionally you will know why the
  795. file was changed and know that it does not matter; then you can answer
  796. `yes' and proceed.  Otherwise, you should cancel the save with `C-g'
  797. and investigate the situation.
  798.  
  799.    The first thing you should do when notified that simultaneous editing
  800. has already taken place is to list the directory with `C-u C-x C-d'
  801. (*note Directories::.).  This shows the file's current author.  You
  802. should attempt to contact him to warn him not to continue editing.
  803. Often the next step is to save the contents of your Emacs buffer under a
  804. different name, and use `diff' to compare the two files.
  805.  
  806.    Simultaneous editing checks are also made when you visit with `C-x
  807. C-f' a file that is already visited and when you start to modify a
  808. file.  This is not strictly necessary, but it can cause you to find out
  809. about the collision earlier, when perhaps correction takes less work.
  810.  
  811. 
  812. File: emacs,  Node: Reverting,  Next: Auto Save,  Prev: Saving,  Up: Files
  813.  
  814. Reverting a Buffer
  815. ==================
  816.  
  817.    If you have made extensive changes to a file and then change your
  818. mind about them, you can get rid of them by reading in the previous
  819. version of the file.  To do this, use `M-x revert-buffer', which
  820. operates on the current buffer.  Since reverting a buffer
  821. unintentionally could lose a lot of work, you must confirm this command
  822. with `yes'.
  823.  
  824.    `revert-buffer' keeps point at the same distance (measured in
  825. characters) from the beginning of the file.  If the file was edited only
  826. slightly, you will be at approximately the same piece of text after
  827. reverting as before.  If you have made drastic changes, the same value
  828. of point in the old file may address a totally different piece of text.
  829.  
  830.    Reverting marks the buffer as "not modified" until another change is
  831. made.
  832.  
  833.    Some kinds of buffers whose contents reflect data bases other than
  834. files, such as Dired buffers, can also be reverted.  For them,
  835. reverting means recalculating their contents from the appropriate data
  836. base.  Buffers created randomly with `C-x b' cannot be reverted;
  837. `revert-buffer' reports an error when asked to do so.
  838.  
  839. 
  840. File: emacs,  Node: Auto Save,  Next: File Aliases,  Prev: Reverting,  Up: Files
  841.  
  842. Auto-Saving: Protection Against Disasters
  843. =========================================
  844.  
  845.    Emacs saves all the visited files from time to time (based on
  846. counting your keystrokes) without being asked.  This is called
  847. "auto-saving".  It prevents you from losing more than a limited amount
  848. of work if the system crashes.
  849.  
  850.    When Emacs determines that it is time for auto-saving, each buffer is
  851. considered, and is auto-saved if auto-saving is turned on for it and it
  852. has been changed since the last time it was auto-saved.  The message
  853. `Auto-saving...' is displayed in the echo area during auto-saving, if
  854. any files are actually auto-saved.  Errors occurring during auto-saving
  855. are caught so that they do not interfere with the execution of commands
  856. you have been typing.
  857.  
  858. * Menu:
  859.  
  860. * Files: Auto Save Files.       The file where auto-saved changes are
  861.                                   actually made until you save the file.
  862. * Control: Auto Save Control.   Controlling when and how often to auto-save.
  863. * Recover::                Recovering text from auto-save files.
  864.  
  865. 
  866. File: emacs,  Node: Auto Save Files,  Next: Auto Save Control,  Up: Auto Save
  867.  
  868. Auto-Save Files
  869. ---------------
  870.  
  871.    Auto-saving does not normally save in the files that you visited,
  872. because it can be very undesirable to save a program that is in an
  873. inconsistent state when you have made half of a planned change.
  874. Instead, auto-saving is done in a different file called the "auto-save
  875. file", and the visited file is changed only when you request saving
  876. explicitly (such as with `C-x C-s').
  877.  
  878.    Normally, the auto-save file name is made by appending `#' to the
  879. front and rear of the visited file name.  Thus, a buffer visiting file
  880. `foo.c' is auto-saved in a file `#foo.c#'.  Most buffers that are not
  881. visiting files are auto-saved only if you request it explicitly; when
  882. they are auto-saved, the auto-save file name is made by appending `#%'
  883. to the front and `#' to the rear of buffer name.  For example, the
  884. `*mail*' buffer in which you compose messages to be sent is auto-saved
  885. in a file named `#%*mail*#'.  Auto-save file names are made this way
  886. unless you reprogram parts of Emacs to do something different (the
  887. functions `make-auto-save-file-name' and `auto-save-file-name-p').  The
  888. file name to be used for auto-saving in a buffer is calculated when
  889. auto-saving is turned on in that buffer.
  890.  
  891.    When you delete a substantial part of the text in a large buffer,
  892. auto save turns off temporarily in that buffer.  This is so that if you
  893. delete text accidentally, it is likely to remain present in the auto
  894. save file.  To reenable auto-saving after this happens, simply save the
  895. file explicitly with `C-x C-s'.  Using `C-u 1 M-x auto-save-mode' also
  896. cancels this particular state.
  897.  
  898.    If you want auto-saving to be done in the visited file, set the
  899. variable `auto-save-visited-file-name' to be non-`nil'.  In this mode,
  900. there is really no difference between auto-saving and explicit saving.
  901.  
  902.    A buffer's auto-save file is deleted when you save the buffer in its
  903. visited file.  To inhibit this, set the variable
  904. `delete-auto-save-files' to `nil'.  Changing the visited file name with
  905. `C-x C-w' or `set-visited-file-name' renames any auto-save file to go
  906. with the new visited name.
  907.  
  908.    When you delete a large amount of a buffer's text, auto-saving turns
  909. off in that buffer.  This is because if you deleted the text
  910. unintentionally, you might find the auto-save file more useful if it
  911. contains the deleted text.  To restart auto-saving in that buffer, save
  912. the buffer with `C-x C-s', or use `M-x auto-save'.
  913.  
  914. 
  915. File: emacs,  Node: Auto Save Control,  Next: Recover,  Prev: Auto Save Files,  Up: Auto Save
  916.  
  917. Controlling Auto-Saving
  918. -----------------------
  919.  
  920.    Each time you visit a file, auto-saving is turned on for that file's
  921. buffer if the variable `auto-save-default' is non-`nil' (but not in
  922. batch mode; *note Entering Emacs::.).  The default for this variable is
  923. `t', so auto-saving is the usual practice for file-visiting buffers.
  924. Auto-saving can be turned on or off for any existing buffer with the
  925. command `M-x auto-save-mode'.  Like other minor mode commands, `M-x
  926. auto-save-mode' turns auto-saving on with a positive argument, off with
  927. a zero or negative argument; with no argument, it toggles.
  928.  
  929.    Emacs does auto-saving periodically based on counting how many
  930. characters you have typed since the last time auto-saving was done.
  931. The variable `auto-save-interval' specifies how many characters there
  932. are between auto-saves.  By default, it is 300.
  933.  
  934.    Auto-saving also takes place when you stop typing for a while.  The
  935. variable `auto-save-timeout' says how many seconds Emacs should wait
  936. before it does an auto save (and perhaps also a garbage collection).
  937. (The actual time period is longer if the current buffer is long; this
  938. is a heuristic which aims to keep out of your way when you are editing
  939. long buffers in which auto-save takes an appreciable amount of time.)
  940. Auto-saving during idle periods accomplishes two things: first, it
  941. makes sure all your work is saved if you go away from the terminal for
  942. a while; second, it may avoid some auto-saving while you are actually
  943. typing.
  944.  
  945.    Emacs also does auto-saving whenever it gets a fatal error.  This
  946. includes killing the Emacs job with a shell command such as `kill
  947. %emacs', or disconnecting a phone line or network connection.
  948.  
  949.    You can request an auto-save explicitly with the command `M-x
  950. do-auto-save'.
  951.  
  952. 
  953. File: emacs,  Node: Recover,  Prev: Auto Save Control,  Up: Auto Save
  954.  
  955. Recovering Data from Auto-Saves
  956. -------------------------------
  957.  
  958.    You can use the contents of an auto-save file to recover from a loss
  959. of data with the command `M-x recover-file RET FILE RET'.  This visits
  960. FILE and then (after your confirmation) restores the contents from from
  961. its auto-save file `#FILE#'.  You can then save with `C-x C-s' to put
  962. the recovered text into FILE itself.  For example, to recover file
  963. `foo.c' from its auto-save file `#foo.c#', do:
  964.  
  965.      M-x recover-file RET foo.c RET
  966.      yes RET
  967.      C-x C-s
  968.  
  969.    Before asking for confirmation, `M-x recover-file' displays a
  970. directory listing describing the specified file and the auto-save file,
  971. so you can compare their sizes and dates.  If the auto-save file is
  972. older, `M-x recover-file' does not offer to read it.
  973.  
  974.    If Emacs or the computer crashes, you can recover all the files you
  975. were editing from their auto save files with the command `M-x
  976. recover-session'.  This first shows you a list of recorded interrupted
  977. sessions.  Move point to the one you choose, and type `C-c C-c'.
  978.  
  979.    Then `recover-session' asks about each of the files that were being
  980. edited during that session, asking whether to recover that file.  If
  981. you answer `y', it calls `recover-file', which works in its normal
  982. fashion.  It shows the dates of the original file and its auto-save
  983. file, and asks once again whether to recover that file.
  984.  
  985.    When `recover-session' is done, the files you've chosen to recover
  986. are present in Emacs buffers.  You should then save them.  Only
  987. this--saving them--updates the files themselves.
  988.  
  989. 
  990. File: emacs,  Node: File Aliases,  Next: Version Control,  Prev: Auto Save,  Up: Files
  991.  
  992. File Name Aliases
  993. =================
  994.  
  995.    Symbolic links and hard links both make it possible for several file
  996. names to refer to the same file.  Hard links are alternate names that
  997. refer directly to the file; all the names are equally valid, and no one
  998. of them is preferred.  By contrast, a symbolic link is a kind of defined
  999. alias: when `foo' is a symbolic link to `bar', you can use either name
  1000. to refer to the file, but `bar' is the real name, while `foo' is just
  1001. an alias.  More complex cases occur when symbolic links point to
  1002. directories.
  1003.  
  1004.    If you visit two names for the same file, normally Emacs makes two
  1005. different buffers, but it warns you about the situation.
  1006.  
  1007.    If you wish to avoid visiting the same file in two buffers under
  1008. different names, set the variable `find-file-existing-other-name' to a
  1009. non-`nil' value.  Then `find-file' uses the existing buffer visiting
  1010. the file, no matter which of the file's names you specify.
  1011.  
  1012.    If the variable `find-file-visit-truename' is non-`nil', then the
  1013. file name recorded for a buffer is the file's "truename" (made by
  1014. replacing all symbolic links with their target names), rather than the
  1015. name you specify.  Setting `find-file-visit-truename' also implies the
  1016. effect of `find-file-existing-other-name'.
  1017.  
  1018. 
  1019. File: emacs,  Node: Version Control,  Next: Directories,  Prev: File Aliases,  Up: Files
  1020.  
  1021. Version Control
  1022. ===============
  1023.  
  1024.    "Version control systems" are packages that can record multiple
  1025. versions of a source file, usually storing the unchanged parts of the
  1026. file just once.  Version control systems also record history information
  1027. such as the creation time of each version, who created it, and a
  1028. description of what was changed in that version.
  1029.  
  1030.    The Emacs version control commands work with three version control
  1031. systems--RCS, CVS and SCCS.  The GNU project recommends the version
  1032. control system known as RCS, which is free software and available from
  1033. the Free Software Foundation.
  1034.  
  1035. * Menu:
  1036.  
  1037. * Version Systems::             Supported version control back end systems.
  1038. * VC Concepts::                 Basic version control information;
  1039.                                   checking files in and out.
  1040. * Editing with VC::             Commands for editing a file maintained
  1041.                                   with version control.
  1042. * Log Entries::                 Logging your changes.
  1043. * Change Logs and VC::          Generating a change log file from log entries.
  1044. * Old Versions::                Examining and comparing old versions.
  1045. * Branches::                    Selecting a branch to put your changes in,
  1046.                                   and creating a new branch.
  1047. * Status in VC::                Commands to view the VC status of files and
  1048.                                   look at log entries.
  1049. * Renaming and VC::             A command to rename both the source and
  1050.                                   master file correctly.
  1051. * Snapshots::                   How to make and use snapshots, a set of
  1052.                                   file versions that can be treated as a unit.
  1053. * Version Headers::             Inserting version control headers into
  1054.                                   working files.
  1055. * Customizing VC::              Variables to change VC's behavior.
  1056.  
  1057. 
  1058. File: emacs,  Node: Version Systems,  Next: VC Concepts,  Up: Version Control
  1059.  
  1060. Supported Version Control Systems
  1061. ---------------------------------
  1062.  
  1063.    VC currently works with three different version control systems or
  1064. "back ends": RCS, CVS, and SCCS.
  1065.  
  1066.    RCS is a free version control system that is available from the Free
  1067. Software Foundation.  It is perhaps the most mature of the supported
  1068. back ends, and the VC commands are conceptually closest to RCS.  Almost
  1069. everything you can do with RCS can be done through VC.
  1070.  
  1071.    CVS is built on top of RCS, and extends the features of RCS, allowing
  1072. for more sophisticated release management, and concurrent multi-user
  1073. development.  However, its concepts are rather different from those of
  1074. RCS and VC; consequently, some VC commands work differently when used
  1075. with CVS.  Note that before using CVS you must set up a repository,
  1076. which is a subject too complex to treat here.  *Note CVS and VC::.
  1077.  
  1078.    SCCS is a proprietary but widely used version control system.  In
  1079. terms of capabilities, it is the weakest of the the three that VC
  1080. supports.  VC compensates for certain features missing in SCCS
  1081. (snapshots, for example) by implementing them itself, but some other VC
  1082. features, such as multiple branches, are not available with SCCS.  You
  1083. should use SCCS only if for some reason you cannot use RCS.
  1084.  
  1085. 
  1086. File: emacs,  Node: VC Concepts,  Next: Editing with VC,  Prev: Version Systems,  Up: Version Control
  1087.  
  1088. Concepts of Version Control
  1089. ---------------------------
  1090.  
  1091.    When a file is under version control, we also say that it is
  1092. "registered" in the version control system.  Each registered file has a
  1093. corresponding "master file" which represents the file's present state
  1094. plus its change history, so that you can reconstruct from it either the
  1095. current version or any specified earlier version.  Usually the master
  1096. file also records a "log entry" for each version describing what was
  1097. changed in that version.
  1098.  
  1099.    The file that is maintained under version control is sometimes called
  1100. the "work file" corresponding to its master file.
  1101.  
  1102.    To examine a file, you "check it out".  This extracts a version of
  1103. the source file (typically, the most recent) from the master file.  If
  1104. you want to edit the file, you must check it out "locked".  Only one
  1105. user can do this at a time for any given source file.  (This kind of
  1106. locking is completely unrelated to the locking that Emacs uses to detect
  1107. simultaneous editing of a file.)
  1108.  
  1109.    When you are done with your editing, you must "check in" the new
  1110. version.  This records the new version in the master file, and unlocks
  1111. the source file so that other people can lock it and thus modify it.
  1112.  
  1113.    Checkin and checkout are the basic operations of version control.
  1114. You can do both of them with a single Emacs command: `C-x C-q'
  1115. (`vc-toggle-read-only').
  1116.  
  1117.    A "snapshot" is a coherent collection of versions of the various
  1118. files that make up a program.  *Note Snapshots::.
  1119.  
  1120.    The model of checkin and checkout does not quite fit CVS.  CVS has no
  1121. such thing as locking; multiple users can simultaneously edit their
  1122. copies of a file, and then check in their own variants of the file, but
  1123. these variants must be reconciled later.  *Note CVS and VC::.
  1124.  
  1125.