Keep backup of errant autoloads files

This commit is contained in:
Henrik Lissner 2018-06-19 16:42:10 +02:00
parent d6706734a2
commit 2e92f8d8a8
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -342,16 +342,15 @@ it exists."
(defun doom--byte-compile-file (file) (defun doom--byte-compile-file (file)
(let ((short-name (file-name-nondirectory file)) (let ((short-name (file-name-nondirectory file))
(byte-compile-dynamic-docstrings t)) (byte-compile-dynamic-docstrings t))
(condition-case-unless-debug ex (condition-case e
(when (byte-compile-file file) (when (byte-compile-file file)
(load (byte-compile-dest-file file) nil t) (load (byte-compile-dest-file file) nil t)
(unless noninteractive (unless noninteractive
(message "Finished compiling %s" short-name))) (message "Finished compiling %s" short-name)))
('error ((debug error)
(copy-file file (concat file ".bk") 'overwrite)
(doom-delete-autoloads-file file) (doom-delete-autoloads-file file)
(error "Error in %s: %s -- %s" (signal 'doom-autoload-error (list short-name e))))))
short-name
(car ex) (error-message-string ex))))))
(defun doom-reload-autoloads (&optional file force-p) (defun doom-reload-autoloads (&optional file force-p)
"Reloads FILE (an autoload file), if it needs reloading. "Reloads FILE (an autoload file), if it needs reloading.