core-cli: backport more refactors from rewrite
Still a long way to go, but this introduces a few niceties for debugging CLI failures: + The (extended) output of the last bin/doom command is now logged to ~/.emacs.d/.local/doom.log + If an error occurs, short backtraces are displayed whether or not you have debug mode on. The full backtrace is written to ~/.emacs.d/.local/doom.error.log. + bin/doom now aborts with a warning if: - The script itself or its parent directory is a symlink. It's fine if ~/.emacs.d is symlinked though. - Running bin/doom as root when your DOOMDIR isn't in /root/. - If you're sporting Emacs 26.1 (now handled in the elisp side rather than the /bin/sh shebang preamble). + If a 'doom sync' was aborted prematurely, you'll be warned that Doom was left in an inconsistent state and that you must run `doom sync` again. May address #3746
This commit is contained in:
parent
7e362e8fbd
commit
e632871a11
11 changed files with 393 additions and 242 deletions
12
core/core.el
12
core/core.el
|
@ -127,7 +127,7 @@ Use this for files that change often, like cache files. Must end with a slash.")
|
|||
Defaults to ~/.config/doom, ~/.doom.d or the value of the DOOMDIR envvar;
|
||||
whichever is found first. Must end in a slash.")
|
||||
|
||||
(defconst doom-autoload-file (concat doom-local-dir "autoloads.el")
|
||||
(defconst doom-autoloads-file (concat doom-local-dir "autoloads.el")
|
||||
"Where `doom-reload-core-autoloads' stores its core autoloads.
|
||||
|
||||
This file is responsible for informing Emacs where to find all of Doom's
|
||||
|
@ -492,7 +492,7 @@ If RETURN-P, return the message as a string instead of displaying it."
|
|||
"Bootstrap Doom, if it hasn't already (or if FORCE-P is non-nil).
|
||||
|
||||
The bootstrap process ensures that everything Doom needs to run is set up;
|
||||
essential directories exist, core packages are installed, `doom-autoload-file'
|
||||
essential directories exist, core packages are installed, `doom-autoloads-file'
|
||||
is loaded (failing if it isn't), that all the needed hooks are in place, and
|
||||
that `core-packages' will load when `package' or `straight' is used.
|
||||
|
||||
|
@ -524,7 +524,7 @@ to least)."
|
|||
load-path doom--initial-load-path
|
||||
process-environment doom--initial-process-environment)
|
||||
|
||||
;; Doom caches a lot of information in `doom-autoload-file'. Module and
|
||||
;; Doom caches a lot of information in `doom-autoloads-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
|
||||
|
@ -533,15 +533,15 @@ to least)."
|
|||
;; 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)
|
||||
(load (string-remove-suffix ".el" doom-autoloads-file)
|
||||
nil 'nomessage)
|
||||
(file-missing
|
||||
;; If the autoloads file fails to load then the user forgot to sync, or
|
||||
;; aborted a doom command midway!
|
||||
(if (equal (nth 3 e) doom-autoload-file)
|
||||
(if (equal (nth 3 e) doom-autoloads-file)
|
||||
(signal 'doom-error
|
||||
(list "Doom is in an incomplete state"
|
||||
"run 'bin/doom sync' on the command line to repair it"))
|
||||
"run 'doom sync' on the command line to repair it"))
|
||||
;; Otherwise, something inside the autoloads file is triggering this
|
||||
;; error; forward it!
|
||||
(apply #'doom-autoload-error e))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue