// Internet Duct Tape

How to move all gnu emacs backup files to their own directory

Posted in Links, Programming Tools, Technology by engtech on May 28, 2006

Emacs (Gnu Emacs or XEmacs. Read about the difference at xemacs.org) is a robust text editors (plus a whole lot more). One of the features that drive me crazy is the backup files it creates whenever text is editted (editting README.TXT will create README.TXT~ in the same directory). There is a lisp package called "autosave" that will put all the autosave/backup files in a separate directory so that you don't clutter your workspace.

This link contains settings for your .emacs (or custom.el) file that will properly configure autosave for GNU Emacs or XEmacs.
snarfed.org :: gnu emacs backup files

One Response

Subscribe to comments with RSS.

  1. engtech said, on May 29, 2006 at 2:40 pm

    The XEmacs instructions work for XEMacs for Windows as well, with the only change being replacing "/tmp/" with "C:/temp/".

    Open XEMacs for Windows
    Choose "Options" -> "Edit Init File"
    Cut and paste the text below
    Save init.el
    Close and reopen XEmacs for Windows

    ;;; Auto-save
    ;;; Load the auto-save.el package, which lets you put all of your autosave
    ;;; files in one place, instead of scattering them around the file system.
    ;;; M-x recover-all-files or M-x recover-file to get them back
    (defvar temp-directory (concat "C:/temp/" (user-login-name))) (make-directory temp-directory t)

    ; One of the main issues for me is that my home directory is

    ; NFS mounted. By setting all the autosave directories in /tmp,
    ; things run much quicker
    (setq auto-save-directory (concat temp-directory "/autosave")
    auto-save-hash-directory (concat temp-directory "/autosave-hash")
    auto-save-directory-fallback "C:/temp/"
    auto-save-list-file-prefix (concat temp-directory "/autosave-")
    auto-save-hash-p nil auto-save-timeout 100 auto-save-interval 300)
    (make-directory auto-save-directory t)
    (require 'auto-save)

    ;;; Put backups in another directory. With the directory-info
    ;;; variable, you can control which files get backed up where.
    (require 'backup-dir)
    (setq bkup-backup-directory-info
    `(
    (t ,(concat temp-directory "/backups") ok-create full-path) ))
    (setq make-backup-files t)
    (setq backup-by-copying t)
    (setq backup-by-copying-when-mismatch t)
    (setq backup-by-copying-when-linked t)
    (setq version-control t)
    (setq-default delete-old-versions t)


Comments are closed.

Follow

Get every new post delivered to your Inbox.

Join 285 other followers

%d bloggers like this: