Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding

From: Stefan Monnier <[email-masked]>
Date: Mon, 20 Mar 2023 17:25:35 -0400

> The other part hasn't landed on master yet.  I agree it shouldn't go on
> emacs-29, but would like to see it in master.  Stefan seems to have some
> objections, which I believe boil down to "nobody has demonstrated a real
> need yet, beside 'making the api complete'".

I can't remember exactly what "the other part" entails, but w.r.t
providing an optional arg that makes lookup-key ignores parents, I don't
think it would make the API complete (I can still see needs for yet more
optional arguments, most importantly one that doesn't look inside
`menu-item`s).

So I'd prefer to have a new lower-level function which does "the
minimum" but returns enough info that we can build something like
`lookup-key` on top of it.

I guess it would return 2 pieces of info: the binding that was found (if
any, potentially annotated with whether it was a default binding or
not), and the rest of the keymap.  Or maybe return the binding together
with the `cons` cell where that binding was found (i.e. along the lines
of what `member/memq` do).

> At this point it would be nice if there were some indication in what
> keymap the default binding, this-mode-map or parent-mode-map.  The UI
> could even allow directly jumping to the definition of the appropriate
> keymap.  Eventually it might even be possible to make the changes
> directly from the popup buffer.

`C-h k` tries to identify the keymap, but indeed it doesn't distinguish
between the keymap and its parent(s).  Patch welcome to improve this.

        Stefan