C-x C-f ~/.emacs RET
When you add Lisp to your .emacs, 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.
It’s often better to break up a lengthy InitFile into a number of Emacs Lisp packages and a small, top-level InitFile that loads your packages, especially if you define commands and other functions. Some of the “init files” available here on EmacsWiki are organized in this way, as a set of packages.
For basic advice on how to install a neat new Emacs Lisp file you just found so that it loads automatically when you start Emacs, see InstallingPackages.
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")