         (error "Autoloads file couldn't be generated")))))
 
 (defun doom-initialize-packages (&optional force-p load-p)
-  "Loads the packages.el files across DOOM Emacs in order to fill `doom-modules'
-and `doom-packages', if they aren't set already. If FORCE-P is non-nil, do it
-even if they are."
+  "Crawls across your emacs.d in order to fill `doom-modules' (from init.el) and
+`doom-packages' (from packages.el files), if they aren't set already. If FORCE-P
+is non-nil, do it even if they are. Also aggressively loads all core autoload
+files."
   (doom-initialize force-p)
   (let ((noninteractive t)
         (load-fn

          package-activated-list nil)

    ;; Ensure cache folder exists
    (mapc (lambda (dir)
            (unless (file-directory-p dir)
              (make-directory dir t)))
          (list doom-cache-dir package-user-dir))

    (package-initialize t)
    ;; Sure, `package-initialize' could fill `load-path', but package activation
    ;; costs precious milliseconds, and my premature optimization quota isn't
    ;; filled yet. UNACCEPTAABBLLLE!
    ;;
    ;; Also, in some edge cases involving package initialization during a
    ;; non-interactive session, `package-initialize' fails to fill `load-path'.
    (setq load-path (append load-path (directory-files package-user-dir t "^[a-zA-Z0-9]" t)))

    ;; Ensure core packages are installed
    (let ((core-packages (cl-remove-if 'package-installed-p doom-protected-packages)))
      (when core-packages
        (package-refresh-contents)
        (dolist (pkg core-packages)
          (let ((inhibit-message t))
            (package-install pkg))
          (if (package-installed-p pkg)
              (message "Installed %s" pkg)
            (error "Couldn't install %s" pkg)))))

    (require 'quelpa)
    (require 'use-package)

;; See core/autoload/packages.el for more functions.

(defvar doom-init-p nil
  "Non-nil if doom's package system has been initialized (by `doom-initialize').
This will be nil if you have byte-compiled your configuration (as intended).")

(defvar doom-modules nil
  "A hash table of enabled modules. Set by `doom-initialize-modules'.")

(defvar doom-packages nil
  "A list of enabled packages. Each element is a sublist, whose CAR is the
package's name as a symbol, and whose CDR is the plist supplied to its
`@package' declaration. Set by `doom-initialize-packages'.")

(defvar doom-protected-packages
  '(persistent-soft quelpa use-package)
