Skip to content

Instantly share code, notes, and snippets.

@cwjohnston
Created October 29, 2014 15:55
Show Gist options
  • Select an option

  • Save cwjohnston/e2e0e51829aa36eef27d to your computer and use it in GitHub Desktop.

Select an option

Save cwjohnston/e2e0e51829aa36eef27d to your computer and use it in GitHub Desktop.
;; Put autosave files (ie #foo#) in one place, *not* scattered all over the
;; file system! (The make-autosave-file-name function is invoked to determine
;; the filename of an autosave file.)
(defvar autosave-dir "~/.emacs-dir/autosaves/")
(make-directory autosave-dir t)
(defun auto-save-file-name-p (filename) (string-match "^#.*#$" (file-name-nondirectory filename)))
(defun make-auto-save-file-name () (concat autosave-dir (if buffer-file-name (concat "#" (file-name-nondirectory buffer-file-name) "#") (expand-file-name (concat "#%" (buffer-name) "#")))))
;; Put backup files (ie foo~) in one place too. (The backup-directory-alist
;; list contains regexp=>directory mappings; filenames matching a regexp are
;; backed up in the corresponding directory. Emacs will mkdir it if necessary.)
(defvar backup-dir (expand-file-name "~/.emacs-dir/backups/"))
(setq backup-directory-alist (list (cons "." backup-dir)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment