Here’s how to set up your Emacs initialization file on Windows.
First, the Emacs InitFile can be called
_emacs. Some people may find it’s easier to work with
_emacs on Windows.
The Emacs Windows FAQ includes some instructions.
You can take three paths:
Note that you can always edit the official Emacs startup file by typing C-x C-f ~/.emacs. This will get translated to one of the locations supported above. After the file is loaded, to see what the true path is type: C-h v buffer-file-name RET
Note that your HOME environment variable might not be set on your system, but GNU Emacs 22 appears to set this variable in its wrapper script. Thus, the InitFile is often in a location like
c:\Documents and Settings\user\Application Data\.emacs.
In the registry, set:
HKEY_CURRENT_USER\\SOFTWARE\\GNU\\Emacs& set key
Or, if you want changes system wide:
HKEY_LOCAL_MACHINE\\SOFTWARE\\GNU\\Emacs& set key
If you take the environment variable path, you’ll need to figure out how to do it for your particular system. There are some notes on setting Windows environment variables out on the web.
If you have Windows NT or XP, you can set the
HOME environment variable as follows:
HOMEthat points to where you want your home folder.
The cleanest option I’ve found is to soft link my version-controlled .emacs file in the default emacs.exe HOME directory:
cmd /c "mklink C:\Users\andrew\AppData\Roaming\.emacs C:\Users\andrew\src\dotfiles\.emacs"
M-: (getenv "HOME") RET to get your HOME directory as seen by Emacs.)
Windows NT and up set a
UserProfile environment variable that’s equivalent to
HOME. This might be useful somehow, though this whole issue is moot with Emacs 22 and up, if it really does set
HOME for you.