On my linux machines, in my ~/.emacs.d/init.el, I have

(setq auto-save-file-name-transforms '(("\\`/.*/\\([^/]+\\)\\'" "~/.emacs_autosave/\\1" t))))

which, when I edit ~/foo, gets me /home/jo/.emacs_autosave/#!home!jo!foo#, as expected.

On my Windows 10 Pro machine, with that same setq active, C-h v auto-save-file-name-transforms reports

Its value is (("\\`/.*/\\([^/]+\\)\\'" "C:/Users/troin/.emacs_autosave/\\1" t))  
Original value was (("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'" "c:/Users/troin/AppData/Local/Temp/\\2" t))

as expected, and yet when I edit ~/foo (which is in my case C:/Users/troin/foo), I get C:\Users\troin\#foo#, which is not as expected. So I tried

(when (eq system-type 'gnu/linux)
    (setq auto-save-file-name-transforms '(("\\`/.*/\\([^/]+\\)\\'" "~/.emacs_autosave/\\1" t))))
(when (eq system-type 'windows-nt)
    (setq auto-save-file-name-transforms '(("\\`/.*/\\([^/]+\\)\\'" "c:/Users/troin/.emacs_autosave/\\1" t))))

but I'm still not getting my auto-saves into directory ~/.emacs_autosave.

So how can I have my auto-saves go into ~/.emacs_autosave on Windows 10 Pro?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy