Emacs and tilde files

By default Emacs saves a copy of the previous version of a file you are editing in the same directory as where the original file is located. It saves a copy with ~ appended to the end of the name. ~ is pronounced tilde. However, some tools and programming environments don’t know how to handle these tilde files and this can cause various problems. Someone mentioned on the Boston Ruby list that “Rails 2.3 router picked up emacs tilde ~ file before *.erb.html file …“. And the solution is pretty easy, you just tell emacs to save the ~ files in a different directory:

Now I wonder is there a way to have it only do this for certain types of files, or only to do it for certain workspaces, that way if I’m edit a file in a directory named ruby it will save the files elsewhere, otherwise save the file in the CWD.

Leave a Reply

Your email address will not be published. Required fields are marked *