Subject: bug#29399: 26.0.90; `edit-kbd-macro' has bad prompt

From: Drew Adams <[email-masked]>
Date: Wed, 22 Nov 2017 17:15:53 -0800 (PST)

> > It should use \\[execute-extended-command] and thus say:
> > "Keyboard macro to edit (C-x e, C-o, C-h l, or keys):"
> 
> I'm not sure if this would help so much for the OP's case [1], which is
> more like:
> 
>     (defun my/execute-extended-command () ; actually `smex'[2] in OP's
> case
>       (interactive)
>       (call-interactively 'execute-extended-command))
>     (global-set-key (kbd "M-x") 'my/execute-extended-command)
> 
> With that kind of config, I get
>     Keyboard macro to edit (C-x e, <execute>, C-h l, or keys):

Well, that's at least correct. ;-)  The problem is that
there is no way to tell Emacs which binding to show.

I suppose you could use `set-advertised-calling-convention',
but a user shouldn't need to bother (or know about)
that, here.

This is a general Emacs gotcha/problem.  It's not the
problem of this bug report.

Except for this, which I also said:

>> This prompt is anyway not clear.  The command should
>> instead accept a key sequence that shows more complete
>> info/help, and the prompt should just mention that key
>> sequence.

That's the right thing to do.  The prompt shouldn't
try to mention lots of keys.  That's only good when
the command itself will actually read keys - it then
knows just which keys to mention: those it uses.

This command should mention only (at most) a help key
that it provides (would provide).  Using that help key
(at that time - while prompted) would show whatever
help we want to show, including mentioning any keys
or commands, if appropriate.

Of course that help could itself fall into the problem
of showing a key such as `<execute>' or `<menu>'.  But
as I said, that's a general problem.

It could choose to mention only command names, i.e.,
not use \\[...].

> I have no idea how to produce <execute> on my keyboard.

You probably cannot.

> Which ends up with this:
> 
> "Keyboard macro to edit (C-x e, M-x execute-extended-command, C-h l,
> or keys):"

And that's as good as it could get.  The command can
reasonably assume that you can use `execute-extended-command'
(which you can, I think, regardless of whether `M-x' is
bound to `smex').  The command cannot know that a user
always wants to use `smex' instead of `M-x'.

UNLESS the user (or `smex-mode' or whatever) actually
substitutes `smex' for `execute-extended-command' keys,
using remapping or using `substitute-key-definition'.