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. If INCLUDE-FROZEN-P is non-nil, check frozen packages as well.
Used by `doom//packages-update'." Used by `doom//packages-update'."
(require 'async)
(let (quelpa-pkgs elpa-pkgs) (let (quelpa-pkgs elpa-pkgs)
;; Separate quelpa from elpa packages ;; Separate quelpa from elpa packages
(dolist (pkg (doom-get-packages t)) (dolist (pkg (doom-get-packages t))

View file

@ -1,14 +1,15 @@
;;; core-lib.el -*- lexical-binding: t; -*- ;;; core-lib.el -*- lexical-binding: t; -*-
(require 'subr-x) (let ((load-path doom--site-load-path))
(load "async-autoloads" nil t) (require 'subr-x)
(dolist (sym '(json-read json-read-file json-read-from-string json-encode)) (require 'cl-lib)
(autoload sym "json")) (require 'map)
(eval-and-compile (eval-when-compile (require 'use-package)))
(when (version< emacs-version "26")
(with-no-warnings (when (version< emacs-version "26")
(defalias 'if-let* #'if-let) (with-no-warnings
(defalias 'when-let* #'when-let)))) (defalias 'if-let* #'if-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 gc-cons-percentage 0.6
file-name-handler-alist nil)) file-name-handler-alist nil))
(require 'cl-lib)
(load (concat doom-core-dir "core-packages") nil t) (load (concat doom-core-dir "core-packages") nil t)
(setq load-path (eval-when-compile (doom-initialize t) (setq load-path (eval-when-compile (doom-initialize t)
(doom-initialize-load-path t)) (doom-initialize-load-path t))

View file

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

View file

@ -11,6 +11,7 @@ ignore the cache."
(gethash project-root +javascript-npm-conf)) (gethash project-root +javascript-npm-conf))
(let ((package-file (expand-file-name "package.json" project-root))) (let ((package-file (expand-file-name "package.json" project-root)))
(when-let* ((json (and (file-exists-p package-file) (when-let* ((json (and (file-exists-p package-file)
(require 'json)
(json-read-file package-file)))) (json-read-file package-file))))
(puthash project-root json +javascript-npm-conf)))))) (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)) (or (and (not refresh-p) (gethash project-root +php-composer-conf))
(let ((package-file (expand-file-name "composer.json" project-root))) (let ((package-file (expand-file-name "composer.json" project-root)))
(when-let* ((data (and (file-exists-p package-file) (when-let* ((data (and (file-exists-p package-file)
(require 'json)
(json-read-file package-file)))) (json-read-file package-file))))
(puthash project-root data +php-composer-conf)))))) (puthash project-root data +php-composer-conf))))))

View file

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