Refactor autoloads init & error handling

Also reduces byte-compiled forms in the backtrace of a
doom-autoload-error.
This commit is contained in:
Henrik Lissner 2018-06-19 17:19:11 +02:00
parent 279ee3cc8c
commit 0fefc43d39
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 17 additions and 11 deletions

View file

@ -345,11 +345,17 @@ it exists."
(byte-compile-dynamic-docstrings t))
(condition-case e
(when (byte-compile-file file)
(load (byte-compile-dest-file file) nil t)
;; Give autoloads file a chance to report error
(load (if doom-debug-mode
file
(byte-compile-dest-file file))
nil t)
(unless noninteractive
(message "Finished compiling %s" short-name)))
((debug error)
(copy-file file (concat file ".bk") 'overwrite)
(let ((backup-file (concat file ".bk")))
(message "Copied backup to %s" backup-file)
(copy-file file backup-file 'overwrite))
(doom-delete-autoloads-file file)
(signal 'doom-autoload-error (list short-name e))))))