[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

39.1.2 The Init File, ‘.emacs

When you start Emacs, it normally attempts to load your init file, a file in your home directory. Its normal name is ‘.emacs’, but you can also call it ‘.emacs.el’. Alternatively, you can use a file named ‘init.el’ in a subdirectory ‘.emacs.d’. Whichever place you use, you can also compile the file (voir la section Byte Compilation); then the actual file loaded will be ‘.emacs.elc’ or ‘init.elc’.

The command-line switches ‘-q’, ‘-Q’, and ‘-u’ control whether and where to find the init file; ‘-q’ (and the stronger ‘-Q’) says not to load an init file, while ‘-u user’ says to load user's init file instead of yours. Voir (emacs)Entering Emacs section `Entering Emacs' dans The GNU Emacs Manual. If neither option is specified, Emacs uses the LOGNAME environment variable, or the USER (most systems) or USERNAME (MS systems) variable, to find your home directory and thus your init file; this way, even if you have su'd, Emacs still loads your own init file. If those environment variables are absent, though, Emacs uses your user-id to find your home directory.

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 (voir la 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’ (or ‘-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.

Voir (emacs)Init Examples section `Init File Examples' dans 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 loading the terminal-specific library and processing the command-line action arguments.

Variable: emacs-startup-hook

This normal hook is run, once, just after handling the command line arguments, just before term-setup-hook.

Variable: user-init-file

This variable holds the absolute file name of the user's init file. If the actual init file loaded is a compiled file, such as ‘.emacs.elc’, the value refers to the corresponding source file.


[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.