Refactor autoloads generator & reduce to one generated file
We no longer need two separate autoloads files, so I merged them and optimized its generation logic. Other changes - Doom will refuse to start up (with a helpful error) if it's in an incomplete state. This should hopefully reduce the number of bug reports from folks that have done something weird, e.g. 1. You've changed Emacs versions without running 'doom sync -b'. 2. You've updated Doom outside of `doom upgrade` and didn't run `doom sync -u`. 3. You've forgotten to run 'doom sync' in the first place! 4. If a previous 'doom ...' command was aborted midway without running 'doom sync' afterwards. - 'doom sync' will emit reminders that you need to reload/restart Emacs - Autoloads API now uses the `doom-autoloads-` prefix, intead of 'doom-cli-autoloads-', as will be the new convention in the coming rewrite. - Errors from within the package autoloads should be easier to invoke the debugger on. - `doom-modules` is now stored in your autoloads file. Your module list will soon be frozen between calls to 'doom sync' to allow for our new, atomic CLI I'm working on. This will also means the `doom!` block won't cost anything in interactive sessions.
This commit is contained in:
parent
be889d09e8
commit
e6c88e4384
8 changed files with 98 additions and 143 deletions
40
core/core.el
40
core/core.el
|
@ -127,12 +127,6 @@ whichever is found first. Must end in a slash.")
|
|||
This file is responsible for informing Emacs where to find all of Doom's
|
||||
autoloaded core functions (in core/autoload/*.el).")
|
||||
|
||||
(defconst doom-package-autoload-file (concat doom-local-dir "autoloads.pkg.el")
|
||||
"Where `doom-reload-package-autoloads' stores its package autoloads.
|
||||
|
||||
This file is compiled from the autoloads files of all installed packages
|
||||
combined.")
|
||||
|
||||
(defconst doom-env-file (concat doom-local-dir "env")
|
||||
"The location of your envvar file, generated by `doom env`.
|
||||
|
||||
|
@ -487,23 +481,23 @@ to least)."
|
|||
load-path doom--initial-load-path
|
||||
process-environment doom--initial-process-environment)
|
||||
|
||||
(or (and
|
||||
;; `doom-autoload-file' tells Emacs where to load all its functions
|
||||
;; from. This includes everything in core/autoload/*.el and
|
||||
;; autoload files in enabled modules.
|
||||
(or (doom-load-autoloads-file doom-autoload-file)
|
||||
(ignore (warn "Doom's core autoloads file is missing")))
|
||||
;; Loads `doom-package-autoload-file', which loads a concatenated
|
||||
;; package autoloads file which caches `load-path',
|
||||
;; `auto-mode-alist', `Info-directory-list', and
|
||||
;; `doom-disabled-packages'. A big reduction in startup time.
|
||||
(or (doom-load-autoloads-file doom-package-autoload-file)
|
||||
(ignore (warn "Doom's package autoloads file is missing"))))
|
||||
;; If neither autoloads file loads, then the user forgot to sync, or
|
||||
;; aborted a doom command midway!
|
||||
(signal 'doom-error
|
||||
(list "Doom is in an incomplete state"
|
||||
"run 'bin/doom sync' on the command line to repair it")))
|
||||
;; Doom caches a lot of information in `doom-autoload-file'. Module and
|
||||
;; package autoloads, autodefs like `set-company-backend!', and variables
|
||||
;; like `doom-modules', `doom-disabled-packages', `load-path',
|
||||
;; `auto-mode-alist', and `Info-directory-list'. etc. Compiling them into
|
||||
;; one place is a big reduction in startup time.
|
||||
(condition-case e
|
||||
;; Avoid `file-name-sans-extension' for premature optimization reasons.
|
||||
;; `string-remove-suffix' is cheaper because it performs no file sanity
|
||||
;; checks; just plain ol' string manipulation.
|
||||
(load (string-remove-suffix ".el" doom-autoload-file)
|
||||
nil 'nomessage)
|
||||
(file-missing
|
||||
;; If the autoloads file fails to load then the user forgot to sync, or
|
||||
;; aborted a doom command midway!
|
||||
(signal 'doom-error
|
||||
(list "Doom is in an incomplete state"
|
||||
"run 'bin/doom sync' on the command line to repair it"))))
|
||||
|
||||
;; Load shell environment, optionally generated from 'doom env'. No need
|
||||
;; to do so if we're in terminal Emacs, where Emacs correctly inherits
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue