unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Bug reading/writing backquote lists in .elc files
@ 2002-09-30 23:05 Martin Stjernholm
  0 siblings, 0 replies; only message in thread
From: Martin Stjernholm @ 2002-09-30 23:05 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-09-30 23:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-30 23:05 Bug reading/writing backquote lists in .elc files Martin Stjernholm

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).