dagda1
dagda1

Reputation: 28910

stop emacs creating autosave files in the same directory

I cannot seem to stop emacs saving these .#my_file.rb files in the same directory as the the real file exists.

I've tried to write them to the tmp folder but it does not appear to be working:

(setq dotfiles-dir (file-name-directory
                    (or (buffer-file-name) load-file-name)))

;; auto saving
(setq auto-save-default t)
(setq auto-save-visited-file-name t)
(setq auto-save-interval 20) ; twenty keystrokes
(setq auto-save-timeout 1) ; 1 second of idle time

(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)))

Is my dotfile-dir variable that I should be setting to the temp directory or what am I doing wrong?

Upvotes: 3

Views: 907

Answers (1)

lawlist
lawlist

Reputation: 13467

Auto-save files use a tilde, whereas lockfiles use a dot and number sign. The following code will prevent the creation of lockfiles:

(setq create-lockfiles nil)

Here is the link to the manual on that issue: http://www.gnu.org/software/emacs/manual/html_node/elisp/File-Locks.html

Upvotes: 2

Related Questions