Subject: bug#40992: 27.0.90; Evaluating a function while using edebug breaks

From: Alan Mackenzie <[email-masked]>
Date: Sat, 2 May 2020 13:34:47 +0000

Hello, Eli.

On Sat, May 02, 2020 at 10:10:04 +0300, Eli Zaretskii wrote:
> > From: Noam Postavsky <[email-masked]>
> > Date: Fri, 01 May 2020 23:05:32 -0400
> > Cc: Alan Mackenzie <[email-masked]>, [email-masked],
> >  Phillip Lord <[email-masked]>

> > > I think that sounds like a good solution on master, but the patch that
> > > introduced this should probably be reverted on emacs-27 -- it wasn't a
> > > bug fix, but a new feature, so reverting it should be safe, I think.

> > I don't understand; the fix looks trivial to me (leaving out
> > indentation), and only touches a new function.  Surely this is okay for
> > emacs-27?

> If this fixes the problem, it's okay for emacs-27.  But then why did
> Alan say there was no easy solution?

I think I said "good" rather than "easy".  This 'edebug property is
essentially associated with a function, but is in a symbol's property
list.

Noam's fix, I think, will either leave stale highlights on what used to
be breakpoints, or won't leave the highlights active whilst the
debugging is still in progress.  It might be the least bad fix, though.

At the time of debugging, there are _two_ functions associated with
`hanoi', the one just compiled with C-M-x, and the instrumented one
still being debugged (which will soon find its way to the garbage
collector).

There is no way to attach a property list to a function (and it's too
late to add one for Emacs 27 ;-), so prop 'edebug gets on the symbol's
plist, and confusion results.  Hence this bug.

A good solution would fix this confusion.  I can't think of a way to do
this which doesn't involve deep surgery on Emacs's internals.

I think the same mechanism is behind the annoying bug (not yet reported
by me) where you do M-x compile-defun on a previously instrumented
function, then try to instrument it again by typing I
(`edebug-instrument-callee') whilst in Edebug.  You get the spurious
error message "Already instrumented".

-- 
Alan Mackenzie (Nuremberg, Germany).