GNU bug report logs - #14422
Apply eager-macroexpansion everywhere (eval-region, ...)

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Achim Gratz <Stromeko@HIDDEN>; dated Sun, 19 May 2013 14:28:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 14422 <at> debbugs.gnu.org:


Received: (at 14422) by debbugs.gnu.org; 3 Jun 2013 15:31:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 03 11:31:33 2013
Received: from localhost ([127.0.0.1]:49181 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UjWjM-0006O9-Tm
	for submit <at> debbugs.gnu.org; Mon, 03 Jun 2013 11:31:33 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.182]:32368)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1UjWjK-0006Nu-VE
	for 14422 <at> debbugs.gnu.org; Mon, 03 Jun 2013 11:31:31 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av8EABK/CFFFpYtM/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCwsOJhIUGA0kiB4GwS2RCgOkeoFegxM
X-IPAS-Result: Av8EABK/CFFFpYtM/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCwsOJhIUGA0kiB4GwS2RCgOkeoFegxM
X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="15504433"
Received: from 69-165-139-76.dsl.teksavvy.com (HELO pastel.home)
	([69.165.139.76])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	03 Jun 2013 11:29:25 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id 6B9DD63332; Mon,  3 Jun 2013 11:29:30 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Achim Gratz <Stromeko@HIDDEN>
Subject: Re: bug#14422: 24.3; Eager Macro Expansion
Message-ID: <jwvtxlfz0av.fsf-monnier+emacs@HIDDEN>
References: <87hahz82rh.fsf@HIDDEN>
	<jwvzjvpm6cq.fsf-monnier+emacs@HIDDEN>
	<87mwrcjqlu.fsf@HIDDEN>
	<jwvzjvc482h.fsf-monnier+emacs@HIDDEN>
	<87ehcojm1e.fsf@HIDDEN>
	<jwvd2s841gz.fsf-monnier+emacs@HIDDEN>
Date: Mon, 03 Jun 2013 11:29:30 -0400
In-Reply-To: <jwvd2s841gz.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
	of "Thu, 30 May 2013 17:14:56 -0400")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 14422
Cc: 14422 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> The behavior is still different in a few other cases (where eager macro
> expansion is not performed, typically M-C-x and things like that), but
> I hope to reduce/eliminate them at some point.

It just occurred to me that the patch below which I just installed
covers several of those cases.


        Stefan


--- lisp/emacs-lisp/lisp-mode.el	2013-05-29 14:14:16 +0000
+++ lisp/emacs-lisp/lisp-mode.el	2013-06-03 14:23:31 +0000
@@ -809,6 +809,7 @@
 (defun eval-sexp-add-defvars (exp &optional pos)
   "Prepend EXP with all the `defvar's that precede it in the buffer.
 POS specifies the starting position where EXP was found and defaults to point."
+  (setq exp (macroexpand-all exp))      ;Eager macro-expansion.
   (if (not lexical-binding)
       exp
     (save-excursion





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#14422; Package emacs. Full text available.
Changed bug title to 'Apply eager-macroexpansion everywhere (eval-region, ...)' from '24.3; Eager Macro Expansion' Request was from Stefan Monnier <monnier@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 14422 <at> debbugs.gnu.org:


Received: (at 14422) by debbugs.gnu.org; 30 May 2013 21:16:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 30 17:16:36 2013
Received: from localhost ([127.0.0.1]:43021 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UiAD6-0001qa-4I
	for submit <at> debbugs.gnu.org; Thu, 30 May 2013 17:16:36 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.182]:57031)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>)
	id 1UiAD4-0001qF-CE; Thu, 30 May 2013 17:16:34 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av4EABK/CFFFpYtM/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT
X-IPAS-Result: Av4EABK/CFFFpYtM/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT
X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="15230152"
Received: from 69-165-139-76.dsl.teksavvy.com (HELO pastel.home)
	([69.165.139.76])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	30 May 2013 17:14:51 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id 1918263336; Thu, 30 May 2013 17:14:56 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Achim Gratz <Stromeko@HIDDEN>
Subject: Re: bug#14422: 24.3; Eager Macro Expansion
Message-ID: <jwvd2s841gz.fsf-monnier+emacs@HIDDEN>
References: <87hahz82rh.fsf@HIDDEN>
	<jwvzjvpm6cq.fsf-monnier+emacs@HIDDEN>
	<87mwrcjqlu.fsf@HIDDEN>
	<jwvzjvc482h.fsf-monnier+emacs@HIDDEN>
	<87ehcojm1e.fsf@HIDDEN>
Date: Thu, 30 May 2013 17:14:56 -0400
In-Reply-To: <87ehcojm1e.fsf@HIDDEN> (Achim Gratz's message of "Thu,
	30 May 2013 21:38:21 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 14422
Cc: 14422 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

retitle 14422 Apply eager-macroexpansion everywhere (eval-region, ...)
thanks

> The remaining point is that the ERT test still fails in exactly the same
> way when it is _not_ byte-compiled and batch-tested (like the original
> case in Org), but it produces the correct result when testing in
> interactive mode or in the debugger.  I guess I'm asking for a warning
> for recursive macro expansions that manipulate the same variable both at
> expansion and at runtime in separate macros.  Alternatively if the buggy
> code would always fail in the same way that would at least ensure it can
> be found more easily.

Indeed, that's part of the reason why I introduced this "eager
macroexpansion", which makes it that my previous foo.el test now behaves
identically whether it's byte-compiled or not.

The behavior is still different in a few other cases (where eager macro
expansion is not performed, typically M-C-x and things like that), but
I hope to reduce/eliminate them at some point.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#14422; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 30 May 2013 19:40:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 30 15:40:29 2013
Received: from localhost ([127.0.0.1]:42872 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Ui8i4-0005PK-Ex
	for submit <at> debbugs.gnu.org; Thu, 30 May 2013 15:40:29 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38726)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Ui8i1-0005P7-QQ
	for submit <at> debbugs.gnu.org; Thu, 30 May 2013 15:40:26 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Ui8gO-0004Ve-SM
	for submit <at> debbugs.gnu.org; Thu, 30 May 2013 15:38:49 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-99.2 required=5.0 tests=BAYES_50,USER_IN_WHITELIST
	autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:39126)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Ui8gO-0004VZ-QK
	for submit <at> debbugs.gnu.org; Thu, 30 May 2013 15:38:44 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:40397)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Ui8gK-0004np-69
	for bug-gnu-emacs@HIDDEN; Thu, 30 May 2013 15:38:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Ui8gF-0004T6-3k
	for bug-gnu-emacs@HIDDEN; Thu, 30 May 2013 15:38:40 -0400
Received: from plane.gmane.org ([80.91.229.3]:38626)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Ui8gE-0004Ss-U1
	for bug-gnu-emacs@HIDDEN; Thu, 30 May 2013 15:38:35 -0400
Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Ui8gD-00046p-5A
	for bug-gnu-emacs@HIDDEN; Thu, 30 May 2013 21:38:33 +0200
Received: from pd9eb364b.dip0.t-ipconnect.de ([217.235.54.75])
	by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
	id 1AlnuQ-0007hv-00
	for <bug-gnu-emacs@HIDDEN>; Thu, 30 May 2013 21:38:33 +0200
Received: from Stromeko by pd9eb364b.dip0.t-ipconnect.de with local (Gmexim
	0.1 (Debian)) id 1AlnuQ-0007hv-00
	for <bug-gnu-emacs@HIDDEN>; Thu, 30 May 2013 21:38:33 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-gnu-emacs@HIDDEN
From: Achim Gratz <Stromeko@HIDDEN>
Subject: Re: bug#14422: 24.3; Eager Macro Expansion
Date: Thu, 30 May 2013 21:38:21 +0200
Organization: Linux Private Site
Lines: 51
Message-ID: <87ehcojm1e.fsf@HIDDEN>
References: <87hahz82rh.fsf@HIDDEN>
	<jwvzjvpm6cq.fsf-monnier+emacs@HIDDEN>
	<87mwrcjqlu.fsf@HIDDEN>
	<jwvzjvc482h.fsf-monnier+emacs@HIDDEN>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Complaints-To: usenet@HIDDEN
X-Gmane-NNTP-Posting-Host: pd9eb364b.dip0.t-ipconnect.de
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock: sha1:6L/JWXRVgRlco4mK2X3kGbaxamM=
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
	(bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Stefan Monnier writes:
> I see the test fails, but that's just because the test is wrong.
[…]
> You'll see that your code behaves differently when byte-compiled.

Yes, we've already established that the original code itself had a bug.
The correct code would look like this


--=-=-=
Content-Type: text/x-emacs-lisp
Content-Disposition: inline; filename=eme.el

(defvar eme-ll nil)

(defmacro one (p)
  `(progn (push ',p eme-ll)))

(defmacro two (p)
  `(let ((pp (append eme-ll ',p)))
     (progn (push pp eme-ll))))

(provide 'eme)

--=-=-=
Content-Type: text/plain


The remaining point is that the ERT test still fails in exactly the same
way when it is _not_ byte-compiled and batch-tested (like the original
case in Org), but it produces the correct result when testing in
interactive mode or in the debugger.  I guess I'm asking for a warning
for recursive macro expansions that manipulate the same variable both at
expansion and at runtime in separate macros.  Alternatively if the buggy
code would always fail in the same way that would at least ensure it can
be found more easily.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Wavetables for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables

--=-=-=--





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#14422; Package emacs. Full text available.

Message received at 14422 <at> debbugs.gnu.org:


Received: (at 14422) by debbugs.gnu.org; 30 May 2013 19:02:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 30 15:02:33 2013
Received: from localhost ([127.0.0.1]:42775 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Ui87L-00041h-G0
	for submit <at> debbugs.gnu.org; Thu, 30 May 2013 15:02:32 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.182]:30891)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1Ui87I-00041T-Eh
	for 14422 <at> debbugs.gnu.org; Thu, 30 May 2013 15:02:28 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av4EABK/CFFFpYtM/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT
X-IPAS-Result: Av4EABK/CFFFpYtM/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT
X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="15216678"
Received: from 69-165-139-76.dsl.teksavvy.com (HELO pastel.home)
	([69.165.139.76])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	30 May 2013 15:00:46 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id 139B667579; Thu, 30 May 2013 15:00:51 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Achim Gratz <Stromeko@HIDDEN>
Subject: Re: bug#14422: 24.3; Eager Macro Expansion
Message-ID: <jwvzjvc482h.fsf-monnier+emacs@HIDDEN>
References: <87hahz82rh.fsf@HIDDEN>
	<jwvzjvpm6cq.fsf-monnier+emacs@HIDDEN>
	<87mwrcjqlu.fsf@HIDDEN>
Date: Thu, 30 May 2013 15:00:50 -0400
In-Reply-To: <87mwrcjqlu.fsf@HIDDEN> (Achim Gratz's message of "Thu,
	30 May 2013 19:59:41 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 14422
Cc: 14422 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> Here's the revised test case that compiles cleanly and still has the
> same problem:


> (defvar eme-ll nil)

> (defmacro one (p)
>   `(progn (push ',p eme-ll)))

> (defmacro two (p)
>   (let (pp)
>     (setq pp (append eme-ll p))
>   `(progn (push ',pp eme-ll))))

> (provide 'eme)


> (require 'eme)
> (require 'ert)

 
> (ert-deftest surprise ()
>     (should
>      (equal '((one . two) one)
> 	    (progn
> 	      (one one)
> 	      (two two)
> 	      eme-ll))))

I see the test fails, but that's just because the test is wrong.
Try to create a new file foo.el:

   (require 'eme)
   
   (message "Result = %s"
            (progn
   	      (one one)
   	      (two two)
   	      eme-ll))

Then byte-compile it.  Then do

   emacs23 --batch -Q -l ~/tmp/foo.el
and
   emacs23 --batch -Q -l ~/tmp/foo.elc

You'll see that your code behaves differently when byte-compiled.


        Stefan


Analysis:

  (one one)

will add `one' to eme-ll at run-time.

  (two two)

reads the macroexpansion-time (e.g. compilation-time, load-time, or
run-time) value of eme-ll and adds it to eme-ll at run-time.

  eme-ll

returns the run-time value of eme-ll.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#14422; Package emacs. Full text available.

Message received at 14422 <at> debbugs.gnu.org:


Received: (at 14422) by debbugs.gnu.org; 30 May 2013 18:01:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 30 14:01:30 2013
Received: from localhost ([127.0.0.1]:42685 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Ui7AI-0001dZ-20
	for submit <at> debbugs.gnu.org; Thu, 30 May 2013 14:01:30 -0400
Received: from mail-in-07.arcor-online.net ([151.189.21.47]:36272)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <Stromeko@HIDDEN>) id 1Ui7AD-0001d8-Qf
	for 14422 <at> debbugs.gnu.org; Thu, 30 May 2013 14:01:28 -0400
Received: from mail-in-11-z2.arcor-online.net (mail-in-11-z2.arcor-online.net
	[151.189.8.28]) by mx.arcor.de (Postfix) with ESMTP id 39872108BF7;
	Thu, 30 May 2013 19:59:49 +0200 (CEST)
Received: from mail-in-01.arcor-online.net (mail-in-01.arcor-online.net
	[151.189.21.41])
	by mail-in-11-z2.arcor-online.net (Postfix) with ESMTP id 3DA467FF625; 
	Thu, 30 May 2013 19:59:49 +0200 (CEST)
Received: from Rainer.invalid (pD9EB05C3.dip0.t-ipconnect.de [217.235.5.195])
	(Authenticated sender: stromeko@HIDDEN)
	by mail-in-01.arcor-online.net (Postfix) with ESMTPSA id CC7885B034;
	Thu, 30 May 2013 19:59:48 +0200 (CEST)
X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-01.arcor-online.net CC7885B034
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=nexgo.de; s=mail-in;
	t=1369936789; bh=uRuCzZ+doxErwoywgMCFRjwJRatmYsAdD5DhKQhd8B0=;
	h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID:
	MIME-Version:Content-Type;
	b=sFf6YzpyL9FpRRHuIbZCdoGRfcvG01jssFqHdE/sUgnpU5ZiyjsqKCVJC8ELx5x+X
	o4wlvaIsos2qwWSqGlYO/WatUKb5Ns+Z1ynojjvgbqked1Uh179+/LJ4neb7wyGbkQ
	1rKzhC+rUaCg6V1dhVa8oCrm6uZgTnVquiMC9Wvw=
From: Achim Gratz <Stromeko@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#14422: 24.3; Eager Macro Expansion
References: <87hahz82rh.fsf@HIDDEN>
	<jwvzjvpm6cq.fsf-monnier+emacs@HIDDEN>
Date: Thu, 30 May 2013 19:59:41 +0200
In-Reply-To: <jwvzjvpm6cq.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
	of "Mon, 20 May 2013 22:11:15 -0400")
Message-ID: <87mwrcjqlu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 14422
Cc: 14422 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

--=-=-=
Content-Type: text/plain

Stefan Monnier writes:
> So the code has a problem, since byte-compiling it doesn't work
> (emacs24 is 24.1, here).  No wonder eager macro-expansion also leads
> to problems.

Here's the revised test case that compiles cleanly and still has the
same problem:


--=-=-=
Content-Type: text/x-emacs-lisp
Content-Disposition: inline; filename=eme.el

(defvar eme-ll nil)

(defmacro one (p)
  `(progn (push ',p eme-ll)))

(defmacro two (p)
  (let (pp)
    (setq pp (append eme-ll p))
  `(progn (push ',pp eme-ll))))

(provide 'eme)

--=-=-=
Content-Type: text/x-emacs-lisp
Content-Disposition: inline; filename=eme-test.el

(require 'eme)
(require 'ert)

 
(ert-deftest surprise ()
    (should
     (equal '((one . two) one)
	    (progn
	      (one one)
	      (two two)
	      eme-ll))))

(ert-run-tests-batch-and-exit 'surprise)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


--8<---------------cut here---------------start------------->8---
eme> emacs-24.3.50 -batch -Q -L . --eval '(byte-compile-file "eme.el")'
Wrote /home/eme/eme.elc
eme> emacs-24.3.50 -batch -Q -L . --eval '(byte-compile-file "eme-test.el")'
Wrote /home/eme/eme-test.elc
eme> emacs-24.3.50 -batch -Q -L . -l eme-test
Running 1 tests (2013-05-30 19:37:09+0200)
Test surprise backtrace:
  #[nil "\305\306\30B\31B\211D=E2=96=92\311312\313\216\314\n    \"\211
  #[0 "\306\307!r\211q\210\310\311\312\313\314\315!\316\"\317\320%DC
  funcall(#[0 "\306\307!r\211q\210\310\311\312\313\314\315!\316\"\31
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  #[0 "r\304\305!q\210\306 )\307\310\311\312\313\314!\315\"\316\317%
  funcall(#[0 "r\304\305!q\210\306 )\307\310\311\312\313\314!\315\"\
  ert-run-test([cl-struct-ert-test surprise nil #[nil "\305\306\30B
  ert-run-or-rerun-test([cl-struct-ert--stats surprise [[cl-struct-ert
  ert-run-tests(surprise #[385 "\306\307\"\203D\211\211G\310U\203\
  ert-run-tests-batch(surprise)
  ert-run-tests-batch-and-exit(surprise)
  byte-code("\301\302!\210\301\303!\210\304\305\306\307\305\310\311\31
  load("eme-test" nil t)
  command-line-1(("-L" "." "-l" "eme-test"))
  command-line()
  normal-top-level()
Test surprise condition:
    (ert-test-failed
     ((should
       (equal '...
        (progn ... ... eme-ll)))
      :form
      (equal
       ((one . two)
        one)
       (two one))
      :value nil :explanation
      (list-elt 0
                (different-types
                 (one . two)
                 two))))
   FAILED  1/1  surprise

Ran 1 tests, 0 results as expected, 1 unexpected (2013-05-30 19:37:09+0200)

1 unexpected results:
   FAILED  surprise
--8<---------------cut here---------------end--------------->8---


Regards,
Achim.
--=20
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Wavetables for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#14422; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 May 2013 19:59:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 26 15:59:35 2013
Received: from localhost ([127.0.0.1]:35753 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Ugh6K-0001ef-P1
	for submit <at> debbugs.gnu.org; Sun, 26 May 2013 15:59:33 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52794)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Ugh6I-0001eM-4m
	for submit <at> debbugs.gnu.org; Sun, 26 May 2013 15:59:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Ugh55-0007kS-03
	for submit <at> debbugs.gnu.org; Sun, 26 May 2013 15:58:16 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-100.3 required=5.0 tests=BAYES_50, RCVD_IN_DNSWL_NONE,
	RP_MATCHES_RCVD,USER_IN_WHITELIST autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:38423)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Ugh54-0007kO-Sp
	for submit <at> debbugs.gnu.org; Sun, 26 May 2013 15:58:14 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35915)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Ugh52-0005id-3T
	for bug-gnu-emacs@HIDDEN; Sun, 26 May 2013 15:58:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Ugh4y-0007i9-Fo
	for bug-gnu-emacs@HIDDEN; Sun, 26 May 2013 15:58:12 -0400
Received: from plane.gmane.org ([80.91.229.3]:54118)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Ugh4y-0007i3-8x
	for bug-gnu-emacs@HIDDEN; Sun, 26 May 2013 15:58:08 -0400
Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1Ugh4w-0001qT-Fu
	for bug-gnu-emacs@HIDDEN; Sun, 26 May 2013 21:58:06 +0200
Received: from pd9eb4876.dip0.t-ipconnect.de ([217.235.72.118])
	by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
	id 1AlnuQ-0007hv-00
	for <bug-gnu-emacs@HIDDEN>; Sun, 26 May 2013 21:58:06 +0200
Received: from Stromeko by pd9eb4876.dip0.t-ipconnect.de with local (Gmexim
	0.1 (Debian)) id 1AlnuQ-0007hv-00
	for <bug-gnu-emacs@HIDDEN>; Sun, 26 May 2013 21:58:06 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-gnu-emacs@HIDDEN
From: Achim Gratz <Stromeko@HIDDEN>
Subject: Re: bug#14422: 24.3; Eager Macro Expansion
Date: Sun, 26 May 2013 21:57:54 +0200
Organization: Linux Private Site
Lines: 31
Message-ID: <874ndph5tp.fsf@HIDDEN>
References: <87hahz82rh.fsf@HIDDEN>
	<jwvzjvpm6cq.fsf-monnier+emacs@HIDDEN>
	<87obbxhi19.fsf@HIDDEN>
	<jwvsj19bl33.fsf-monnier+emacs@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain
X-Complaints-To: usenet@HIDDEN
X-Gmane-NNTP-Posting-Host: pd9eb4876.dip0.t-ipconnect.de
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock: sha1:CpNg4x4SUPFGBnLprMmag5ZoK5M=
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

Stefan Monnier writes:
> The defvar is only executed at run time (although it does have an
> effect at compile time, which is to tell the compiler that the variable
> will exist at run time).
>
> So using `ll' during the macro expansion is wrong.

That may well be a bug in the original code, although of course the
defvar is in a different file that has been loaded before the test
definition would expand the macro, so the expectation is that the symbol
should exist and have nil value when trying to run the tests.

> If you want `ll' to defined earlier, you can wrap it in
> `eval-and-compile' (tho it's better not to abuse it).  I can't tell what
> solution I'd recommend in your case, since your distilled test case is
> "too distilled" to understand what it's trying to do.

I'll have to check again how things were supposed to have been
initialized in Org, but the assumption that the (no longer existing)
macro definitions made was clearly that the stand-in for the ll symbol
was pre-existing at macro expansion time.  I'll try to re-create the
test case to match that behaviour and come back to you.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#14422; Package emacs. Full text available.

Message received at 14422 <at> debbugs.gnu.org:


Received: (at 14422) by debbugs.gnu.org; 26 May 2013 19:30:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 26 15:30:37 2013
Received: from localhost ([127.0.0.1]:35736 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UggeK-0000jL-Tl
	for submit <at> debbugs.gnu.org; Sun, 26 May 2013 15:30:37 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.182]:65390)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1UggeJ-0000j5-4x
	for 14422 <at> debbugs.gnu.org; Sun, 26 May 2013 15:30:35 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av4EABK/CFFFpZ3p/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJC6HcAbBLZEKA6R6gV6DEw
X-IPAS-Result: Av4EABK/CFFFpZ3p/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJC6HcAbBLZEKA6R6gV6DEw
X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="14515335"
Received: from 69-165-157-233.dsl.teksavvy.com (HELO pastel.home)
	([69.165.157.233])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	26 May 2013 15:29:16 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id 70A9D63127; Sun, 26 May 2013 15:29:20 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Achim Gratz <Stromeko@HIDDEN>
Subject: Re: bug#14422: 24.3; Eager Macro Expansion
Message-ID: <jwvsj19bl33.fsf-monnier+emacs@HIDDEN>
References: <87hahz82rh.fsf@HIDDEN>
	<jwvzjvpm6cq.fsf-monnier+emacs@HIDDEN>
	<87obbxhi19.fsf@HIDDEN>
Date: Sun, 26 May 2013 15:29:20 -0400
In-Reply-To: <87obbxhi19.fsf@HIDDEN> (Achim Gratz's message of "Sun,
	26 May 2013 17:34:10 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 14422
Cc: 14422 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> Well, the code does declare the variable symbol special and initializes
> it nil, so finding the symbol undefined during compilation and/or macro
> expansion would constitute a bug in either ERT or Emacs, no?

The defvar is only executed at run time (although it does have an
effect at compile time, which is to tell the compiler that the variable
will exist at run time).

So using `ll' during the macro expansion is wrong.

If you want `ll' to defined earlier, you can wrap it in
`eval-and-compile' (tho it's better not to abuse it).  I can't tell what
solution I'd recommend in your case, since your distilled test case is
"too distilled" to understand what it's trying to do.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#14422; Package emacs. Full text available.

Message received at 14422 <at> debbugs.gnu.org:


Received: (at 14422) by debbugs.gnu.org; 26 May 2013 15:35:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 26 11:35:39 2013
Received: from localhost ([127.0.0.1]:35647 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Ugcyx-0000MJ-I6
	for submit <at> debbugs.gnu.org; Sun, 26 May 2013 11:35:39 -0400
Received: from mail-in-08.arcor-online.net ([151.189.21.48]:41657)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <Stromeko@HIDDEN>) id 1Ugcyu-0000Ld-8A
	for 14422 <at> debbugs.gnu.org; Sun, 26 May 2013 11:35:38 -0400
Received: from mail-in-12-z2.arcor-online.net (mail-in-12-z2.arcor-online.net
	[151.189.8.29]) by mx.arcor.de (Postfix) with ESMTP id EC26F3AE56D;
	Sun, 26 May 2013 17:34:22 +0200 (CEST)
Received: from mail-in-14.arcor-online.net (mail-in-14.arcor-online.net
	[151.189.21.54])
	by mail-in-12-z2.arcor-online.net (Postfix) with ESMTP id EBFEF2E6176; 
	Sun, 26 May 2013 17:34:22 +0200 (CEST)
X-Greylist: Passed host: 217.235.8.86
X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-14.arcor-online.net ADCB99BE5E
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=nexgo.de; s=mail-in;
	t=1369582462; bh=JOjLUEWDimRukIT1etj2UPkDudDolNz2aUDs2W0ut7Q=;
	h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID:
	MIME-Version:Content-Type;
	b=HPODJ9jPt51/Lc0vVMS1iO8B6B1u1et4v63iSWL4J3ApCYtnKvaoG3dt524VinErI
	OYBX6Xzfc/GehlfcO2TKs3xxoX5fgLpZgyanocA6uMeAOdx2Ak5ak2hpX/cyRefI9D
	DvN8LKkIGejfRFx65LvSN2fz9oJ3d41wYtnbIg/k=
X-Greylist: Passed host: 217.235.8.86
Received: from Rainer.invalid (pD9EB0856.dip0.t-ipconnect.de [217.235.8.86])
	(Authenticated sender: stromeko@HIDDEN)
	by mail-in-14.arcor-online.net (Postfix) with ESMTPSA id ADCB99BE5E;
	Sun, 26 May 2013 17:34:22 +0200 (CEST)
From: Achim Gratz <Stromeko@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#14422: 24.3; Eager Macro Expansion
References: <87hahz82rh.fsf@HIDDEN>
	<jwvzjvpm6cq.fsf-monnier+emacs@HIDDEN>
Date: Sun, 26 May 2013 17:34:10 +0200
In-Reply-To: <jwvzjvpm6cq.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
	of "Mon, 20 May 2013 22:11:15 -0400")
Message-ID: <87obbxhi19.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 14422
Cc: 14422 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

Stefan Monnier writes:
>> The following test case demonstrates a problem that has been distilled
>> from Org's test suite.
>
>    % emacs24 -Q --batch -f batch-byte-compile eme.el
>    
>    In toplevel form:
>    eme.el:3:1:Warning: global/dynamic var `ll' lacks a prefix
>    eme.el:13:1:Error: Symbol's value as variable is void: ll
>    %
>
> So the code has a problem, since byte-compiling it doesn't work

The code isn't meant to be byte-compiled, but if you want to I'd have to
split it into two seperate files.  The ERT portion of the code is never
byte-compiled in Org and I don't know if it would make sense to do this.

> (emacs24 is 24.1, here).  No wonder eager macro-expansion also leads
> to problems.

Well, the code does declare the variable symbol special and initializes
it nil, so finding the symbol undefined during compilation and/or macro
expansion would constitute a bug in either ERT or Emacs, no?


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Wavetables for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#14422; Package emacs. Full text available.

Message received at 14422 <at> debbugs.gnu.org:


Received: (at 14422) by debbugs.gnu.org; 21 May 2013 02:21:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 20 22:21:26 2013
Received: from localhost ([127.0.0.1]:53710 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UecCX-0003SQ-KG
	for submit <at> debbugs.gnu.org; Mon, 20 May 2013 22:21:26 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.182]:33052)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1UecCS-0003S1-1i
	for 14422 <at> debbugs.gnu.org; Mon, 20 May 2013 22:21:20 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av4EABK/CFFFpZoF/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtji6CXAOkeoFegmop
X-IPAS-Result: Av4EABK/CFFFpZoF/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtji6CXAOkeoFegmop
X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="13749758"
Received: from 69-165-154-5.dsl.teksavvy.com (HELO pastel.home)
	([69.165.154.5])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	20 May 2013 22:20:28 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id 44B0F67A3C; Mon, 20 May 2013 22:11:15 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Achim Gratz <Stromeko@HIDDEN>
Subject: Re: bug#14422: 24.3; Eager Macro Expansion
Message-ID: <jwvzjvpm6cq.fsf-monnier+emacs@HIDDEN>
References: <87hahz82rh.fsf@HIDDEN>
Date: Mon, 20 May 2013 22:11:15 -0400
In-Reply-To: <87hahz82rh.fsf@HIDDEN> (Achim Gratz's message of "Sun,
	19 May 2013 16:26:10 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 14422
Cc: 14422 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> The following test case demonstrates a problem that has been distilled
> from Org's test suite.

   % emacs24 -Q --batch -f batch-byte-compile eme.el
   
   In toplevel form:
   eme.el:3:1:Warning: global/dynamic var `ll' lacks a prefix
   eme.el:13:1:Error: Symbol's value as variable is void: ll
   %

So the code has a problem, since byte-compiling it doesn't work
(emacs24 is 24.1, here).  No wonder eager macro-expansion also leads
to problems.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#14422; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 19 May 2013 14:27:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 19 10:27:04 2013
Received: from localhost ([127.0.0.1]:51493 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Ue4Zk-0004II-9I
	for submit <at> debbugs.gnu.org; Sun, 19 May 2013 10:27:04 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35711)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <Stromeko@HIDDEN>) id 1Ue4Ze-0004He-3H
	for submit <at> debbugs.gnu.org; Sun, 19 May 2013 10:26:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Stromeko@HIDDEN>) id 1Ue4Z6-0000UA-9P
	for submit <at> debbugs.gnu.org; Sun, 19 May 2013 10:26:25 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-99.2 required=5.0 tests=BAYES_50, RCVD_IN_DNSWL_NONE,
	TO_NO_BRKTS_PCNT,T_DKIM_INVALID,USER_IN_WHITELIST autolearn=disabled
	version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:54094)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Stromeko@HIDDEN>) id 1Ue4Z6-0000U6-5e
	for submit <at> debbugs.gnu.org; Sun, 19 May 2013 10:26:24 -0400
Received: from eggs.gnu.org ([208.118.235.92]:47068)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Stromeko@HIDDEN>) id 1Ue4Z4-0000jU-RG
	for bug-gnu-emacs@HIDDEN; Sun, 19 May 2013 10:26:24 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Stromeko@HIDDEN>) id 1Ue4Z3-0000Tk-6n
	for bug-gnu-emacs@HIDDEN; Sun, 19 May 2013 10:26:22 -0400
Received: from mail-in-01.arcor-online.net ([151.189.21.41]:46615)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Stromeko@HIDDEN>) id 1Ue4Z2-0000Tc-PJ
	for bug-gnu-emacs@HIDDEN; Sun, 19 May 2013 10:26:21 -0400
Received: from mail-in-11-z2.arcor-online.net (mail-in-11-z2.arcor-online.net
	[151.189.8.28]) by mx.arcor.de (Postfix) with ESMTP id BCFFC5A5CA
	for <bug-gnu-emacs@HIDDEN>; Sun, 19 May 2013 16:26:18 +0200 (CEST)
Received: from mail-in-02.arcor-online.net (mail-in-02.arcor-online.net
	[151.189.21.42])
	by mail-in-11-z2.arcor-online.net (Postfix) with ESMTP id BB1917FF56E
	for <bug-gnu-emacs@HIDDEN>; Sun, 19 May 2013 16:26:18 +0200 (CEST)
X-Greylist: Passed host: 217.235.63.177
X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-02.arcor-online.net 6478630770
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=nexgo.de; s=mail-in;
	t=1368973578; bh=PtMQ6+6wAX1dff7fk2Fypn6RLmZt0H1Vc/6PsOmLGZE=;
	h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type;
	b=T8atYD29dc06NLFXw6PwZ7tvXMhCyou7GrB35aee3gg4ydMibNOIkPeNCPOmcI1fM
	R5fXyNtoJZUnYacTDOA5D4swUfD0TLPihlZ/sm0ZDqCi5kiCR4j+zIVal04lp29vLu
	4mO2xppwPOnMXmFnin75Buih6ieWzCC0kZFq70mk=
Received: from Rainer.invalid (pD9EB3FB1.dip0.t-ipconnect.de [217.235.63.177])
	(Authenticated sender: stromeko@HIDDEN)
	by mail-in-02.arcor-online.net (Postfix) with ESMTPSA id 6478630770
	for <bug-gnu-emacs@HIDDEN>; Sun, 19 May 2013 16:26:18 +0200 (CEST)
From: Achim Gratz <Stromeko@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 24.3; Eager Macro Expansion
Date: Sun, 19 May 2013 16:26:10 +0200
Message-ID: <87hahz82rh.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

--=-=-=
Content-Type: text/plain


In GNU Emacs 24.3.1 (i686-suse-linux-gnu, GTK+ Version 3.8.1) of 2013-04-27
Windowing system distributor `The X.Org Foundation', version 11.0.11302000
System Description:	openSUSE 12.3/Tumbleweed (i586)

The following test case demonstrates a problem that has been distilled
from Org's test suite.  Org has since switched to use defun instead of
defmacro to work around this issue, but it seems that this might be a
corner case that eager macro expansion produces or not yet warn about
(whatever the intended behaviour might be).


--=-=-=
Content-Type: text/x-emacs-lisp
Content-Disposition: inline; filename=eme.el

(require 'ert)

(defvar ll nil)

(defmacro one (p)
  `(progn (push ',p ll)))

(defmacro two (p)
  (let (pp)
    (setq pp (append ll p))
  `(progn (push ',pp ll))))
 
(ert-deftest surprise ()
    (should
     (equal '((one . two) one)
	    (progn
	      (one one)
	      (two two)
	      ll))))

(ert-run-tests-batch-and-exit 'surprise)

--=-=-=
Content-Type: text/plain


This passes on all Emacs versions until 24.2, but fails on trunk:

eme> emacs-24.2 -batch -Q -l eme.el
Running 1 tests (2013-05-19 16:16:06+0200)
   passed  1/1  surprise

Ran 1 tests, 1 results as expected (2013-05-19 16:16:06+0200)

eme> emacs-24.3.50 -batch -Q -l eme.el
Running 1 tests (2013-05-19 16:16:16+0200)
Test surprise backtrace:
  (if (unwind-protect (setq value-2 (apply fn-0 args-1)) (setq form-de
  (let (form-description-4) (if (unwind-protect (setq value-2 (apply f
  (let ((value-2 (quote ert-form-evaluation-aborted-3))) (let (form-de
  (let ((fn-0 (function equal)) (args-1 (list (quote ((one . two) one)
  (lambda nil (let ((fn-0 (function equal)) (args-1 (list (quote ((one
  #[0 "\306\307!r\211q\210\310\311\312\313\314\315!\316\"\317\320%DC
  funcall(#[0 "\306\307!r\211q\210\310\311\312\313\314\315!\316\"\31
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  #[0 "r\304\305!q\210\306 )\307\310\311\312\313\314!\315\"\316\317%
  funcall(#[0 "r\304\305!q\210\306 )\307\310\311\312\313\314!\315\"\
  ert-run-test([cl-struct-ert-test surprise nil (lambda nil (let ((fn-
  ert-run-or-rerun-test([cl-struct-ert--stats surprise [[cl-struct-ert
  ert-run-tests(surprise #[385 "\306\307\"\203D\211\211G\310U\203\
  ert-run-tests-batch(surprise)
  ert-run-tests-batch-and-exit(surprise)
  eval-buffer(#<buffer  *load*> nil "/eme/eme.el"
  load-with-code-conversion("/eme/eme.el" "/eme/
  load("/eme/eme.el" nil t)
  command-line-1(("-l" "eme.el"))
  command-line()
  normal-top-level()
Test surprise condition:
    (ert-test-failed
     ((should
       (equal '...
        (progn ... ... ll)))
      :form
      (equal
       ((one . two)
        one)
       (two one))
      :value nil :explanation
      (list-elt 0
                (different-types
                 (one . two)
                 two))))
   FAILED  1/1  surprise

Ran 1 tests, 0 results as expected, 1 unexpected (2013-05-19 16:16:16+0200)

1 unexpected results:
   FAILED  surprise


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Wavetables for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables

--=-=-=--




Acknowledgement sent to Achim Gratz <Stromeko@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#14422; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.