8

I alternatively run 24.5 and 25.0.50. Unfortunately, packages installed and compiled from 25.0.50 don't work with Emacs 24.5 (cl-struct-define is a common culprit).

One trivial solution is to not byte-compile anything. That makes things pretty slow, though.

How can I use compiled packages (for performance) while using the same .emacs.d for both 24.5 and 25.0.50? I'd also be ok with 24.5 ignoring the compiled files.

  • This question is similar, but not exactly the same: it focuses on easily keeping a bunch of versions side by side for testing purposes, but it doesn't discuss byte-compiled files at all. – Clément Jun 18 '15 at 0:14
  • 3
    I set package-user-dir and few other dirs and files based on emacs version. I can write a detailed answer when I am at a computer. – Kaushal Modi Jun 18 '15 at 1:28
  • @kaushalmodi: Won't that force me to install each package twice? – Clément Jun 18 '15 at 8:28
  • Yes. Each package is installed multiple times (and each installation folder will have that emacs version specific byte compiled files). But you don't do that manually. I maintain an alist in my init.el and all those packages are auto-installed on emacs startup (if not already installed). You can even use the :ensure keyword of use-package to auto-install packages. – Kaushal Modi Jun 18 '15 at 11:07
3

Put the byte-compiled files for different Emacs versions in different directories. Make your load-path conditional on the Emacs version you are running, so that you load the appropriate byte-compiled libraries.

  • 2
    (IMO, it's too bad that Emacs dev no longer makes an effort to maintain forward compatibility for byte-compiled files. It used to be the case that you could use a library compiled using an older version in a newer version. You might not have been able to take advantage of a few new features, but generally there was no problem. This is still the case for most things, but for less and less, unfortunately.) – Drew Jun 18 '15 at 1:14
  • Thanks, that's a nice idea. Is there a way to make the package manager put elc files in that version-specific directory though? Some sort of default destination for byte-compile-file maybe? – Clément Jun 18 '15 at 8:26
  • Dunno; sorry. Someone else will hopefully answer that question. I'm not an expert on the pkg mgr. I would think (&hope) that the answer is yes, that it provides an easy way to do that. – Drew Jun 18 '15 at 13:40

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.