Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've currently got:

(setq backup-directory-alist
      `((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
      `((".*" ,temporary-file-directory t)))

in my .emacs, but that doesn't seem to have changed where auto-save files get saved (it has changed where backup files get saved. M-x describe-variable shows that temporary-file-directory is set to /tmp/, but when I edit a file called and have unsaved changes, I get a file called in the same directory. How can I make that file go somewhere else (e.g. /tmp/)?

I've had no luck with these suggestions, so any suggestions welcome!

If it helps, I'm on GNU Emacs 23.3.1, running Ubuntu.

share|improve this question
up vote 6 down vote accepted

These files are not autosaves, they're lock files. Try to ls -l them, and you'll see that they're symbolic links that point to bogus filenames which are actually the username+pid of the editing process. AFAIK, there's no way to customize that. (The whole point is to avoid problems when two different users edit the same file -- if one changes the lockfile location they won't know about each other's edits.) See also this question.

(BTW, using /tmp to save backups is really not a good idea unless you're sure that you're the only user on the machine.)

share|improve this answer

Try advising make-auto-save-file-name to modify its return vale.

share|improve this answer
; auto save path
(defvar autosave-dir (concat "~/auto-save" "/"))
(make-directory autosave-dir t)
(setq auto-save-file-name-transforms
      `(("\\(?:[^/]*/\\)*\\(.*\\)" ,(concat autosave-dir "\\1") t)))

OS : win7 Ver: emacs 23.4

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .