doom//byte-compile: better error handling (revert on error)
This commit is contained in:
parent
1873a48e71
commit
3bbb78f779
1 changed files with 36 additions and 27 deletions
|
@ -634,6 +634,8 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
|
|||
(error "No targets to compile"))
|
||||
(let ((use-package-expand-minimally t))
|
||||
(push (expand-file-name "init.el" doom-emacs-dir) compile-targets)
|
||||
(condition-case ex
|
||||
(progn
|
||||
(dolist (target compile-targets)
|
||||
(when (or (not recompile-p)
|
||||
(let ((elc-file (byte-compile-dest-file target)))
|
||||
|
@ -660,7 +662,14 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
|
|||
"%s %s file(s) %s"
|
||||
(if recompile-p "Recompiled" "Compiled")
|
||||
(format "%d/%d" total-ok (- (length compile-targets) total-noop))
|
||||
(format "(%s ignored)" total-noop)))))))))
|
||||
(format "(%s ignored)" total-noop)))))
|
||||
(error
|
||||
(message! (red "\n%%s\n\n%%s\n\n%%s")
|
||||
"There were breaking errors."
|
||||
(error-message-string ex)
|
||||
"Reverting changes...")
|
||||
(doom//clean-byte-compiled-files)
|
||||
(message! (green "Finished (nothing was byte-compiled)")))))))))
|
||||
|
||||
(defun doom//byte-compile-core (&optional recompile-p)
|
||||
"Byte compile the core Doom files.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue