diff --git a/core/autoload/modules.el b/core/autoload/modules.el index 459f31994..b519716e5 100644 --- a/core/autoload/modules.el +++ b/core/autoload/modules.el @@ -122,7 +122,8 @@ modified." doom-autoload-file)) (not (cl-loop for file in targets if (file-newer-than-file-p file doom-autoload-file) - return t))) + return t)) + (doom-same-emacs-version-p)) (ignore (print! (green "Doom core autoloads is up-to-date")) (doom-initialize-autoloads doom-autoload-file)) (doom-delete-autoloads-file doom-autoload-file) @@ -202,7 +203,8 @@ This should be run whenever your `doom!' block or update your packages." (cl-loop for key being the hash-keys of (doom-module-table) for path = (doom-module-path (car key) (cdr key) "packages.el") if (file-newer-than-file-p path doom-package-autoload-file) - return t)))) + return t))) + (doom-same-emacs-version-p)) (ignore (print! (green "Doom package autoloads is up-to-date")) (doom-initialize-autoloads doom-package-autoload-file)) (doom-delete-autoloads-file doom-package-autoload-file) diff --git a/core/core-dispatcher.el b/core/core-dispatcher.el index ffb301334..e37b3bdbb 100644 --- a/core/core-dispatcher.el +++ b/core/core-dispatcher.el @@ -1,5 +1,32 @@ ;;; -*- lexical-binding: t; no-byte-compile: t; -*- +;; Do an Emacs version check and warn the user if it has changed. +(defvar doom--last-emacs-file (concat doom-local-dir "emacs-version.el")) +(defvar doom--last-emacs-version nil) + +(defun doom-refresh-emacs-version () + (with-temp-file doom--last-emacs-file + (princ `(setq doom--last-emacs-version ,(prin1-to-string emacs-version)) + (current-buffer)))) + +(defun doom-same-emacs-version-p () + (if (or doom--last-emacs-version + (load doom--last-emacs-file t t t)) + (equal emacs-version doom--last-emacs-version) + (setq doom--last-emacs-version emacs-version) + (doom-refresh-emacs-version) + t)) + +(unless (doom-same-emacs-version-p) + (unless (y-or-n-p + (format (concat "Your version of Emacs has changed from %s to %s, which may cause incompatibility\n" + "issues. Please run `bin/doom compile :plugins` afterwards to resolve any problems.\n\n" + "Continue?") + doom--last-emacs-version + emacs-version)) + (error "Aborting")) + (doom-refresh-emacs-version)) + ;; Eagerly load these libraries because this module may be loaded in a session ;; that hasn't been fully initialized (where autoloads files haven't been ;; generated or `load-path' populated).