質問

I looked in various places and finally came up with the following setup for 'auto-save' mode in Emacs:

(defvar my-auto-save-folder (concat "~/.emacs.d/auto-save")); folder for auto-saves
(setq auto-save-list-file-prefix "~/.emacs.d/auto-save/.saves-"); set prefix for auto-saves 
(setq auto-save-file-name-transforms `((".*", my-auto-save-folder t))); location for all auto-save files
(setq tramp-auto-save-directory my-auto-save-folder); auto-save tramp files in local directory

After having this setup for some weeks, I visited ~/.emacs.d and found that the folder ~/.emacs.d/auto-save is empty, while ~/.emacs.d contained two auto-save files of the form #!home!<myusername>!<myfolder>!<myfile>. Why are the auto-save files not stored in ~/.emacs.d/auto-save? [the folder auto-save has rights 775, .emacs.d 700]

役に立ちましたか?

解決

Your error is in:

(defvar my-auto-save-folder (concat "~/.emacs.d/auto-save")); folder for auto-saves

(the call to concat with a single argument is pointless, incidentally).

If the optional element UNIQUIFY is non-nil, the auto-save file name is constructed by taking the directory part of the replaced file-name, concatenated with the buffer file name with all directory separators changed to `!' to prevent clashes.

Emacs identifies directory names by a trailing /, which means that "the directory part" of the path you've used is "~/.emacs.d/".

You want:

(defvar my-auto-save-folder "~/.emacs.d/auto-save/"); folder for auto-saves

The positioning of the comma in the following is also strange (although apparently it still works):

`((".*", my-auto-save-folder t)))

That should really be:

`((".*" ,my-auto-save-folder t)))

他のヒント

This is what i have in my .emacs, which works well for me:

(add-to-list 'auto-save-file-name-transforms
             (list "\\(.+/\\)*\\(.*?\\)" (expand-file-name "\\2" my-auto-save-folder))
             t)
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top