[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug reading/writing backquote lists in .elc files
From: |
Martin Stjernholm |
Subject: |
Bug reading/writing backquote lists in .elc files |
Date: |
01 Oct 2002 01:05:59 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
There seems to be a bug when backquote lists are written to or read
from byte compiled files. To reproduce, put the following in a file,
say test.el:
(defmacro macro-1 (arg) (list 'quote arg))
(message "macro-1: %S" (macro-1 `(,@(if t '(1)) ,@(if t '(2)))))
(defmacro macro-2 (&rest arg) (list 'quote (list arg)))
(message "macro-2: %S" (macro-2 `(,@(if t '(1)) ,@(if t '(2)))))
Load test.el in batch mode:
> emacs -q -no-site-file -batch -l test.el
macro-1: (\` ((\,@ (if t (quote (1)))) (\,@ (if t (quote (2))))))
macro-2: ((\` ((\,@ (if t (quote (1)))) (\,@ (if t (quote (2)))))))
The above is the output I get (and expect). The first line is only for
comparison; it's the result from macro-2 that becomes wrong. Now byte
compile test.el and load the generated test.elc in batch mode:
> emacs -q -no-site-file -batch -f batch-byte-compile test.el
Wrote /home/mast/elisp/cc-mode/test.elc
Done
> emacs -q -no-site-file -batch -l test.elc
macro-1: (\` ((\,@ (if t (quote (1)))) (\,@ (if t (quote (2))))))
macro-2: (\` (\,@ (if t (quote (1))) \,@ (if t (quote (2)))))
Notice that several list levels are now missing in the macro-2 result;
the lists surrounding the \` and ,@ sexps are gone. Needless to say, a
backquote structure that has been mangled in this way no longer
generates the same result when evaluated.
Workaround: Do (eval-when-compile (cl-macroexpand-all x)) for each x
that might be a backquote structure.
I've verified this in Emacs 21.2, and also in 20.7 and 19.34. XEmacs
doesn't have this problem.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Bug reading/writing backquote lists in .elc files,
Martin Stjernholm <=