unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#1525: prompt string for execute-extended-command not flexible
@ 2008-12-09 22:36 xah lee
  2011-07-10 13:15 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: xah lee @ 2008-12-09 22:36 UTC (permalink / raw)
  To: bug-gnu-emacs

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”:

«
seber...@spawar.navy.mil 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 ");
-- 
Kevin Rodgers
»

So, possibly the promp can be changed to “Execute command ”.

Thanks.

   Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#1525: prompt string for execute-extended-command not flexible
  2008-12-09 22:36 bug#1525: prompt string for execute-extended-command not flexible xah lee
@ 2011-07-10 13:15 ` Lars Magne Ingebrigtsen
  2011-07-12  3:20   ` Chong Yidong
  2011-07-12  3:41   ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-10 13:15 UTC (permalink / raw)
  To: xah lee; +Cc: 1525

xah lee <xah@xahlee.org> 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”:
>
> «
> seber...@spawar.navy.mil 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/





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#1525: prompt string for execute-extended-command not flexible
  2011-07-10 13:15 ` Lars Magne Ingebrigtsen
@ 2011-07-12  3:20   ` Chong Yidong
  2011-07-12  3:41   ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Chong Yidong @ 2011-07-12  3:20 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: xah lee, 1525

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> (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?

OTOH, you might get into a tricky situation if execute-extended-command
was launched by, say, a mouse event.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#1525: prompt string for execute-extended-command not flexible
  2011-07-10 13:15 ` Lars Magne Ingebrigtsen
  2011-07-12  3:20   ` Chong Yidong
@ 2011-07-12  3:41   ` Stefan Monnier
  2011-07-12  8:51     ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2011-07-12  3:41 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: xah lee, 1525

> (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?

Actually the problem is that it should never have said "M-x " but rather
"Run command: ".  From this viewpoint, there's no need to use
this_command_keys: "M-x" is really only meant to be "the canonical
key-binding for this command", so (key-description (car
(where-is-internal 'execute-extended-command))) works as well.
Otherwise if someone happens to hit the "menu" key without realizing
that it's bound to execute-extended-command he might start wonder "OK
the menu bar says 'menu ' what do I do now?", whereas presumably with
"M-x " the user sees "oh that runs the same command as M-x, cool".


        Stefan





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#1525: prompt string for execute-extended-command not flexible
  2011-07-12  3:41   ` Stefan Monnier
@ 2011-07-12  8:51     ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-12  8:51 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: xah lee, 1525

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Actually the problem is that it should never have said "M-x " but rather
> "Run command: ".  From this viewpoint, there's no need to use
> this_command_keys: "M-x" is really only meant to be "the canonical
> key-binding for this command", so (key-description (car
> (where-is-internal 'execute-extended-command))) works as well.
> Otherwise if someone happens to hit the "menu" key without realizing
> that it's bound to execute-extended-command he might start wonder "OK
> the menu bar says 'menu ' what do I do now?", whereas presumably with
> "M-x " the user sees "oh that runs the same command as M-x, cool".

Right.  So I'm closing this report, since this isn't really a bug.

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-07-12  8:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-09 22:36 bug#1525: prompt string for execute-extended-command not flexible xah lee
2011-07-10 13:15 ` Lars Magne Ingebrigtsen
2011-07-12  3:20   ` Chong Yidong
2011-07-12  3:41   ` Stefan Monnier
2011-07-12  8:51     ` Lars Magne Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).