Hello,
I’d like to use the new subr-x library in my Emacs Lisp projects, and I’m searching for advice on how to handle backwards compatibility.
As you know, subr-x was only recently introduced in Emacs trunk, and is not available in any Emacs release. Currently, I simply copy those functions that I need into my code, guarding their definition with `(unless (features 'subr-x) …)'.
This scales poorly across many projects, obviously, so I’d like to know if there is a better approach to handle this problem. Is their a compatibility package for subr-x on GNU ELPA, similar to cl-lib?
While this could be done, there a few caveats:
* subr-x should be considered a built-in package
* newer version might have less functions than older one as ideally parts of subr-x will be promoted to subr
* the compatibility package should check for the presence of each function prior to defining it (follows from the previous bullet point)
Of course, this is part of a much bigger issue as things get constantly added to various Emacs libraries and using them and staying backwards compatible is always problematic. I don’t think we need a subr-x backwards compatibility package, we need an Emacs backwards compatibility package. Perhaps it would include stuff from a few past releases and define the things conditionally if not present?
Greetings,
Sebastian Wiesner