Subject: Re: prompt string for execute-extended-command not flexible

From: Lars Magne Ingebrigtsen <[email-masked]>
Date: Sun, 10 Jul 2011 15:15:51 +0200

xah lee <[email-masked]> writes:

> The prompt string for execute-extended-command is “M-x ”, but that is
> not correct if the command is bound to some other key by
> customization.
>
> Kevin Rodgers gave this explanation recently in “gnu.emacs.help”:
>
> «
> [email-masked] wrote:
>> When you type a command in Emacs you are greeted with the prompt "M-
>> x".  How change that prompt string?
>
> Change this code in src/keyboard.c and recompile emacs:
>    /* This isn't strictly correct if execute-extended-command
>       is bound to anything else.  Perhaps it should use
>       this_command_keys?  */
>    strcat (buf, "M-x ");

This is no longer done, but it's still not quite right.

If you do:

(local-set-key [(meta z)] 'execute-extended-command)

Then you still get "M-x" as the prompt if you do `M-z'.

The reason is that it looks up the command first, and then picks one of
the bindings as the description, with code that's kinda like this:

(key-description (car (where-is-internal 'execute-extended-command)))

Is there any reason it doesn't just use this_command_keys which
presumably would be more correct?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/