Move emacs version check into doom-initialize

Also fixes void-function errors caused by (now removed)
doom-same-emacs-version-p not being defined in all the contexts it was
needed.

Where it was before was clumsy design.
This commit is contained in:
Henrik Lissner 2018-06-05 11:18:36 +02:00
parent 7b1a83079d
commit 282e0d6653
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 33 additions and 32 deletions

View file

@ -1,32 +1,5 @@
;;; -*- 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).