Subject: Re: bug#70938: 30.0.50; Edebug appropriates overriding-terminal-local-map

From: Michael Heerdegen <[email-masked]>
Date: Tue, 14 May 2024 23:23:03 +0200

Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <[email-masked]> writes:

> This is evidently from the instrumented function.  What I haven't been
> able to determine is why this remains even after the instrumentation has
> been removed; it seems that Edebug has appropriated
> overriding-terminal-local-map.  The only way I have found to release it
> is `M-x unload-library RET edebug'.

Thanks.  I can reproduce the issue.  And this is a very valuable recipe,
because this may be the problem we are hunting for quite a while.

I agree with your analysis - the transient map the edebugged code adds
is never removed, its bound commands are instrumented code.  Just M-:
overriding-terminal-local-map RET to verify.

AFAIU, this is caused only by this one binding:

  (overriding-terminal-local-map nil)

in `edebug--recursive-edit'.  This seems to make the cleanup code of the
added transient map in `pre-command-hook' think that the transient map
is gone, we are done and removes itself from the hook.  Then the added
transient map stays forever, unless you clear
`overriding-terminal-local-map' manually.

But what can we do - does anyone have a good idea?  Could the cleanup
code that removes the transient map maybe check whether the variable
`overriding-terminal-local-map' it sees is really the global one?

Thanks,

Michael.