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

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

Hello, Noam, Eli, Lars, and Phillip.

On Fri, May 01, 2020 at 23:05:32 -0400, Noam Postavsky wrote:
> Lars Ingebrigtsen <[email-masked]> writes:

> > Alan Mackenzie <[email-masked]> writes:

> >> There doesn't appear to be a good way of solving this bug.  A workable
> >> workaround would be to check that the 'edebug property value is a list
> >> in edebug--overlay-breakpoints, and just to remove the breakpoint
> >> highlights when it's not a list.  When it's not a list, it's a marker
> >> pointing to the start of the function, from which the end of the
> >> function can be found, to serve as the END argument to
> >> edebug--overlay-breakpoints-remove.

> >> Or something like that.  :-(

> > 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?

> --- i/lisp/emacs-lisp/edebug.el
> +++ w/lisp/emacs-lisp/edebug.el
> @@ -3236,8 +3236,9 @@ 'edebug-breakpoint
>    "\x3c\x7e\xff\xff\xff\xff\x7e\x3c")
 
>  (defun edebug--overlay-breakpoints (function)
> -  (let* ((data (get function 'edebug))
> -         (start (nth 0 data))
> +  (let ((data (get function 'edebug)))
> +    (when (listp data)
> +      (let* ((start (nth 0 data))
>           (breakpoints (nth 1 data))
>           (offsets (nth 2 data)))
>      ;; First remove all old breakpoint overlays.
> @@ -3264,6 +3265,7 @@ edebug--overlay-breakpoints
>                           (propertize
>                            "x" 'display
>                            `(left-fringe edebug-breakpoint ,face)))))))))
> +    ))
 
>  (defun edebug--overlay-breakpoints-remove (start end)
>    (dolist (overlay (overlays-in start end))

That function might not remove any existing breakpoint highlights (which
normally would get removed by the call to
edebug--overlay-breakpoints-remove, which takes the value of the 'edebug
property (indirectly) as an argument.

I've tried vaguely to create a situation where the highlights get left
in place, but haven't managed it yet.

-- 
Alan Mackenzie (Nuremberg, Germany).