Only One .emacs

I keep my Emacs init files on Dropbox – that way I only have to maintain one set of files no matter how many machines I run Emacs on. My local .emacs file simply loads the init files on Dropbox.

One minor problem is that Dropbox can have a different path according to the operating system.

This is easily resolved using the system-type variable. For my set up, I’m only interested in whether I’m running on a ‘gnu/linux or a ‘windows-nt system.

The following code sets the path of my Dropbox folder and then uses the format function to append the appropriate init files to that location. The individual files are then loaded. I’ve split my .emacs file across several files for tidiness and convenience. Even so, it still manages to degenerate into a mess when I’m not watching it.

(if (eq system-type 'windows-nt) (setq dot-emacs-files "c:/Users/username/Dropbox/emacs") (setq dot-emacs-files "~/Dropbox/emacs") ) (load (format "%s/%s" dot-emacs-files "packages-dot-emacs.el")) (load (format "%s/%s" dot-emacs-files "org-dot-emacs.el")) (load (format "%s/%s" dot-emacs-files "common-dot-emacs.el")) load (format "%s/%s" dot-emacs-files "elisp.el"))