[ESS] emacs backup files

Stefan Husmann stefan-husmann at t-online.de
Tue Sep 27 02:45:10 CEST 2011


Am 08.09.2011 14:10, schrieb Jannis:
> Dear list members,
>
>
> even though this might be more of an emacs question, I am sure you might have some advice as well.
>
> I want to stop emacs from writing these ~filename and #filename# files in the folder togehether with the file but rather to bu these files in one central location (they came rather handy yet on several ocasions ;-) ).
>
>
> Some googleing brought me to this solution in my .emacs file:
>
> ;; Save all backups in one directory
> (defun make-backup-file-name (filename)
> (defvar backups-dir "~/Emacs_Backup/")
> (make-directory backups-dir t)
> (expand-file-name
> (concat backups-dir "." (file-name-nondirectory filename) "~")
> (file-name-directory filename)))
>
>
> Emacs still, however, creates #filename# files on the original location which is specially annoying in case I work on a file mounted remotely when this causes write errors and frequent emacs freezes.
>
> Am I doing anything wrong here?
>
>
> Jannis
>
> ______________________________________________
> ESS-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>
Hello,

your solution IMHO only deals with backup file (*~), not with autosave files (#*#).
I have the following code in my .emacs, which does the trick for both kinds of files.

(defvar user-temporary-file-directory
   (concat temporary-file-directory user-login-name "/"))
(make-directory user-temporary-file-directory t)
(setq backup-by-copying t)
(setq backup-directory-alist
       `(("." . ,user-temporary-file-directory)
         (,tramp-file-name-regexp nil)))
(setq auto-save-list-file-prefix
       (concat user-temporary-file-directory ".auto-saves-"))
(setq auto-save-file-name-transforms
       `((".*" ,user-temporary-file-directory t)))

Regards Stefan



More information about the ESS-help mailing list