Assume I have the file ~/Documents/bla.org. Now I open a buffer that visits the file ~/Documents/bla.org.
I check the value of the (buffer-local) variable buffer-auto-save-file-name, and it reads /home/berber/Documents/#bla.org#.
Now I run the following code:
(let ((save-files-directory (file-name-concat user-emacs-directory "auto-save")))
(make-directory save-files-directory :parents)
(setq auto-save-file-name-transforms
`((".*" ,save-files-directory t))))
If I now open a buffer that visits the file ~/Documents/bla.org, the value of buffer-auto-save-file-name reads /home/berber/.config/emacs/#!home!berber!Documents!bla.org#. This is the wrong directory, obviously.
When I check the variable auto-save-file-name-transforms, I get ((".*" "~/.config/emacs/auto-save" t)), which sounds right, but as seen above, it doesn't do the right thing... Yes, the directory /home/berber/.config/emacs/auto-save exists, and yes, I have done this with emacs -Q.
What could my problem be?
I am using Emacs 28.2.