(define-derived-mode): Make generated code work in
[bpt/emacs.git] / lispref / backups.texi
index 30c081c..e803904 100644 (file)
@@ -1,6 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. 
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1999
+@c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/backups
 @node Backups and Auto-Saving, Buffers, Files, Top
@@ -77,9 +78,9 @@ save disk space.  (You would put this code in your init file.)
 
 @smallexample
 @group
-(add-hook 'rmail-mode-hook 
+(add-hook 'rmail-mode-hook
           (function (lambda ()
-                      (make-local-variable 
+                      (make-local-variable
                        'make-backup-files)
                       (setq make-backup-files nil))))
 @end group
@@ -93,14 +94,10 @@ one argument, a file name to consider.  If the function returns
 @code{nil}, backups are disabled for that file.  Otherwise, the other
 variables in this section say whether and how to make backups.
 
-The default value is this:
-
-@example
-(lambda (name)
-  (or (< (length name) 5)
-      (not (string-equal "/tmp/"
-                         (substring name 0 5)))))
-@end example
+@findex normal-backup-enable-predicate
+The default value is @code{normal-backup-enable-predicate}, which checks
+for files in @code{temporary-file-directory} and
+@code{small-temporary-file-directory}.
 @end defvar
 
 @defvar backup-inhibited
@@ -116,11 +113,51 @@ its value.  Major modes should not set this variable---they should set
 @code{make-backup-files} instead.
 @end defvar
 
+@defvar backup-directory-alist
+@tindex backup-directory-alist
+This variable's value is an alist of filename patterns and backup
+directory names.  Each element looks like
+@smallexample
+(@var{regexp} . @var{directory})
+@end smallexample
+
+@noindent
+Backups of files with names matching @var{regexp} will be made in
+@var{directory}.  @var{directory} may be relative or absolute.  If it is
+absolute, so that all matching files are backed up into the same
+directory, the file names in this directory will be the full name of the
+file backed up with all directory separators changed to @samp{!} to
+prevent clashes.  This will not work correctly if your filesystem
+truncates the resulting name.
+
+For the common case of all backups going into one directory, the alist
+should contain a single element pairing @samp{"."} with the appropriate
+directory name.
+
+If this variable is @code{nil}, or it fails to match a filename, the
+backup is made in the original file's directory.
+
+On MS-DOS filesystems without long names this variable is always
+ignored.
+@end defvar
+
+@defvar make-backup-file-name-function
+@tindex make-backup-file-name-function
+This variable's value is a function to use for making backups instead of
+the default @code{make-backup-file-name}.  A value of nil gives the
+default @code{make-backup-file-name} behaviour.
+
+This could be buffer-local to do something special for specific
+files.  If you define it, you may need to change
+@code{backup-file-name-p} and @code{file-name-sans-versions} too.
+@end defvar
+
+
 @node Rename or Copy
 @subsection Backup by Renaming or by Copying?
 @cindex backup files, how to make them
 
-  There are two ways that Emacs can make a backup file: 
+  There are two ways that Emacs can make a backup file:
 
 @itemize @bullet
 @item
@@ -239,7 +276,6 @@ backup version 3 is excess.  The function @code{find-backup-file-name}
 (@pxref{Backup Names}) is responsible for determining which backup
 versions to delete, but does not delete them itself.
 
-@tindex delete-old-versions
 @defopt delete-old-versions
 If this variable is @code{t}, then saving a file deletes excess
 backup versions silently.  If it is @code{nil}, that means
@@ -369,7 +405,7 @@ This function returns the name of the most recent backup file for
 
 Some file comparison commands use this function so that they can
 automatically compare a file with its most recent backup.
-@end defun 
+@end defun
 
 @node Auto-Saving
 @section Auto-Saving
@@ -379,7 +415,7 @@ automatically compare a file with its most recent backup.
 called @dfn{auto-saving}.  Auto-saving prevents you from losing more
 than a limited amount of work if the system crashes.  By default,
 auto-saves happen every 300 keystrokes, or after around 30 seconds of
-idle time.  @xref{Auto-Save, Auto-Save, Auto-Saving: Protection Against
+idle time.  @xref{Auto Save, Auto Save, Auto-Saving: Protection Against
 Disasters, emacs, The GNU Emacs Manual}, for information on auto-save
 for users.  Here we describe the functions used to implement auto-saving
 and the variables that control them.
@@ -519,7 +555,7 @@ The value of this variable is the number of seconds of idle time that
 should cause auto-saving.  Each time the user pauses for this long,
 Emacs does auto-saving for all buffers in which that is enabled.  (If
 the current buffer is large, the specified timeout is multiplied by a
-factor that depends increases as the size increases; for a million-byte
+factor that increases as the size increases; for a million-byte
 buffer, the factor is almost 4.)
 
 If the value is zero or nil, then auto-saving is not done as a result
@@ -624,11 +660,11 @@ file on disk.  This action undoes all changes since the file was visited
 or saved.
 
 By default, if the latest auto-save file is more recent than the visited
-file, and the argument @var{ignore-auto} is non-@code{nil},
+file, and the argument @var{ignore-auto} is @code{nil},
 @code{revert-buffer} asks the user whether to use that auto-save
 instead.  When you invoke this command interactively, @var{ignore-auto}
-is @code{t} unless there is a numeric prefix argument; thus, the
-interactive default is to check the auto-save file.
+is @code{t} if there is no numeric prefix argument; thus, the
+interactive default is not to check the auto-save file.
 
 Normally, @code{revert-buffer} asks for confirmation before it changes
 the buffer; but if the argument @var{noconfirm} is non-@code{nil},