Go to the first, previous, next, last section, table of contents.


The Init File: `.emacs'

When you start Emacs, it normally attempts to load the file `.emacs' from your home directory. This file, if it exists, must contain Lisp code. It is called your init file. The command line switches `-q' and `-u' affect the use of the init file; `-q' says not to load an init file, and `-u' says to load a specified user's init file instead of yours. See section `Entering Emacs' in The GNU Emacs Manual.

A site may have a default init file, which is the library named `default.el'. Emacs finds the `default.el' file through the standard search path for libraries (see section How Programs Do Loading). The Emacs distribution does not come with this file; sites may provide one for local customizations. If the default init file exists, it is loaded whenever you start Emacs, except in batch mode or if `-q' is specified. But your own personal init file, if any, is loaded first; if it sets inhibit-default-init to a non-nil value, then Emacs does not subsequently load the `default.el' file.

Another file for site-customization is `site-start.el'. Emacs loads this before the user's init file. You can inhibit the loading of this file with the option `-no-site-file'.

Variable: site-run-file
This variable specifies the site-customization file to load before the user's init file. Its normal value is "site-start". The only way you can change it with real effect is to do so before dumping Emacs.

If there is a great deal of code in your `.emacs' file, you should move it into another file named `something.el', byte-compile it (see section Byte Compilation), and make your `.emacs' file load the other file using load (see section Loading).

See section `Init File Examples' in The GNU Emacs Manual, for examples of how to make various commonly desired customizations in your `.emacs' file.

User Option: inhibit-default-init
This variable prevents Emacs from loading the default initialization library file for your session of Emacs. If its value is non-nil, then the default library is not loaded. The default value is nil.

Variable: before-init-hook
This normal hook is run, once, just before loading all the init files (the user's init file, `default.el', and/or `site-start.el'). (The only way to change it with real effect is before dumping Emacs.)

Variable: after-init-hook
This normal hook is run, once, just after loading all the init files (the user's init file, `default.el', and/or `site-start.el'), before the terminal-specific initialization.


Go to the first, previous, next, last section, table of contents.