Warn user to sync+rebuild on emacs' major version change
Byte-code is not generally compatible across major releases of Emacs, and packages may have changed in that time. Best throw a more helpful error than leave users to deal with the obscure errors that this can cause.
This commit is contained in:
parent
2ccb9cc8a3
commit
2c70b75c6c
2 changed files with 18 additions and 8 deletions
|
@ -32,7 +32,9 @@ one wants that.")
|
|||
(cl-check-type file string)
|
||||
(and (print! (start "Generating core autoloads..."))
|
||||
(doom-cli--write-autoloads
|
||||
file (doom-cli--generate-autoloads
|
||||
file
|
||||
(doom-cli--generate-emacs-version-check)
|
||||
(doom-cli--generate-autoloads
|
||||
(cl-loop for dir
|
||||
in (append (list doom-core-dir)
|
||||
(cdr (doom-module-load-path 'all-p))
|
||||
|
@ -105,6 +107,12 @@ one wants that.")
|
|||
(print! "M-x doom/restart")
|
||||
(print! "M-x doom/reload")))
|
||||
|
||||
(defun doom-cli--generate-emacs-version-check ()
|
||||
`((unless (equal emacs-major-version (eval-when-compile emacs-major-version))
|
||||
(signal 'doom-error
|
||||
(list "Your installed (major) version of Emacs has changed"
|
||||
"Run 'doom sync && doom build' to bring Doom up to speed")))))
|
||||
|
||||
(defun doom-cli--generate-var-cache (vars)
|
||||
`((setq ,@(cl-loop for var in vars
|
||||
append `(,var ',(symbol-value var))))))
|
||||
|
|
|
@ -101,6 +101,8 @@ Return t on success, nil otherwise (but logs a warning)."
|
|||
;; `string-remove-suffix' is much cheaper (because it does no file sanity
|
||||
;; checks during or after; just plain ol' string manipulation).
|
||||
(load (string-remove-suffix ".el" file) noerror 'nomessage)
|
||||
(doom-error
|
||||
(signal (car e) (cdr e)))
|
||||
((debug error)
|
||||
(message "Autoload file error: %s -> %s" (file-name-nondirectory file) e)
|
||||
nil)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue