4

I have configured Emacs to send autosaves to the /tmp directory:

(setq backup-directory-alist `((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))

However, when editing the file Foo, instead of creating #Foo#, it creates ## - just two hashes. This then causes the warning "Bar has autosave data" every time I open a new file, since the /tmp/## file apparently pattern-matches every possible filename. I assume I'm setting the auto-save-file-name-transforms variable wrong; what should I set it to to create /tmp/#Foo# autosaves? (Or alternatively, what else do I need to change?)

Possibly relevant information:

  • Emacs 21.4.1
  • RHEL 5.3 (Tikanga)
  • Most of my files are version-controlled by git
  • vc-make-backup-files is nil (but setting it to t doesn't change the behaviour)
Rolf Andreassen
  • 450
  • 1
  • 5
  • 9
  • My configuration is similar to yours and it works just fine. I do notice that your Emacs is positively *ancient*. Version 21.4.1 isn't even hosted on [the GNU FTP site](http://ftp.gnu.org/gnu/emacs/) anymore, but it looks like 21.4 came out in 2005. (This is probably because your *OS* is ancient; [RHEL 5.3 was released in 2009](http://en.wikipedia.org/wiki/Red_Hat_Enterprise_Linux#RHEL_5). At least upgrade to 5.10!) Any chance you could upgrade Emacs to version 24, or at least version 23? – ChrisGPT was on strike Apr 17 '14 at 18:25
  • Unfortunately I don't have control over the environment on this box. :( – Rolf Andreassen Apr 17 '14 at 18:32
  • Actually, I don't touch `auto-save-file-name-transforms`. I am using its default setting, which on Emacs 24.3 is `(("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'" "/tmp/\\2" t))`. Is there a reason you're changing it? My guess is that's the problem. – ChrisGPT was on strike Apr 17 '14 at 18:38
  • Because that's the recipe I found online; I read it on the 'net so it must be true... Anyway, commenting out that line makes the autosave files have sensible #Foo# names. They don't get put in the /tmp directory, but I can live with that; unlike backups they don't clutter things up forever. Thanks! – Rolf Andreassen Apr 17 '14 at 21:33
  • If you do `C-h v temporary-file-directory`, does it show `/tmp`? – ChrisGPT was on strike Apr 17 '14 at 21:39
  • @Chris: Yes, it does. – Rolf Andreassen Apr 22 '14 at 17:09
  • I use `"."` instead of `".*"` in `backup-directory-alist` and also do not touch `auto-save-file-name-transforms`. – Knut Forkalsrud Mar 20 '15 at 03:20

1 Answers1

0

You could use something like this See second section by Amit Patel

l3thal
  • 562
  • 6
  • 11