[[zh:初始化文件]]
Your '''[::init file]''' contains personal EmacsLisp code that you want to execute when you start Emacs.

See the Emacs manual (`C-h r'), node 
[[http://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html Init File]].

* For GnuEmacs, your init file is '''##~/.emacs##''', '''##~/.emacs.el##''', or '''##~/.emacs.d/init.el##'''.  You can choose to use any of these names.  '''##~/##''' stands for your home directory.
** Since version 27.1, if both all of the above files and the directory '''##~/.emacs.d##''' do not exist, GnuEmacs will find (but not create) the config file '''##emacs/init.el##''' you put in an XDG-compatible location. Namely:
*** '''##~/.config/emacs/init.el##''' if the environment variable '''##XDG_CONFIG_HOME##''' is unset, and
*** '''##$XDG_CONFIG_HOME/emacs/init.el##''' if '''##XDG_CONFIG_HOME##''' /is/ set.
* For [[XEmacs]], it is ##~/.xemacs## or ##~/.xemacs/init.el##.
* For AquamacsEmacs, it is ##~/.emacs## or ##~/Library/Preferences/Aquamacs Emacs/Preferences.el##

If you do not know where your init file is located, you can check the variable user-init-file:

   M-x describe-variable RET user-init-file RET

Or if you do not have one and want to create it, then
just open it for editing in Emacs:

   C-x C-f ~/.emacs.d/init.el RET

When you add Emacs Lisp code to your init file, it is not evaluated until you restart Emacs.  Rather than restarting Emacs, you can use `M-x eval-buffer' to evaluate everything, or `M-x eval-region' to evaluate a part you select, or just `C-x C-e' (command `eval-last-sexp') to evaluate the Emacs Lisp expression immediately before your [[cursor]].  See EvaluatingExpressions.

If it seems like 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 DebugFileLoading for more troubleshooting tips.

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.

For info about how to load an EmacsLisp file automatically when you start Emacs, see InstallingPackages.

You can also have a separate CustomFile reserved strictly for customizations recorded by [[Customize]].

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 RET## or ##M-: (info "(emacs) Init File")## 
: ##M-: (info "(emacs) Saving Customizations")##
: ##M-: (info "(elisp) Init File")##

See the pages in CategoryDotEmacs for configuration suggestions and tips.

----
CategoryHelp
CategoryDotEmacs
CategoryGlossary
