emacsload-path

Emacs initialization and load-path


I need some help understanding Emacs initialization and load-path variable construction. So, there is the init file .emacs (or .emacs.d/init.el) file in $HOME, that is loaded first, and at the point this file is about to be read, load-path already contains directories from /etc, /usr/*, e.g. directories from the Emacs distribution itself.

After loading the init file is there any standard Emacs initialization files, that scan through .emacs.d and adds subdirectories it finds there?

The Emacs manual says something about subdirs.el in the first Emacs initialization step (https://www.gnu.org/software/emacs/manual/html_node/elisp/Startup-Summary.html#Startup-Summary), but it happens before loading the init file and I do not understand the language used:

  1. It adds subdirectories to load-path, by running the file named subdirs.el in each directory in the list.

In which "the list"?


Solution

  • After loading the init file is there any standard Emacs initialization files, that scan through .emacs.d and adds subdirectories it finds there?

    In general, no -- Emacs will not automatically add arbitrary subdirectories to your load-path (and nor would you want it to).

    This does happen for some particular subdirectories, however.

    As of Emacs 24 the in-built package manager will automatically add your installed ELPA package directories to the load-path after your init file has been evaluated.

    (And/or when package-initialize is called explicitly, if you do that.)

    By default your ELPA packages live under ~/.emacs.d/elpa/