From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Martin Stjernholm Newsgroups: gmane.emacs.bugs Subject: Bug reading/writing backquote lists in .elc files Date: 01 Oct 2002 01:05:59 +0200 Sender: bug-gnu-emacs-admin@gnu.org Message-ID: <5b8z1jqdrc.fsf@lister.roxen.com> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1033427214 29660 127.0.0.1 (30 Sep 2002 23:06:54 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 30 Sep 2002 23:06:54 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17w9cq-0007iE-00 for ; Tue, 01 Oct 2002 01:06:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17w9d6-0001lx-00; Mon, 30 Sep 2002 19:07:08 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17w9c7-0001eS-00 for bug-gnu-emacs@gnu.org; Mon, 30 Sep 2002 19:06:07 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17w9c3-0001dh-00 for bug-gnu-emacs@gnu.org; Mon, 30 Sep 2002 19:06:06 -0400 Original-Received: from godzilla.roxen.com ([194.52.182.190] helo=mail.roxen.com) by monty-python.gnu.org with esmtp (Exim 4.10) id 17w9c3-0001dH-00 for bug-gnu-emacs@gnu.org; Mon, 30 Sep 2002 19:06:03 -0400 Original-Received: from lister.roxen.com (lister.roxen.com [194.52.182.147]) by mail.roxen.com (Postfix) with ESMTP id 66231993E for ; Tue, 1 Oct 2002 01:05:59 +0200 (MEST) Original-To: bug-gnu-emacs@gnu.org Original-Lines: 37 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Errors-To: bug-gnu-emacs-admin@gnu.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.bugs:3609 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:3609 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.