comparison lispref/backups.texi @ 90796:4ef881a120fe

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 675-697) - Update from CVS - Merge from gnus--rel--5.10 - Release ERC 5.2. * gnus--rel--5.10 (patch 211-215) - Update from CVS - Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-189
author Miles Bader <miles@gnu.org>
date Wed, 11 Apr 2007 00:17:47 +0000
parents 95d0cdf160ea e009ed31b7cf
children
comparison
equal deleted inserted replaced
90795:b9182b6a90c9 90796:4ef881a120fe
4 @c 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 4 @c 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
5 @c See the file elisp.texi for copying conditions. 5 @c See the file elisp.texi for copying conditions.
6 @setfilename ../info/backups 6 @setfilename ../info/backups
7 @node Backups and Auto-Saving, Buffers, Files, Top 7 @node Backups and Auto-Saving, Buffers, Files, Top
8 @chapter Backups and Auto-Saving 8 @chapter Backups and Auto-Saving
9 @cindex backups and auto-saving
9 10
10 Backup files and auto-save files are two methods by which Emacs tries 11 Backup files and auto-save files are two methods by which Emacs tries
11 to protect the user from the consequences of crashes or of the user's 12 to protect the user from the consequences of crashes or of the user's
12 own errors. Auto-saving preserves the text from earlier in the current 13 own errors. Auto-saving preserves the text from earlier in the current
13 editing session; backup files preserve file contents prior to the 14 editing session; backup files preserve file contents prior to the
23 @section Backup Files 24 @section Backup Files
24 @cindex backup file 25 @cindex backup file
25 26
26 A @dfn{backup file} is a copy of the old contents of a file you are 27 A @dfn{backup file} is a copy of the old contents of a file you are
27 editing. Emacs makes a backup file the first time you save a buffer 28 editing. Emacs makes a backup file the first time you save a buffer
28 into its visited file. Normally, this means that the backup file 29 into its visited file. Thus, normally, the backup file contains the
29 contains the contents of the file as it was before the current editing 30 contents of the file as it was before the current editing session.
30 session. The contents of the backup file normally remain unchanged once 31 The contents of the backup file normally remain unchanged once it
31 it exists. 32 exists.
32 33
33 Backups are usually made by renaming the visited file to a new name. 34 Backups are usually made by renaming the visited file to a new name.
34 Optionally, you can specify that backup files should be made by copying 35 Optionally, you can specify that backup files should be made by copying
35 the visited file. This choice makes a difference for files with 36 the visited file. This choice makes a difference for files with
36 multiple names; it also can affect whether the edited file remains owned 37 multiple names; it also can affect whether the edited file remains owned
64 is, if a backup was made by copying or if no backup was made, this 65 is, if a backup was made by copying or if no backup was made, this
65 function returns @code{nil}. 66 function returns @code{nil}.
66 @end defun 67 @end defun
67 68
68 @defvar buffer-backed-up 69 @defvar buffer-backed-up
69 This buffer-local variable indicates whether this buffer's file has 70 This buffer-local variable says whether this buffer's file has
70 been backed up on account of this buffer. If it is non-@code{nil}, then 71 been backed up on account of this buffer. If it is non-@code{nil},
71 the backup file has been written. Otherwise, the file should be backed 72 the backup file has been written. Otherwise, the file should be backed
72 up when it is next saved (if backups are enabled). This is a 73 up when it is next saved (if backups are enabled). This is a
73 permanent local; @code{kill-all-local-variables} does not alter it. 74 permanent local; @code{kill-all-local-variables} does not alter@tie{}it.
74 @end defvar 75 @end defvar
75 76
76 @defopt make-backup-files 77 @defopt make-backup-files
77 This variable determines whether or not to make backup files. If it 78 This variable determines whether or not to make backup files. If it
78 is non-@code{nil}, then Emacs creates a backup of each file when it is 79 is non-@code{nil}, then Emacs creates a backup of each file when it is
160 @end defvar 161 @end defvar
161 162
162 163
163 @node Rename or Copy 164 @node Rename or Copy
164 @subsection Backup by Renaming or by Copying? 165 @subsection Backup by Renaming or by Copying?
165 @cindex backup files, how to make them 166 @cindex backup files, rename or copy
166 167
167 There are two ways that Emacs can make a backup file: 168 There are two ways that Emacs can make a backup file:
168 169
169 @itemize @bullet 170 @itemize @bullet
170 @item 171 @item
266 automatically or it can ask the user whether to delete them. 267 automatically or it can ask the user whether to delete them.
267 268
268 @defopt kept-new-versions 269 @defopt kept-new-versions
269 The value of this variable is the number of newest versions to keep 270 The value of this variable is the number of newest versions to keep
270 when a new numbered backup is made. The newly made backup is included 271 when a new numbered backup is made. The newly made backup is included
271 in the count. The default value is 2. 272 in the count. The default value is@tie{}2.
272 @end defopt 273 @end defopt
273 274
274 @defopt kept-old-versions 275 @defopt kept-old-versions
275 The value of this variable is the number of oldest versions to keep 276 The value of this variable is the number of oldest versions to keep
276 when a new numbered backup is made. The default value is 2. 277 when a new numbered backup is made. The default value is@tie{}2.
277 @end defopt 278 @end defopt
278 279
279 If there are backups numbered 1, 2, 3, 5, and 7, and both of these 280 If there are backups numbered 1, 2, 3, 5, and 7, and both of these
280 variables have the value 2, then the backups numbered 1 and 2 are kept 281 variables have the value 2, then the backups numbered 1 and 2 are kept
281 as old versions and those numbered 5 and 7 are kept as new versions; 282 as old versions and those numbered 5 and 7 are kept as new versions;
292 293
293 @defopt dired-kept-versions 294 @defopt dired-kept-versions
294 This variable specifies how many of the newest backup versions to keep 295 This variable specifies how many of the newest backup versions to keep
295 in the Dired command @kbd{.} (@code{dired-clean-directory}). That's the 296 in the Dired command @kbd{.} (@code{dired-clean-directory}). That's the
296 same thing @code{kept-new-versions} specifies when you make a new backup 297 same thing @code{kept-new-versions} specifies when you make a new backup
297 file. The default value is 2. 298 file. The default is@tie{}2.
298 @end defopt 299 @end defopt
299 300
300 @node Backup Names 301 @node Backup Names
301 @subsection Naming Backup Files 302 @subsection Naming Backup Files
302 303
304 customize the naming conventions for backup files by redefining them. 305 customize the naming conventions for backup files by redefining them.
305 If you change one, you probably need to change the rest. 306 If you change one, you probably need to change the rest.
306 307
307 @defun backup-file-name-p filename 308 @defun backup-file-name-p filename
308 This function returns a non-@code{nil} value if @var{filename} is a 309 This function returns a non-@code{nil} value if @var{filename} is a
309 possible name for a backup file. A file with the name @var{filename} 310 possible name for a backup file. It just checks the name, not whether
310 need not exist; the function just checks the name. 311 a file with the name @var{filename} exists.
311 312
312 @smallexample 313 @smallexample
313 @group 314 @group
314 (backup-file-name-p "foo") 315 (backup-file-name-p "foo")
315 @result{} nil 316 @result{} nil
415 automatically compare a file with its most recent backup. 416 automatically compare a file with its most recent backup.
416 @end defun 417 @end defun
417 418
418 @node Auto-Saving 419 @node Auto-Saving
419 @section Auto-Saving 420 @section Auto-Saving
420 @cindex auto-saving 421 @c @cindex auto-saving Lots of symbols starting with auto-save here.
421 422
422 Emacs periodically saves all files that you are visiting; this is 423 Emacs periodically saves all files that you are visiting; this is
423 called @dfn{auto-saving}. Auto-saving prevents you from losing more 424 called @dfn{auto-saving}. Auto-saving prevents you from losing more
424 than a limited amount of work if the system crashes. By default, 425 than a limited amount of work if the system crashes. By default,
425 auto-saves happen every 300 keystrokes, or after around 30 seconds of 426 auto-saves happen every 300 keystrokes, or after around 30 seconds of