Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find my .emacs file for Emacs running on Windows?

People also ask

Where is the .emacs file in Windows?

emacs file or . emacs. d folder is in the c:/Users/username/AppData/Roaming . Or some sources will write it as %HOMEPATH%\AppData\Roaming\.

Where does emacs look for El files?

el , Emacs finds this file via the standard search path for Lisp libraries.

Where is init El file?

User's Initialization File or dotemacs or init file is a file to store your configurations/customizations for Emacs written in Emacs Lisp, located at either ${HOME}/. emacs. d/init. el or (archaically) at ${HOME}/.


Copy and pasted from the Emacs FAQ, http://www.gnu.org/software/emacs/windows/:

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 Windows 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.

There's further information at HOME and Startup Directories on MS-Windows.


It should be stored in the variable user-init-file. Use C-H v user-init-file RET to check. You can also open it directly by using M-x eval-expression RET (find-file user-init-file) RET


Open the file like this in Emacs for Windows:

C-x C-f ~/.emacs

More information in the Emacs Wiki


On my Vista box it's in C:\Users\<USER>\AppData\Roaming\


Note that it may NOT be enough to just type Ctrl-x Ctrl-f ~/.emacs and create the file.

It may be that your Emacs application uses a different place to store your init file, and if so, then creating the file ~/.emacs simply creates a useless file which your Emacs application ignores.

Also, you may want to do more than just access the .emacs init file, but you may want to know where it is, i.e., its pathname.

To get at this there are two methods:

Easy way: type Ctrl + H V user-init-file Return

Slightly trickier way: You can find out where your system is storing its own .emacs file by:

  1. Click options and scroll down to "Set Default Font..."
  2. Change the font setting and click okay
  3. On the options menu, go down to "Save Options"
  4. When the options are saved, the system saves its .emacs file, and you can read the file path in the minibuffer at the bottom of the Emacs screen

In Windows 7 put your init.el file in C:\Users\user-name\AppData\Roaming\.emacs.d\, where user-name is your user/login folder.

Take care so your init.el file won't be named init.el.txt. This is something Windows does if you create your file with some editor like Notepad.


On versions of Emacs on Windows above 22, it seems to have moved to

~/.emacs.d/init.el

, ~ being the value of your environment variable HOME (see Control Panel → SystemAdvancedEnvironment variables).

The file itself might not exist. In that case just create it.