Emacs Lisp Byte Compile Incompability on 23.1 vs 23.2

By Xah Lee. Date:

Stung by a emacs byte-compile problem. Cost: 2 hours.

Summary: if you are doing elisp dev on more than one machine, best to re-byte-compile the files on the machine if you run into some strange errors.

Byte compiled elisp files should work cross-platform for emacs 23.2. It has been working between my Windows Vista and Mac 10.4.x in the past year. Today, i just byte compiled the whole dir of elisp files on our ErgoEmacs source trunk on my Windows Vista, then synced over to my Mac as a regular routine, then started emacs on my Mac. I keep getting this strange error on my Mac:

Wrong number of arguments: called-interactively-p, 1

Very odd error. Starting emacs with “--debug-init” didn't help. Turning on toggle-debug-on-error while emacs is running didn't help much neither.

I thought some new change i made to ErgoEmacs recently caused the error. So, i started to bebug. Tried to comment out various packages, but it's elusive. One time commenting out loading package X seems to work, but another time no, but commenting out package Y worked. And i thought i was making good progress.

First i thought the problem is the ErgoEmacs Keybinding minor mode. Then i'm sure it's YASnippet. But that's odd, because we haven't touched that package for many months. Then, i think it could be xbbcode-mode.

Very odd error. “Wrong number of arguments”. Thats pretty much the error you'll notice first when you write a new function. And “called-interactively-p”?? In the “*Messages*” buffer, i also saw something about a hook that caused this. Bah, there's lots hooks in ErgoEmacs. The ErgoEmacs keybinding has hooks, yasnippet adds hooks i think. Maybe the new version of PrettyControlL (pp-c-l) i just updated today caused the problem. Recently we also updated to new versions of Tuareg mode for OCaml and also new version of haskell mode.

In short, took me 2 hours to eventually realize that it is the “.elc”. Byte compile the whole elisp dir of packages on the Mac made it work.

How did i realize it? Hard to pinpoint to a logical reason. Just some coding experience i guess.

Emacs 23.2's release notes does not mention any byte-compile incompatible changes.

Not quite sure what's the problem exactly. The emacs on my Windows is Emacs 23.2.1, while on the Mac is 23.1.1.

Note: emacs 22 can't read emacs 23's byte compiled file if the file contains Unicode chars, due to emacs 23's Unicode change. See: Emacs 23.1 New Features (released 2009-07).

Like my tutorial? Put $5 at patreon

Or Buy Xah Emacs Tutorial

Or buy a nice keyboard: Best Keyboard for Emacs

Ask me question on patreon