Note to package developers: compat.el hasn't yet been published, and should not yet be added as a dependency. The official release of the package will coincide with the release of Emacs 28.1.
Find here the source for compat.el, a forwards-compatibility library for (GNU) Emacs Lisp, versions 24.3 and newer.
The intended audience of this library aren't day-to-day users, but package developers that wish to make use of newer functionality, not provided in older versions of Emacs, without breaking compatibility for users bound to specific Emacs releases.
Version 24.3 is chosen as the oldest version, because this is the newest version on CentOS 7. It is intended to preserve compatibility for at least as the Centos 7 reaches EOL, 2024.
compat.el shouldn't be installed directly, but downloaded from GNU ELPA. If necessary, this can be done using M-x package-install-file in the current working directory.
The intended use-case for this library is for package developers to add as a dependency in the header:
;; Package-Requires: ((emacs "24.3") (compat "126.96.36.199"))
No further action should be required afterwards. The effect should be that all the functions and macros that compat.el provides are automatically accessible or made accessible as soon as the right libraries are loaded.
As compat.el is distribed as part of GNU ELPA, and therefore requires a copyright assignment to the FSF, for all non-trivial code contributions.
Patches, bug reports and comments can be sent to the mailing list
or via GitHub. These may include issues in the compatibility code, missing definitions or performance issues.
When contributing, make sure to provide test and use the existing tests defined in compat-test.el. These can be easily executed using the bundled Makefile:
compat.el and all other files in this directory are distributed under the GPL, Version 3 (like Emacs itself).