2

I byte-compile my ~/.emacs.d/init.el. It was done by Emacs 26.1 from Cygwin and I got error when load emacs-nox 25.2 from Debian WSL:

error: Invalid byte opcode: op=183, ptr=2

Were new opcodes introduced into Emacs byte code starting from v26? For what purpose?

I have no issues to load byte compiled files between v22-v25...

1
  • 1
    Pretty much every major Emacs release breaks forward compatibility for .elc files, either by introducing new byte-codes (or macros whose expansion uses new functions). If you were able to use Emacs-25-compiled files under Emacs-22 you were just lucky.
    – Stefan
    Commented Oct 15, 2018 at 12:32

3 Answers 3

3

From NEWS:

* Incompatible Lisp Changes in Emacs 26.1
[...]
** Certain cond/pcase/cl-case forms are now compiled using a faster jump
table implementation.  This uses a new bytecode op 'switch', which
isn't compatible with previous Emacs versions.  This functionality can
be disabled by setting 'byte-compile-cond-use-jump-table' to nil.
6

A solution to this is to delete all compiled EmacsLisp files in the user's Emacs directory

cd ~/.emacs.d/
find . -name "*.elc" -type f 

Once you are satisfacted by what the find command returns (it should only return .elc files), delete them with the -delete option:

find . -name "*.elc" -type f -delete

Then restart Emacs and they will be regenerated when needed.

I added this as a function to my .bashrc because I honnestly use it all the time and I hate to have to search for the find syntax each time.

2

One way to handle this is to have dedicated package directories for each Emacs version. You can do this by placing the following in your init file:

(setq package-user-dir (concat "~/.emacs.d/elpa/" emacs-version))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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