I have the following in my configs,

(use-package files
    (auto-save-file-name-transforms `((".*" ,786:BACKUP-DIR t)))
    (backup-directory-alist `(("." . ,786:BACKUP-DIR)))
    (backup-by-copying t "don't delink hardlinks")
    (version-control t "use version numbers on backups")
    (delete-old-versions t "automatically delete excess backups")
    (kept-new-versions 20 "how many newest and old versions to keep")
    (kept-old-versions 5))

This changes the value of auto-save-file-name-transforms to,

((".*" "/Users/user/.config/emacs/.cache/backup/" t))

If I understand, this should now save the auto save or the files prefixed .# in /Users/user/.config/emacs/.cache/backup/ and that does happen but they also get saved in the current working directory.

I did not notice this before, is that a recent change or a bug maybe?

I am on MacOS Sonoma 14.0 (23A344) and M-x emacs-version gives,

GNU Emacs 29.1 (build 1, aarch64-apple-darwin21.6.0, NS appkit-2113.60 Version 12.6.6 (Build 21G646)) of 2023-08-16
  • Are you confusing backup files and autosave files? They are 2 different concepts. Also, can you please share your A. platform , B. Emacs version ? Thanks.
    – q.undertow
    Commented Jan 26 at 17:48
  • I don't think so. The backup files are being put in the right directory. It is the auto-save files that aren't. I added more information.
    – scribe
    Commented Jan 27 at 5:17

1 Answer 1


I think your regex is wrong, you are missing *

Could you try

(auto-save-file-name-transforms `((".*" ,786:BACKUP-DIR t)))
(backup-directory-alist `((".*" . ,786:BACKUP-DIR)))

This part ".*" is regex, and if it's wrong, it can likely ignore the setting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.