[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#47215: 28.0.50; Let M-x switch between M-x and M-X
From: |
Lars Ingebrigtsen |
Subject: |
bug#47215: 28.0.50; Let M-x switch between M-x and M-X |
Date: |
Sun, 04 Apr 2021 21:52:21 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Felician Nemeth <felician.nemeth@gmail.com> writes:
>> I'm not quite sure how to implement this, though -- we basically end up
>> in `completing-read', and `execute-extended-command-for-buffer' would
>> have to define an `M-x' binding there, I guess... and then somehow call
>> `read-extended-command' with the text already in the minibuffer.
>>
>> Anybody got an idea as to how to implement this without rewriting
>> `read-extended-command' completely?
>
> The execute-extended-commands have two undocumented optional arguments
> (command-name and typed). What are they used for?
>
> Anyway, following the fallback logic of `ido-find-file', I was able to
> rebind `M-x' and save the content of the minibuffer with a non-standard
> exit from `execute-extended-command'. Maybe the ugly code below can
> give ideas to someone more knowledgeable.
Thanks -- I was wondering more about the situation where you've typed
M-X foo|bar
(| for point)
and then hit `M-x' because you want to switch to the other mode.
Ideally, `M-x' should do that, and also preserve the text the user has
typed, and the cursor position. I don't see an obvious simple way to do
that...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no