Skip to content

accept M RET on all input with vertico#694

Closed
matsl wants to merge 2 commits into
masterfrom
accept-M-RET-on-all-input-with-vertico
Closed

accept M RET on all input with vertico#694
matsl wants to merge 2 commits into
masterfrom
accept-M-RET-on-all-input-with-vertico

Conversation

@matsl
Copy link
Copy Markdown
Collaborator

@matsl matsl commented Apr 7, 2025

What

  • Treat M-RET on input as by vertico when active
  • Add hui-mouse-tests for hkey-alist actions

Why

Vertico uses the keybinding M-RET for vertico-exit-input for exiting
the minibuffer using the current minibuffer input. For example when
creating a new file where there is no candidate to select. An
alternative is to use the uparrow to go to the input prompt and use
RET there. That fails however for the case when there is no input and
the empty input is used to terminate. The user gets stuck in this case
and only way out is to use M-x vertico-exit-input or similar tricks.

This PR takes the approach to always respect vertico's view when
reading an argument.

The PR is also a start for verifying that the hkey-alist will call the
expected actions from a given state and not something else.

@matsl matsl force-pushed the accept-M-RET-on-all-input-with-vertico branch from 3491ded to 3c94a82 Compare April 7, 2025 22:13
@matsl matsl requested a review from rswgnu April 7, 2025 22:15
@rswgnu
Copy link
Copy Markdown
Owner

rswgnu commented Apr 8, 2025 via email

Comment thread hui-mouse.el
;; If in the minibuffer and reading an argument with vertico
;; run the vertico command on {M-RET} which accepts the first
;; line of minibuffer input, rather than any candidate.
((and hargs:reading-type
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m fine with everything here except the first line. We’ll have to think about how this could impact other things, i.e. the above line was put there for a reason.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can hargs:reading-type and vertico-mode be non-nil at the same time? If I remember correct they can not so the check on hargs:reading-type effectively ignores vertico reading the input.

Anyway I'm far from sure here. Could be a case where vertico is prompting for input where we want the action key to kick in instead? So I added a test case for hkey-alist so we can verify that different scenarios are handled properly. If we can identify the case we can add tests for that so we can verify that both scenarios works as expected.

@matsl
Copy link
Copy Markdown
Collaborator Author

matsl commented Apr 8, 2025

Interesting you decided to work on this now. Certainly sounds useful

I did not. It was an old branch. But I got bitten again yesterday being stuck at a prompt without getting out (without doing the suggested workaround) so decided it was time to share it.

Comment thread hui-mouse.el
;; If in the minibuffer and reading an argument with vertico
;; run the vertico command on {M-RET} which accepts the first
;; line of minibuffer input, rather than any candidate.
((and hargs:reading-type
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we just add an appropriate check for whether the vertico-mode variable is true or not and dispatch as needed (defer to vertico) rather than touching the hargs:reading-type clause?

Copy link
Copy Markdown
Owner

@rswgnu rswgnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have manually integrated the needed code from here and will push it to the rsw branch today. We can close this PR.

@rswgnu rswgnu closed this Apr 12, 2025
@matsl matsl deleted the accept-M-RET-on-all-input-with-vertico branch April 12, 2025 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants