kuwze
kuwze

Reputation: 421

Where is the .emacs.d folder located for Emacs on Windows 10?

Where is the .emacs.d folder located on Windows 10 machines? I am using the official GNU Emacs for Windows.

I tried C-h v user-init-file and got:

user-init-file is a variable defined in ‘C source code’. Its value is "~/.emacs"

but no such folder exists.

This is different from this other question in that this is Emacs compiled for Windows, so I don't think the folder it looks for is the equivalent of it on *NIX.

Upvotes: 6

Views: 7513

Answers (2)

kuwze
kuwze

Reputation: 421

TLDR: I fixed this by creating an environment variable called HOME that pointed to my home directory (for me it was C:\Users\kuwze) which contained my .emacs.d folder.

The steps to figure this out: Using C-h i g and selecting

  • Emacs W32 FAQ: (efaq-w32). FAQs about Emacs on MS Windows.

I was able to find this useful information:

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 due to historical problems various Windows tools had in the past with file names that begin with a dot. 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 ‘AppData’ 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 by typing the command ‘C-x C-f ~/.emacs’.

Upvotes: 5

phils
phils

Reputation: 73274

Open your home directory in Emacs Dired with: C-xd ~/ RET

You may or may not already have a ~/.emacs.d directory. If not, you can create it yourself from that Dired buffer with:

+ .emacs.d RET


Also see the manual: C-hig (emacs)Windows HOME RET

Upvotes: 2

Related Questions