Subject: Re: bug#16184: 24.3.50; edebug and eval-when-compiler don't work together

From: Alan Mackenzie <[email-masked]>
Date: Sat, 31 Dec 2016 11:18:52 +0000

Hello, Gemini.

On Fri, Dec 30, 2016 at 03:27:37PM -0800, Gemini Lasswell wrote:
> Alan Mackenzie <[email-masked]> writes:

> > .  During this instrumentation, the inside of the cc-eval-when-compile
> > form gets run, in particular, the (edebug-before 2).  At this stage,
> > since edebug-enter hasn't been run at all, edebug-offset-indices is still
> > nil.  The (edebug-before 2) thus attempts (setcar nil 2), which throws
> > the error.

> I haven't able to reproduce the bug with cc-eval-when-compile,
> just eval-and-compile. But the thing that is supposed to make Edebug
> wrap a form in edebug-enter is the use of def-form or def-body in the
> Edebug spec.

This is extremely poorly documented, even in the source code, if it is
documented at all.  I don't really understand the documentation of the
edebug spec in general.

> It works for eval-when-compile which has the Edebug spec (&rest
> def-form). The body of eval-and-compile doesn't get wrapped because
> its Edebug spec is t, so the bug happens there.

Ah!  I think I'm beginning to understand all this.  Looking at the
source code, it seems a def-form or def-body causes the form to be
wrapping by edebug-enter, but not much else does.

> cc-eval-when-compile has the same Edebug spec as eval-when-compile, so
> its body should get wrapped by edebug-enter. If that's not happening in
> your Emacs, it's a bug in Edebug which is different from the
> eval-and-compile Edebug spec bug.

I think you've persuaded me that my fix to this bug was wrong.  Rather
than adapting initialisations to cope with edebug-enter not being
called, I should have diagnosed _why_ an edebug-enter is not being
generated during instrumentation of a cc-eval-when-compile form.

I'm working on this now.  Thank you indeed for drawing my attention to
these edebug specs.

-- 
Alan Mackenzie (Nuremberg, Germany).