                  for path = (doom-module-path module submodule "packages.el")
                  do (_load path 'noerror))))))
 
-(defun doom-initialize-modules (modules)
-  "Adds MODULES to `doom-modules'. MODULES must be in mplist format.
-
-  e.g '(:feature evil :lang emacs-lisp javascript java)"
-  (setq doom-modules (make-hash-table :test #'equal
-                                      :size (+ 5 (length modules))
-                                      :rehash-threshold 1.0))
-  (let (mode)
-    (dolist (m modules)
-      (cond ((keywordp m) (setq mode m))
-            ((not mode)   (error "No namespace specified on `doom!' for %s" m))
-            ((listp m)    (doom-module-enable mode (car m) (cdr m)))
-            (t            (doom-module-enable mode m))))))
-
 (defun doom-module-path (module submodule &optional file)
   "Get the full path to a module: e.g. :lang emacs-lisp maps to
 ~/.emacs.d/modules/lang/emacs-lisp/ and will append FILE if non-nil."

  "Bootstrap DOOM Emacs.

MODULES is an malformed plist of modules to load."
  (doom-initialize-modules modules)
  `(let (file-name-handler-alist)
     (setq doom-modules ',doom-modules)
     (unless noninteractive
       (message "Doom initialized")
       ,@(cl-loop for (module . submodule) in (doom-module-pairs)
                  for module-path = (doom-module-path module submodule)
                  collect `(load! init ,module-path t) into inits
                  collect `(load! config ,module-path t) into configs
                  finally return (append inits configs))
       (when (display-graphic-p)
         (require 'server)
         (unless (server-running-p)
           (server-start)))
       (add-hook 'doom-post-init-hook #'doom-packages--display-benchmark)
       (message "Doom modules initialized"))))

(defmacro def-package! (name &rest plist)
  "A thin wrapper around `use-package'."

(defvar doom-init-time nil
  "The time it took, in seconds, for DOOM Emacs to initialize.")

(defvar doom-modules
  (make-hash-table :test #'equal :size 90 :rehash-threshold 1.0)
  "A hash table of enabled modules. Set by `doom-initialize-modules'.")

(defvar doom-packages ()
