9

I have a couple packages now, and in the PackageRequires section I would like to put all the packages I require in it, put it seems like it requires the name and version. Where do you determine the version number? For example I have (cl-lib "0.5"), but whats the best way to determine the minimum version I can use? I can see the current version, but what is the best way to determine the min value needed? Also, some packages required don't have a version specified in their file. In those cases, what is recommended?

7

Use the version for which you wrote the package. That's the safest baseline you can get, unless you explicitly check every function you use. From there on, you can only hope that the maintainers of that package never silently break backwards compatibility…

As for packages which don't even have any version number, I'd not use them at all. If the maintainer doesn't even bother for proper versioning, how can you trust them with anything else?

1

My recommendation:

  • Start with the functions, variables, macros, etc. that your code actually uses. If it uses something that was introduced in a given version of Emacs or of the function's source library, then start with that as your minimum version.

  • The version of the function that you use might not correspond to the original version of the function, when it was first introduced. Perhaps more arguments were added. Check whether that matters for your particular use of it. If not then you can ignore this. If yes, then that find the oldest source version that supports what your code expects.

  • Test. Get a copy of whatever version of the library you claim you support as a minimum, and try it.

  • Sometimes minor changes have been made to a function, and your code does not fundamentally need a newer version. But it might need to be adapted, to support more than one version (if that's what you want). You might need to test whether the function exists (fboundp) or has the right signature/calling sequence. For the latter, subr-arity can help with built-ins, but you might need to use condition-case for Lisp functions (calling with the expanded number of args, and handling a wrong-number-of-args error by calling with fewer args).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.