emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

package.el: bytecode portability across emacs versions


From: Trent Buck
Subject: package.el: bytecode portability across emacs versions
Date: Mon, 21 May 2007 23:47:47 +1000
User-agent: Mutt/1.5.13 (2006-08-11)

Arbitrary emacs lisp cannot be byte-compiled in one version of Emacs
and loaded in another, as the following transcript shows:

| $ emacs-snapshot-nox --version
| GNU Emacs 22.1.50.1
| Copyright (C) 2007 Free Software Foundation, Inc.
| GNU Emacs comes with ABSOLUTELY NO WARRANTY.
| You may redistribute copies of Emacs
| under the terms of the GNU General Public License.
| For more information about these matters, see the file named COPYING.
| $ emacs-unicode-2 --version
| GNU Emacs 23.0.0.1
| Copyright (C) 2007 Free Software Foundation, Inc.
| GNU Emacs comes with ABSOLUTELY NO WARRANTY.
| You may redistribute copies of Emacs
| under the terms of the GNU General Public License.
| For more information about these matters, see the file named COPYING.
| $ cat >tmp.el
| (unless (= (eval-when-compile emacs-major-version)
|            emacs-major-version)
|   (error "bytecode is not portable!"))
| $ emacs-snapshot-nox -batch -Q -eval '(load (expand-file-name "tmp"))'
| Loading /home/twb/Desktop/tmp.el (source)...
| $ emacs-unicode-2-nox -batch -Q -eval '(load (expand-file-name "tmp"))'
| Loading /home/twb/Desktop/tmp.el (source)...
| $ emacs-snapshot-nox -batch -Q -f batch-byte-compile tmp.el
| Wrote /home/twb/Desktop/tmp.elc
| $ emacs-snapshot-nox -batch -Q -eval '(load (expand-file-name "tmp"))'
| Loading /home/twb/Desktop/tmp...
| $ emacs-unicode-2-nox -batch -Q -eval '(load (expand-file-name "tmp"))'
| Loading /home/twb/Desktop/tmp...
| bytecode is not portable!

This is most obvious in the wild in emacs-w3m, but I've had problems
with other packages also.

package.el appears to create bytecode in a common directory.  Unless
code is carefully audited, any time .emacs.d is shared between
multiple emacsen packages errors can be expected.

Recommendation: either 0) tell users not to run more than one emacs;
1) don't byte-compile; or 2) place bytecode in path(s) local to the
current emacs-version.

Debian's elisp package framework adopts (2), that might be a source of
inspiration.  Through rampant lethargy I have historically used (1)
for my .emacs.d/lisp/.  It may also be worth looking at how
Debian's/Gentoo's common-lisp-controller package handles "local" fasl
files.
-- 
Trent Buck

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]