Created
March 5, 2012 19:09
-
-
Save scottwb/1980413 to your computer and use it in GitHub Desktop.
Make emacs store *~ backups files all in a single directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Move the backup *~ files into a single backups directory instead of | |
;;; littering the filesystem with them. Also version the backups and only | |
;;; keep a finite number of backup versions. | |
;;; | |
;;; Read more, and get the required backup-dir.el here: | |
;;; http://www.emacswiki.org/emacs/BackupDirectory | |
;;; | |
(require 'backup-dir) | |
(make-variable-buffer-local 'backup-inhibited) | |
(setq bkup-backup-directory-info | |
'((t "~/.emacs.d/backups" ok-create full-path prepend-name))) | |
(setq delete-old-versions t | |
kept-old-versions 1 | |
kept-new-versions 3 | |
version-control t) | |
(defun make-backup-file-name (FILE) | |
(let ((dirname (concat "~/.emacs.d/backups" | |
(format-time-string "%y/%m/%d/")))) | |
(if (not (file-exists-p dirname)) | |
(make-directory dirname t)) | |
(concat dirname (file-name-nondirectory FILE)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment