The emacs personalization file (dotemacs) is a very important resource for every Emacs user. Typically found at ~/.emacs, this file contains
To loose your .emacs file can mean loosing a lot of hours of tweaking and personalizing GNU Emacs through a bunch of collected-through-time snippets. So, being a very valuable asset, having a good method to back it up is a must have.
Here are 3 common methods people use to keep their Emacs file safe:
The most simple thing to do is to manually make copies of the file on a different directory, another partition on the same hard drive, an external hard drive, or a USB key. Also works well when having multiple computers and copying the same .emacs file on each of them. Using rsync to back it up periodically is a good idea, and it can be used to backup all your other elisp code for common modes (typically at ~/.emacs.d/) you use too.
A good option would be to back it up to an online storage service like Drop.io or even Amazon S3.
The standard and most common way to store your emacs customizations is by saving them on a file named .emacs placed on your home folder. But this is difficult to setup on a version control system since version control systems check things under directories. So this would mean you would be version controlling your whole home folder, which wouldn’t be a bad idea on some cases but on others would be a mess to maintain.
Fortunately there’s another way: at startup, Emacs also looks for a file called init.el on a hidden folder named .emacs.d/ in your home folder when the typical ~/.emacs file is not found. This way, you can easily set your preferred version control system to track changes on that folder. This has the advantage that any other Emacs modes or code you have can be stored and tracked too. This way, whenever you have a clean install, your Emacs setup and modes are just a checkout away from getting done.
On some setups, tracking changes on the whole ~/.emacs.d/ directory may not be a good option. So, to track changes on only your .emacs file can be achieved by moving your init.el file to a folder inside the home elisp directory and will look like this: ~/.emacs.d/dotemacs/init.el and make a symbolic link to it in ~/.emacs.d/ This way I can version control the “dotemacs” directory very easily.
Distributed version control
Many people use
Do you know other methods? How do you keep from loosing your dotemacs file?
3 replies on “3 methods on how to backup your Emacs file”
I like to put my settings files inside something like dropbox, then symlink them back where they belong.
I backup it on the cloud using Rackspace cloud files for me..
Esto es otra pista de los respaldos que te platicaba en el blog de unison, del journal y otros archivos en Sugar, a un host remoto. Y luego de retache.
Me surgen muchas preguntas sobre cÃ³mo ha de estar estructurado el control de versiones de los archivos de Sugar y el propio Diario. Pero eso lo dejarÃ© para otro momento, tal vez me puedas echar una mano, a lo mejor donde tengo que estudiar mÃ¡s para acercarme a la soluciÃ³n.