1

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"?

Student4K
  • 916
  • 2
  • 9
  • 20

2 Answers2

2

In this step "the list" is actually the preloaded installation values in load-path. The rest of the points are clear in the steps performed. For instance, some Debian/Ubuntu distributions add some system-wide configuration files in /etc/emacsXX, and this is hard coded in the source code when he package is compiled as some of the initial paths in load-path.

Diego Sevilla
  • 28,636
  • 4
  • 59
  • 87
1

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/

Community
  • 1
  • 1
phils
  • 71,335
  • 11
  • 153
  • 198
  • OK, I see. package-initialize is actually mentioned in the summary of "starting up" in the reference manual. – Student4K Mar 03 '16 at 17:15