Rethink what Doom loads at startup and manually

Better to simply load what we need, when we need it, rather than set up
autoloads for every litte thing.
This commit is contained in:
Henrik Lissner 2018-01-06 17:02:57 -05:00
parent 0042a56d02
commit 31a4244686
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
7 changed files with 15 additions and 10 deletions

View file

@ -133,6 +133,7 @@ containing (PACKAGE-SYMBOL OLD-VERSION-LIST NEW-VERSION-LIST).
If INCLUDE-FROZEN-P is non-nil, check frozen packages as well.
Used by `doom//packages-update'."
(require 'async)
(let (quelpa-pkgs elpa-pkgs)
;; Separate quelpa from elpa packages
(dolist (pkg (doom-get-packages t))

View file

@ -1,14 +1,15 @@
;;; core-lib.el -*- lexical-binding: t; -*-
(let ((load-path doom--site-load-path))
(require 'subr-x)
(load "async-autoloads" nil t)
(dolist (sym '(json-read json-read-file json-read-from-string json-encode))
(autoload sym "json"))
(eval-and-compile
(require 'cl-lib)
(require 'map)
(eval-when-compile (require 'use-package)))
(when (version< emacs-version "26")
(with-no-warnings
(defalias 'if-let* #'if-let)
(defalias 'when-let* #'when-let))))
(defalias 'when-let* #'when-let)))
;;

View file

@ -155,7 +155,6 @@ ability to invoke the debugger in debug mode."
gc-cons-percentage 0.6
file-name-handler-alist nil))
(require 'cl-lib)
(load (concat doom-core-dir "core-packages") nil t)
(setq load-path (eval-when-compile (doom-initialize t)
(doom-initialize-load-path t))

View file

@ -8,6 +8,7 @@
"The last test run.")
(defun +go--run-tests (args)
(require 'async)
(save-selected-window
(async-shell-command (concat "go test " args))))

View file

@ -11,6 +11,7 @@ ignore the cache."
(gethash project-root +javascript-npm-conf))
(let ((package-file (expand-file-name "package.json" project-root)))
(when-let* ((json (and (file-exists-p package-file)
(require 'json)
(json-read-file package-file))))
(puthash project-root json +javascript-npm-conf))))))

View file

@ -10,5 +10,6 @@ ignore the cache."
(or (and (not refresh-p) (gethash project-root +php-composer-conf))
(let ((package-file (expand-file-name "composer.json" project-root)))
(when-let* ((data (and (file-exists-p package-file)
(require 'json)
(json-read-file package-file))))
(puthash project-root data +php-composer-conf))))))

View file

@ -58,6 +58,7 @@
;; Make expensive php-extras generation async
(unless (file-exists-p (concat php-extras-eldoc-functions-file ".el"))
(message "Generating PHP eldoc files...")
(require 'async)
(async-start `(lambda ()
,(async-inject-variables "\\`\\(load-path\\|php-extras-eldoc-functions-file\\)$")
(require 'php-extras-gen-eldoc)