unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Martin Stjernholm <mast@lysator.liu.se>
Subject: Bug reading/writing backquote lists in .elc files
Date: 01 Oct 2002 01:05:59 +0200	[thread overview]
Message-ID: <5b8z1jqdrc.fsf@lister.roxen.com> (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.

                 reply	other threads:[~2002-09-30 23:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5b8z1jqdrc.fsf@lister.roxen.com \
    --to=mast@lysator.liu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).