16.5.1 Autoload by Prefix

During completion for the commands describe-variable and describe-function, Emacs will try to load files which may contain definitions matching the prefix being completed. The variables definition-prefixes and help-definition-prefixes drive this process. definition-prefixes holds a hash table mapping prefixes to corresponding lists of files to load, and help-definition-prefixes holds a radix tree performing the same mapping. As you use completion and Emacs loads files, entries are removed from these variables since the files don’t need to be loaded again.

Entries in definition-prefixes are added by calls to register-definition-prefixes which are generated by loaddefs-generate (see Autoload). Files which don’t contain any definitions worth loading (test files, for example), should set autoload-compute-prefixes to nil as a file-local variable.

Entries in help-definition-prefixes are added from entries in definition-prefixes when you start using completion for the relevant commands. At some point in the future help-definition-prefixes may be removed in favour of making definition-prefixes a radix tree.