Subject: bug#12685: 24.2; lexical binding breaks edebug conditional breakpoints

From: Toby Cubitt <[email-masked]>
Date: Tue, 23 Oct 2012 19:10:45 +0200

On Tue, Oct 23, 2012 at 12:33:34PM -0400, Stefan Monnier wrote:
> >> The fact that it aborts execution should be fixable before the release
> >> (tho I'm not sure that it's really better to silently mis-interpret the
> >> user's request),
> > Indeed.  But that's what the documentation says it should do, so either
> > the documentation or the implementation needs to be changed so that they
> > at least match.
> 
> I think at this stage the best is to add a note that it might fail when
> used for lexical-binding code.

Sounds reasonable.

> > I figured as much. Maybe for now we could mention in the Edebug section
> > of the Elisp manual which parts of edebug won't (currently) work in
> > lexically-scoped code? As far as I can see, M-: and conditional
> > breakpoints should be the only things that are affected. (Though
> > `edebug-step-in' doesn't always seem to work for me lately, but I can't
> > reliably reproduce this at the moment.)
> 
> Agreed.  Could you take care of it?

I can, but I can't guarantee I'll find time to do it for a couple of
weeks, as I'm very busy with work until mid-November.

> > Maybe the docs should even recommend disabling lexical-binding when
> > edebugging for now.
> 
> I don't think so.  The programmer can reach his own conclusion based on
> the text you'll add warning that some parts don't work.

OK.

> > (Is there a good way of configuring this to happen
> > automatically?
> 
> No, that would be even worse, since some code only works in
> lexical-binding mode (and there's no way to figure out if the code in
> the current buffer is in this category).

I was asking this out of personal interest, not suggesting it as a way of
"fixing" the problem. (I completely agree that it's not a good solution
in general.) But the choice currently is: use dynamic-scoping, or use a
crippled edebug. The only work-around I can see until this is fixed is to
manually disable lexical-binding before instrumenting for edebug.

I was asking if you knew of a good place to hook into (just in my own
private Emacs config), so that I don't have to do this manually every
time I want to run edebug?

I'm well aware that this means whatever behaviour I see under edebug
could be different from the real behaviour. Given how rarely
dynamical-binding differs from lexical-binding in practice, it's still a
useful work-around for me, until edebug is fixed.

Best,
Toby
-- 
Dr T. S. Cubitt
Mathematics and Quantum Information group
Department of Mathematics
Complutense University
Madrid, Spain

email: [email-masked]
web:   www.dr-qubit.org