refactor(cli): throw error if Doom fails to load
This commit is contained in:
parent
3505e666a8
commit
c747d218ae
1 changed files with 8 additions and 4 deletions
12
bin/doom
12
bin/doom
|
@ -74,13 +74,17 @@
|
||||||
;; - The user may have a noexec flag set on /tmp, so pass the exit script to
|
;; - The user may have a noexec flag set on /tmp, so pass the exit script to
|
||||||
;; /bin/sh rather than executing them directly.
|
;; /bin/sh rather than executing them directly.
|
||||||
|
|
||||||
|
;; In CLI sessions, prefer correctness over performance.
|
||||||
|
(setq load-prefer-newer t)
|
||||||
|
|
||||||
;; Doom's core sets up everything we need; including `doom-*-dir' variables,
|
;; Doom's core sets up everything we need; including `doom-*-dir' variables,
|
||||||
;; universal defaults, and autoloads for doom-*-initialize functions.
|
;; universal defaults, and autoloads for doom-*-initialize functions.
|
||||||
(condition-case e
|
(condition-case e
|
||||||
(let ((load-prefer-newer t))
|
(let* ((bin-dir (file-name-directory (file-truename load-file-name)))
|
||||||
(load (expand-file-name
|
(init-file (expand-file-name "../early-init.el" bin-dir)))
|
||||||
"../early-init" (file-name-directory (file-truename load-file-name)))
|
(or (and (load init-file nil 'nomessage)
|
||||||
nil 'nomessage))
|
(featurep 'doom))
|
||||||
|
(user-error "Failed to load Doom from %s" init-file)))
|
||||||
;; Prevent ugly backtraces for trivial errors
|
;; Prevent ugly backtraces for trivial errors
|
||||||
(user-error (message "Error: %s" (cadr e))
|
(user-error (message "Error: %s" (cadr e))
|
||||||
(kill-emacs 2)))
|
(kill-emacs 2)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue