In Emacs, if you do not know where your init file is located or you do not have one and want to create it, then just open it for editing in Emacs:
C-x C-f ~/.emacs RET
When you add Lisp to your init file, it is not evaluated until you restart Emacs. Rather than restarting Emacs, you can use
‘M-x eval-buffer’, or
‘M-x eval-region’ or just
‘C-x C-e’. See EvaluatingExpressions.
If it seems your init file is not being read, type
‘C-h e’ to see if there is a chance there was a problem with it loading. See also DebugFileLoading.
It’s often better to break up a lengthy init file into a number of EmacsLisp libraries and a small, top-level init file that loads those libraries, especially if you define commands and other functions. Some of the init files posted on EmacsWiki are organized in this way, as a set of library files.
Start Emacs with a specific init file:
emacs -q -l ~/my-init-file.el
For more information about init files and custom files (Emacs 22 or later):
C-h r i init-file RETor
M-: (info "(emacs) Init File")
M-: (info "(emacs) Saving Customizations")
M-: (info "(elisp) Init File")
Steve Yegge's init file is a good example of an intricate init file that still has some order to it. Different parts of initialization are separated out into different files, and everything is loaded in the init file.
To simplify this, you could have
modes.el all in
~/.emacs.d/elisp making the appropriate customizations. Then you could tie everything together like this in your init file:
(add-to-list 'load-path "~/.emacs.d/elisp/") (load-library "style") (load-library "keys") (load-library "modes")