[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12. Specify Directories to be Used for Backup Files

Allows backup files to be optionally stored in some directories, based on the value of the alist, bkup-backup-directory-info. This variable is a list of lists of the form (FILE-REGEXP BACKUP-DIR OPTIONS ...). If the filename to be backed up matches FILE-REGEXP, or FILE-REGEXP is t, then BACKUP-DIR is used as the path for its backups. Directories may begin with "/" to specify an absolute pathname.

If BACKUP-DIR does not exist and OPTIONS contains the symbol ok-create, then it is created if possible. Otherwise the usual behavior (backup in the same directory as the file) results.

If OPTIONS contains the symbol full-path, then the full path of the file being backed up is prepended to the backup file name, with each "/" replaced by a "!". This is intended for cases where an absolute backup path is used. If OPTIONS contains prepend-name in addition to full-path, then the file name is prepended rather than appended to the path component when forming the backup name.

If OPTIONS contains the symbol search-upward and the backup directory BACKUP-DIR is a relative path, then a directory with that name is searched for starting at the current directory and proceeding upward (.., ../.., etc) until one is found of that name or the root is reached, and if one is found it is used as the backup directory.

Finally, if no FILE-REGEXP matches the file name being backed up, then the usual behavior results.

These lines from my initialization file load this library and set the values I like:

  (require 'backup-dir)
  (setq bkup-backup-directory-info
        '(("/home/greg/.*" "/~/.backups/" ok-create full-path prepend-name)
          ("^/[^/:]+:"     ".backups/") ; handle EFS files specially: don't 
          ("^/[^/:]+:"     "./")        ; search-upward... its very slow
          (t               ".backups/"
                           full-path prepend-name search-upward)))

The package also provides a new function, find-file-latest-backup to find the latest backup file for the current buffer's file.

This package is based on `files.el' from XEmacs 20.3 and overrides functions defined there.

[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by XEmacs Webmaster on October, 2 2007 using texi2html