Subject: Re: bug#51384: 28.0.60; substitute-command-keys finds global binding for undo instead of in specified keymap

From: Stefan Kangas <[email-masked]>
Date: Tue, 20 Sep 2022 14:03:53 -0400

Robert Pluim <[email-masked]> writes:

> diff --git a/lisp/help.el b/lisp/help.el
> index 0ec5b9c85b..b4b9120da3 100644
> --- a/lisp/help.el
> +++ b/lisp/help.el
> @@ -1208,6 +1208,12 @@ substitute-command-keys
>                                                   (and keymap
>                                                        (list keymap))
>                                                   t))))
> +                  ;; If we're looking in a particular keymap which has
> +                  ;; no binding, then we need to redo the lookup, with
> +                  ;; the global map as well this time.
> +                  (when (and (not key) keymap)
> +                    (setq key (with-current-buffer orig-buf
> +                                (where-is-internal fun keymap t))))
>                    (if (not key)
>                        ;; Function is not on any key.
>                        (let ((op (point)))

This looks eerily similar to the code I removed here:

    commit ac0027f6a5480bd4739fdf71413a19012f400483
    Author: Stefan Kangas <[email-masked]>
    Date:   Mon Jul 11 17:21:23 2022 +0200

        Remove dead branch from substitute-command-keys

        * lisp/help.el (substitute-command-keys): Remove dead branch;
        where-is-internal will follow any remaps for us.  Note also that the
        test case for remapping still pass.

Do we have a test case that reverting that commit would fix?

(I can't see Lars' message yet, so the delays with the gnu.org mail
systems seem to be ongoing...)