diff --git a/core/core-packages.el b/core/core-packages.el index 61c796575..78c050d0b 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -148,15 +148,11 @@ and `auto-mode-alist'.") "Refresh `doom-packages-file', which caches `load-path', `Info-directory-list', `doom-disabled-packages', `auto-mode-alist' and `package-activated-list'." - (doom-initialize-packages 'internal) (let ((coding-system-for-write 'emacs-internal)) (with-temp-file doom-packages-file (insert ";;; -*- lexical-binding:t -*-\n" ";; This file was autogenerated by `doom|refresh-cache', DO NOT EDIT!\n") - (prin1 `(setq load-path ',load-path - Info-directory-list ',Info-directory-list - auto-mode-alist ',auto-mode-alist - interpreter-mode-alist ',interpreter-mode-alist + (prin1 `(setq Info-directory-list ',Info-directory-list doom-disabled-packages ',doom-disabled-packages package-activated-list ',package-activated-list) (current-buffer))))) @@ -198,6 +194,7 @@ FORCE-P is non-nil, do it anyway. (require 'subr-x) (require 'cl-lib) (require 'map)) + (cl-pushnew doom-core-dir load-path :test #'string=) (when (or force-p (not doom-init-p)) ;; autoloads file (unless (load doom-autoload-file 'noerror 'nomessage 'nosuffix) @@ -234,9 +231,8 @@ FORCE-P is non-nil, do it anyway. (message "✓ Installed %s" package) (error "✕ Couldn't install %s" package))) (message "Installing core packages...done"))) - (cl-pushnew doom-core-dir load-path :test #'string=) - (add-hook 'doom-internal-init-hook #'doom|refresh-cache)) - (when doom-debug-mode + ;; Cache important packages.el state + (doom|refresh-cache) (message "Doom initialized")) (setq doom-init-p t)) ;; initialize Doom core @@ -439,7 +435,6 @@ MODULES is an malformed plist of modules to load." (setq doom-modules ',doom-modules) ,@(nreverse init-forms) (unless noninteractive - (run-hooks 'doom-internal-init-hook) (let ((doom--stage 'config)) ,@(nreverse config-forms) (when doom-private-dir @@ -770,44 +765,41 @@ This should be run whenever init.el or an autoload file is modified. Running (load-path (append (list doom-emacs-dir) doom-psuedo-module-dirs doom-modules-dirs - load-path)) - current-sexp) + load-path))) (unwind-protect (condition-case-unless-debug ex (with-current-buffer buf + (delay-mode-hooks (emacs-lisp-mode)) (goto-char (point-min)) - (while (re-search-forward "^\\s-*(" nil t) - (unless (or (nth 4 (syntax-ppss)) - (nth 3 (syntax-ppss))) - ;; Replace autoload paths with absolute paths for faster - ;; resolution during load and simpler `load-path' - (when (memq (sexp-at-point) '(autoload custom-autoload)) - (save-excursion - (forward-sexp 2) - (let ((pt (point))) - (forward-sexp 1) - (when-let* ((sexp (thing-at-point 'sexp t)) - (path (eval (read sexp) t))) - (when (and (stringp path) (not (file-name-absolute-p path))) - (delete-region pt (point)) - (if-let* ((lib (locate-library path))) - (insert " \"" (file-name-sans-extension lib) "\"") - (warn "Couldn't find absolute path for: %s" path))))))) - ;; Run each form in autoloads to see if there are any - ;; errors. We do it piecemeal because that will tell us - ;; more about where the issue originated. - (save-excursion - (backward-char) - (setq current-sexp (read (thing-at-point 'sexp t))) - (eval current-sexp t)) - (forward-char))) + (insert ";;; -*- lexical-binding:t -*-\n" + ";; This file is autogenerated by `doom//reload-autoloads', DO NOT EDIT !!\n\n") + ;; insert package autoloads + (dolist (file (doom-packages--files doom-packages-dir "-autoloads\\.el$")) + (when doom-debug-mode + (message "⚠ Including %s" (file-relative-name file package-user-dir))) + (let ((pfile (prin1-to-string file))) + (insert "\n(let ((load-file-name " pfile "))") + (insert-file-contents file) + (while (re-search-forward "#\\$\\|^;\\(.*\n\\)" nil 'move) + (unless (nth 8 (syntax-ppss)) + (replace-match (if (match-end 1) "" pfile) t t))) + (unless (bolp) (insert "\n")) + (insert ")\n"))) + (message "✓ Package autoloads included") + + (goto-char (point-max)) + (insert " +;; Local\sVariables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; End:\n") + (eval-buffer buf) (save-buffer) (message "Done!")) ('error (delete-file doom-autoload-file) - (error "Error in autoloads.el: (%s %s ...) %s -- %s" - (nth 0 current-sexp) - (nth 1 current-sexp) + (error "Error in autoloads.el: %s -- %s" (car ex) (error-message-string ex)))) (kill-buffer buf)))))) diff --git a/core/core.el b/core/core.el index 3037bf2c7..1c80302ca 100644 --- a/core/core.el +++ b/core/core.el @@ -107,10 +107,6 @@ XDG directory conventions if ~/.config/doom exists.") (defvar doom-init-hook nil "A list of hooks run when DOOM is initialized.") -(defvar doom-internal-init-hook nil - "Hooks run after Doom has loaded all init.el files, and is ready to load -modules.") - ;; ;; Emacs fixes/hacks