Rethink doom-initialize & use package-initalize

Doom saves a lot of startup time by avoiding package-initialize, because
it loads every packages' autoloads file, which is expensive.
Unfortunately, these autoloads files are necessary for some plugins with
abnormal file structures (such as ESS). Previously, I was content with
loading them myself, but these occurrences have become more frequent, so
it would be safest if I relied on package-initialize more.

So doom-initialize will now do so. However, it will cache the load-path
(and Info-directory-list, fixing the lost info buffers) on first run.
This makes byte-compiling Doom almost useless, but it makes startup just
as fast as Doom would be if you had.

This needs more testing.
This commit is contained in:
Henrik Lissner 2018-02-27 22:24:36 -05:00
parent 36f903d029
commit 047ed6c9ea
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 32 additions and 45 deletions

View file

@ -56,9 +56,6 @@ Use this for files that change often, like cache files.")
(defvar doom-packages-dir (concat doom-local-dir "packages/")
"Where package.el and quelpa plugins (and their caches) are stored.")
(defvar doom-autoload-file (concat doom-local-dir "autoloads.el")
"Where `doom//reload-autoloads' will generate its autoloads file.")
;;;
;; UTF-8 as the default coding system
@ -149,20 +146,10 @@ ability to invoke the debugger in debug mode."
gc-cons-percentage 0.6
file-name-handler-alist nil))
(load (concat doom-core-dir "core-packages") nil t)
(setq load-path (eval-when-compile (doom-initialize t)
(doom-initialize-load-path t))
doom-package-load-path (eval-when-compile doom-package-load-path))
(require 'core-packages (concat doom-core-dir "core-packages"))
(doom-initialize noninteractive)
(load! core-lib)
(load! core-os) ; consistent behavior across OSes
(condition-case-unless-debug ex
(require 'autoloads doom-autoload-file t)
('error
(delete-file doom-autoload-file)
(lwarn 'doom-autoloads :warning
"Error in autoloads.el -> %s" ex)))
(unless noninteractive
(load! core-ui) ; draw me like one of your French editors
(load! core-editor) ; baseline configuration for text editing