Are you tired of that anyoying emacs tilde ~ file that gets created where ever you edit a file? If so here is your answer to relocating the emacs tilde file.
Your first step is to create a new directory called “emacs_backups.” Now I made my directory hidden but you do not have to, in the example I will create the backup directory as a hidden directory under my users home.
mkdir ~/.emacs_backups
Then we need to edit the .emacs file, this file is located in your home directory but is not shown with a normal “ls -l” command. You will need to do an “ls -la” as the .emacs file is hidden. Once you have confirmed the file is there edit it with your favorite editor (most likely emacs).
emacs .emacs
Add the following to the end of your “.emacs” file:
;; create a backup file directory
(defun make-backup-file-name (file)
(concat “~/.emacs_backups/” (file-name-nondirectory file) “~”))
Save and close the file. Next time you open emacs you will notice that your files are being saved to the new hidden “emacs_backups” folder located in your home directory.