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.
1: (if (eq system-type 'windows-nt)
2: (setq dot-emacs-files "c:/Users/username/Dropbox/emacs")
3: (setq dot-emacs-files "~/Dropbox/emacs")
6: (load (format "%s/%s" dot-emacs-files "packages-dot-emacs.el"))
7: (load (format "%s/%s" dot-emacs-files "org-dot-emacs.el"))
8: (load (format "%s/%s" dot-emacs-files "common-dot-emacs.el"))
9: (load (format "%s/%s" dot-emacs-files "elisp.el"))
Installing Emacs on Windows
- Download a copy of Emacs for Windows from here: http://ftp.gnu.org/gnu/emacs/windows/ Emacs comes as a zip file looking something like this: emacs-24.3-bin-i386.zip 18-Mar-2013 22:43 47M
- Unzip the folder to a suitable location, e.g. C:/Program Files
- That’s it. There is no other installation required.
- To launch Emacs, run the runemacs.exe file in the emacs-XX.X\bin\ folder
- You will now have a functioning copy of Emacs.
Follow this link to my Emacs Tutorial
…You’ll probably find, however, that not all features are present. Follow the steps below to add the remaining features.
If you’re looking for how to get Ediff or the spell checker to work in Windows, you’ve come to the right place.
Ispell (Spell Checker) on Windows Emacs
- Download Ispell: http://www.filewatcher.com/m/ispell.zip.352502-0.html
- M-x customize-variable and enter exec-path to include the path to ispell.exe
- Copy english.hash to emacs home folder. (You can find the path to your home folder by pasting the following into Emacs: (getenv “HOME”) and pressing C-x C-e after the final bracket.)
M-x flyspell to turn on flyspell mode, which underlines misspelled words. Click with the centre mouse button on the misspelled word for a menu suggested changes.
I like to add the following to my .emacs file. It maps the menu select option to the right mouse button.
(eval-after-load "flyspell" '(define-key flyspell-mode-map [down-mouse-3] 'flyspell-correct-word))
Cygwin is “a collection of tools which provide a Linux look and feel environment for Windows.”
Installing Cygwin is the easiest way to enable all those extra features in Emacs
- Go to http://cygwin.com/ and run the setup.exe file on the website
- Install the default set of packages
- If you want to be able to use org-mode to export to ODT documents in Windows, you’ll need to install zip and unzip from the archive package.
- On Emacs, set exec-path to c:\cygwin\bin (or to wherever you installed Cygwin) (If you don’t know how to set exec-path, the easiest way is M-x customize-variable, enter exec-path and then insert the path in one of the fields. Don’t forget to save the changes)
- Add c:\cygwin\bin to your Windows path and restart the machine
Done. Emacs should now by fully working on your Windows machine.