branch: externals/compat
commit 34463680d51316441c54920e90e7ac010c18b50e
Author: Daniel Mendler <m...@daniel-mendler.de>
Commit: Daniel Mendler <m...@daniel-mendler.de>

    Add runtime version check
    
    We must make sure that we don't load Compat in an incompatible Emacs 
version.
---
 NEWS.org       | 2 ++
 compat-macs.el | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/NEWS.org b/NEWS.org
index 66e0bd5fab..51912c1e5a 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -7,6 +7,8 @@
   compatibility aliases, functions, macros and variables are installed.
 - Remove deprecated, prefixed compatibility functions.
 - Remove deprecated features ~compat-help~, ~compat-font-lock~ and ~compat-24~.
+- Compat will check that the Emacs version which was used to compile Compat
+  equals the Emacs version at runtime.
 
 * Release of "Compat" Version 29.1.0.1
 
diff --git a/compat-macs.el b/compat-macs.el
index 4c9eda4f74..0d9a8b4f92 100644
--- a/compat-macs.el
+++ b/compat-macs.el
@@ -31,7 +31,9 @@
 (defmacro compat-declare-version (version)
   "Set the Emacs version that is currently being handled to VERSION."
   (setq compat--current-version version)
-  nil)
+  `(unless (equal emacs-version ,emacs-version)
+     (error ,(format "Compat was compiled with Emacs %s, you are running %%s" 
emacs-version)
+            emacs-version)))
 
 (defun compat--format-docstring (type name docstring)
   "Format DOCSTRING for NAME of TYPE.

Reply via email to