Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have installed EmacsW32. I need to edit my .emacs.

Where is .emacs located on Windows?

share|improve this question
add comment

3 Answers

up vote 5 down vote accepted

I don't actually know, since (being a relative newcomer to Emacs and thus not having done any customization) I don't have a .emacs for my (WinXP) desktop, but I do have a directory, %USERPROFILE%\Application Data\.emacs.d I'd put it there and see if it works.

share|improve this answer
    
Whee, a sane Windows port of a *nix program. Most don't bother using the correct paths and simply litter the user's profile with .something folders or files. –  Јοеу May 5 '10 at 22:05
add comment

From the GNU Emacs FAQ for MS Windows:

3.5 Where do I put my init file?

On Windows, the .emacs file may be called _emacs for backward compatibility with DOS and FAT filesystems where filenames could not start with a dot. Some users prefer to continue using such a name, because Explorer cannot create a file with a name starting with a dot, even though the filesystem and most other programs can handle it. In Emacs 22 and later, the init file may also be called .emacs.d/init.el. Many of the other files that are created by lisp packages are now stored in the .emacs.d directory too, so this keeps all your Emacs related files in one place.

All the files mentioned above should go in your HOME directory. The HOME directory is determined by following the steps below:

  1. If the environment variable HOME is set, use the directory it indicates.
  2. If the registry entry HKCU\SOFTWARE\GNU\Emacs\HOME is set, use the directory it indicates.
  3. If the registry entry HKLM\SOFTWARE\GNU\Emacs\HOME is set, use the directory it indicates. Not recommended, as it results in users sharing the same HOME directory.
  4. If C:.emacs exists, then use C:/. This is for backward compatibility, as previous versions defaulted to C:/ if HOME was not set.
  5. Use the user's AppData directory, usually a directory called Application Data under the user's profile directory, the location of which varies according to Windows version and whether the computer is part of a domain.

Within Emacs, <~> at the beginning of a file name is expanded to your HOME directory, so you can always find your .emacs file with C-x C-f ~/.emacs.

share|improve this answer
add comment

In my Swedish version of Windows 7 Professional, .emacs and/or .emacs.d/ are placed in C:\Users\username\AppData\Roaming

share|improve this answer
    
works ;) ...... –  zengr Jun 23 '11 at 0:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.