GNU bug report logs - #13813
24.3.50; eval-and-compile in macro inhibits let-binding of variable

Previous Next

Package: emacs;

Reported by: David Engster <deng <at> randomsample.de>

Date: Mon, 25 Feb 2013 17:01:02 UTC

Severity: normal

Tags: notabug

Found in version 24.3.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: David Engster <deng <at> randomsample.de>
Subject: bug#13813: closed (Re: bug#13813: 24.3.50; eval-and-compile in
 macro inhibits let-binding of variable)
Date: Tue, 12 Mar 2013 02:50:04 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#13813: 24.3.50; eval-and-compile in macro inhibits let-binding of variable

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 13813 <at> debbugs.gnu.org.

-- 
13813: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13813
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: 13813-done <at> debbugs.gnu.org
Subject: Re: bug#13813: 24.3.50;
	eval-and-compile in macro inhibits let-binding of variable
Date: Mon, 11 Mar 2013 22:48:11 -0400
tags 13813 notabug
thanks

> So in yet other words, you don't see this as a bug?  If so, then please
> close this report and I'll have to discuss with Eric how we deal with
> this on our side.

Right: the `eval-and-compile' can cause the wrapped code to be run
outside of the scope of the surrounding code, so it's normal if that
let-binding doesn't always have the effect you want.


        Stefan

[Message part 3 (message/rfc822, inline)]
From: David Engster <deng <at> randomsample.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; eval-and-compile in macro inhibits let-binding of variable
Date: Mon, 25 Feb 2013 17:58:41 +0100
Recipe:

* Create a file test.el with the following contents:

(defvar myflag nil)

(defmacro mytestmacro ()
  "An eval-and-compile test."
  `(eval-and-compile (mytestfun)))

(defun mytestfun ()
  (when myflag
    (message "foo")))

(let ((myflag t))
  ;; Should display "foo"
  (mytestmacro))

* Now call with Emacs from trunk:

  emacs --batch -l test.el

* "foo" should be displayed, but isn't. The Emacs 24.2.93 pretest
  however works as expected.

* Note the following:

  - It works if you just 'setq' the 'myflag' variable

  - If you load the file interactively and call `eval-buffer', it will
    also output nothing. However, if you manually evaluate the last
    expression through C-x C-e, it will work.

  - The same problem occurs with `eval-when-compile', but everything
    works with `progn'.


Best,
David "who will never grasp eval-and-compile"

And yes, Stefan, this bug turned up in the EIEIO test suite. :-)



This bug report was last modified 12 years and 77 days ago.

Previous Next


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