protesilaos / mct

Enhancements for the default minibuffer completion UI of Emacs.
https://protesilaos.com/emacs/mct
GNU General Public License v3.0
33 stars 3 forks source link

Pre-selecting the first entry so that pressing Return activates it #5

Closed arael closed 11 months ago

arael commented 11 months ago

In fido-vertical-mode and orderless I can start searching for a function and insert enough characters to find the function. Then pressing the Return key allows me to execute the function. In MCT i have to press a C-n first, even when I just want the first entry.

Is is possible to get the same behavior in MCT?

I have searched in the variables but I could not find anything. Same holds for the MCT documentation.

Thank you very much for any pointers, Prot. And please forgive me if I have overlooked the solution.

Also, thank you very much for this wonderful package.

protesilaos commented 11 months ago

Hello @arael!

Is is possible to get the same behavior in MCT?

I believe it is, though note that MCT does not try to change the behaviour of the default completion framework. It simply adds some more features on top. Personally, I am not against what you suggest: it could be provided as an option, for example, though we need to make sure it does not does something unexpected.

arael commented 11 months ago

Thank you for considering my request, Prot. I indeed have tried using MCT with orderless but without fido-vertical-mode. If there is a way to integrate MCT in fido-vertical-mode somehow I think that I could stick to that, so that you do not need to complicate your codebase. I know that you are quite busy with other, more urgent, projects in this period. I have searched in the documentation but could not find it. Forgive me if I have overlooked it. Could you please give me a hint when you have time?

arael commented 11 months ago

It was much simpler than what I thought. I just needed to start both fido-vertical-mode and mct-mode. I was using mct-mode without fido-vertical-mode, because my understanding was that this is a drop in replacement for other completion frameworks. Sorry for wasting your time, Prot. And thank you for your work.

arael commented 11 months ago

Prot, I have figured out a way to use MCT as a drop replacement for fido-vertical-mode.

This allows me to execute the first entry in the completion list when I press the return key. This way I can use mct-mode without fido-vertical-mode.

(general-define-key
    :keymaps '(minibuffer-mode-map)
    "<return>" 'mct-complete-and-exit)
protesilaos commented 11 months ago

Prot, I have figured out a way to use MCT as a drop replacement for fido-vertical-mode.

This allows me to execute the first entry in the completion list when I press the return key. This way I can use mct-mode without fido-vertical-mode.

Very well! Though note that this does not always visualise the first candidate, depending on how quickly you type RET and if the Completions have popped up.

arael commented 10 months ago

You are right, Prot. If I do not press Tab or if I press return quickly, before the completion window shows up, then the Return key is not registered. But it is still worth it, for the seamless transition from the minibuffer to the completion window that MCT allows.