2

I do not find init.el in .emacs.d. Where should I put my configuration?

% ls -a .emacs.d
.           .session        auto-save-list      recentf
..          .uptimes.el     org-clock-save.el   var
2
4

From the manual (emacs) Find Init:

Emacs looks for your init file using the filenames ‘~/.emacs.el’, ‘~/.emacs’, or ‘~/.emacs.d/init.el’ in that order; you can choose to use any one of these names. (Note that only the locations directly in your home directory have a leading dot in the location’s basename.)

There are a few other, less common, possibilities. See the manual for more details.

If you don't have an init file in any of these locations, you need to create one. Since you already have an .emacs.d directory, it's probably most convenient to create a new file .emacs.d/init.el.

init.el is just a plain text file with elisp code in it. There's nothing special needed to create it, just start saving your config code in a file with that name and you're ready to go.

1

If you want to find where the init file for an existing Emacs is located, from within Emacs itself, you can look at the value of the user-init-file variable with C-h v user-init-file RET.

This will open a buffer showing the value of the variable. If it is nil then no init file is used. Otherwise it will show the path to the currently used init file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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