GNU bug report logs - #42691
28.0.50; eval-and-compile

Previous Next

Package: emacs;

Reported by: Helmut Eller <eller.helmut <at> gmail.com>

Date: Mon, 3 Aug 2020 07:58:02 UTC

Severity: normal

Tags: notabug

Found in version 28.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 42691 in the body.
You can then email your comments to 42691 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#42691; Package emacs. (Mon, 03 Aug 2020 07:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Helmut Eller <eller.helmut <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 03 Aug 2020 07:58:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Helmut Eller <eller.helmut <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; eval-and-compile
Date: Mon, 03 Aug 2020 09:57:20 +0200
Compiling this example:

  (require 'cl-lib)
  (cl-macrolet ((foo () '123))
    (eval-and-compile (foo)))

with

  emacs -Q --batch -f batch-byte-compile bug.el

prints:

  In toplevel form:
  bug.el:2:1: Error: Symbol’s function definition is void: foo

I think when compiling eval-and-compile the macro-environment is not
passed along properly.


In GNU Emacs 28.0.50 (build 5, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
 of 2020-08-03 built on caladan
Repository revision: e1f09607e02eb507b229285ed48b85a3c6a50259
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42691; Package emacs. (Mon, 03 Aug 2020 09:30:01 GMT) Full text and rfc822 format available.

Message #8 received at 42691 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Helmut Eller <eller.helmut <at> gmail.com>
Cc: 42691 <at> debbugs.gnu.org
Subject: Re: bug#42691: 28.0.50; eval-and-compile
Date: Mon, 03 Aug 2020 11:29:17 +0200
On Aug 03 2020, Helmut Eller wrote:

> Compiling this example:
>
>   (require 'cl-lib)
>   (cl-macrolet ((foo () '123))
>     (eval-and-compile (foo)))
>
> with
>
>   emacs -Q --batch -f batch-byte-compile bug.el
>
> prints:
>
>   In toplevel form:
>   bug.el:2:1: Error: Symbol’s function definition is void: foo
>
> I think when compiling eval-and-compile the macro-environment is not
> passed along properly.

Only the body of eval-and-compile is evaluated at that point.  If you
want to modify the environment of the evaluation, you need to move that
modification inside the eval-and-compile form.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42691; Package emacs. (Mon, 03 Aug 2020 10:28:01 GMT) Full text and rfc822 format available.

Message #11 received at 42691 <at> debbugs.gnu.org (full text, mbox):

From: Helmut Eller <eller.helmut <at> gmail.com>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 42691 <at> debbugs.gnu.org
Subject: Re: bug#42691: 28.0.50; eval-and-compile
Date: Mon, 03 Aug 2020 12:27:15 +0200
On Mon, Aug 03 2020, Andreas Schwab wrote:

> On Aug 03 2020, Helmut Eller wrote:
>
>> Compiling this example:
>>
>>   (require 'cl-lib)
>>   (cl-macrolet ((foo () '123))
>>     (eval-and-compile (foo)))
>>
>> with
>>
>>   emacs -Q --batch -f batch-byte-compile bug.el
>>
>> prints:
>>
>>   In toplevel form:
>>   bug.el:2:1: Error: Symbol’s function definition is void: foo
>>
>> I think when compiling eval-and-compile the macro-environment is not
>> passed along properly.
>
> Only the body of eval-and-compile is evaluated at that point.  If you
> want to modify the environment of the evaluation, you need to move that
> modification inside the eval-and-compile form.

Are you saying this is not a bug in eval-and-compile?

The docstring of eval-and-compile says eval-and-compile is like progn,
except that the body it is evaluated at compile-time too.  If it is
supposed to work like progn, then the environment should be defined as
for progn.

Helmut




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42691; Package emacs. (Mon, 03 Aug 2020 12:05:01 GMT) Full text and rfc822 format available.

Message #14 received at 42691 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Helmut Eller <eller.helmut <at> gmail.com>
Cc: 42691 <at> debbugs.gnu.org
Subject: Re: bug#42691: 28.0.50; eval-and-compile
Date: Mon, 03 Aug 2020 14:04:08 +0200
On Aug 03 2020, Helmut Eller wrote:

> Are you saying this is not a bug in eval-and-compile?

Yes.

> The docstring of eval-and-compile says eval-and-compile is like progn,
> except that the body it is evaluated at compile-time too.  If it is
> supposed to work like progn, then the environment should be defined as
> for progn.

At runtime, yes.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42691; Package emacs. (Mon, 03 Aug 2020 12:56:02 GMT) Full text and rfc822 format available.

Message #17 received at 42691 <at> debbugs.gnu.org (full text, mbox):

From: Helmut Eller <eller.helmut <at> gmail.com>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 42691 <at> debbugs.gnu.org
Subject: Re: bug#42691: 28.0.50; eval-and-compile
Date: Mon, 03 Aug 2020 14:55:43 +0200
On Mon, Aug 03 2020, Andreas Schwab wrote:

> On Aug 03 2020, Helmut Eller wrote:
>
>> Are you saying this is not a bug in eval-and-compile?
>
> Yes.
>
>> The docstring of eval-and-compile says eval-and-compile is like progn,
>> except that the body it is evaluated at compile-time too.  If it is
>> supposed to work like progn, then the environment should be defined as
>> for progn.
>
> At runtime, yes.

So you are arguing, that the body should be evaluated and macro-expanded
in the null environment.  That's not like progn at all.  Obviously, I
disagree.  I also note that

  emacs -Q --batch -l bug.el

prints:

  Eager macro-expansion failure: (void-function foo)
  Eager macro-expansion failure: (void-function foo)
  Symbol’s function definition is void: foo

which I also consider a bug.

Helmut




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42691; Package emacs. (Mon, 03 Aug 2020 13:17:01 GMT) Full text and rfc822 format available.

Message #20 received at 42691 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Helmut Eller <eller.helmut <at> gmail.com>
Cc: 42691 <at> debbugs.gnu.org
Subject: Re: bug#42691: 28.0.50; eval-and-compile
Date: Mon, 03 Aug 2020 15:16:33 +0200
On Aug 03 2020, Helmut Eller wrote:

> So you are arguing, that the body should be evaluated and macro-expanded
> in the null environment.

No, I don't.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42691; Package emacs. (Thu, 16 Sep 2021 15:02:03 GMT) Full text and rfc822 format available.

Message #23 received at 42691 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 42691 <at> debbugs.gnu.org, Helmut Eller <eller.helmut <at> gmail.com>
Subject: Re: bug#42691: 28.0.50; eval-and-compile
Date: Thu, 16 Sep 2021 17:01:49 +0200
Andreas Schwab <schwab <at> linux-m68k.org> writes:

>> Are you saying this is not a bug in eval-and-compile?
>
> Yes.

I think that's correct -- the `eval-and-compile' makes the contents
evaluate in contexts where it otherwise wouldn't be evaluated.  But it
doesn't make the enclosing forms be evaluated in those contexts, so in
this case, they have to be moved down inside the `eval-and-compile'.

So this seems to be working as designed, and I'm closing this bug
report.  (If I misunderstood what this was about, please respond to the
debbugs address and we'll reopen.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) notabug. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 16 Sep 2021 15:03:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 42691 <at> debbugs.gnu.org and Helmut Eller <eller.helmut <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 16 Sep 2021 15:03:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 15 Oct 2021 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 187 days ago.

Previous Next


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