Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vertico not offering function completions for M-: eval-expression? #145

Closed
DivineDominion opened this issue Oct 22, 2021 · 7 comments
Closed

Comments

@DivineDominion
Copy link
Contributor

When I switched from selectrum to vertico, I noticed that when I hit M-: to eval an expression, the tab completion of function names doesn't appear to use vertico at all. Instead a new window with a list of completion candidates pops up.

Am I missing a setting? I looked for hints in the README and found that vertico doesn't seem to hook into this by default.

"Fixes" by other vertico users can be found e.g. here:
https://libredd.it/r/emacs/comments/opf1kk/switched_to_vertigo_consult_and_minibuffer/?sort=top

Is there a reason why this is not part of vertico-mode's setup of hooks?

@minad
Copy link
Owner

minad commented Oct 22, 2021

Completion-at-point/completion-in-region is an orthogonal concern to minibuffer completion. Therefore it is not provided here. There are many possible frontends for completion-at-point/completion-in-region, for example Corfu.

From the perspective of vertico the canonical solution if you want to use the minibuffer is consult-completion-in-region. This is not a fix or a hack - consult-completion-in-region is the proper implementation for this feature.

I should add - maybe you also tried Selectrum, which implements completion-in-region support via its selectrum-completion-in-region function. The two functions selectrum-completion-in-region and consult-completion-in-region are mostly equivalent, with the only difference that consult-completion-in-region is completion system agnostic (works with icomplete, vertico, etc). Therefore it fits the spirit of Consult and Vertico can get by without its own implementation.

@minad minad closed this as completed Oct 22, 2021
@DivineDominion
Copy link
Contributor Author

Thanks for explaining, @minad! I didn't realize that these were two different things because in both cases I am typing in the minibuffer (or so it seems)

The code by @karthink from the above mentioned link works, apparently more-or-less in the same way selectrum installs itself for this case:

  (add-hook 'vertico-mode-hook (lambda ()
                                 (setq completion-in-region-function
                                       (if vertico-mode
                                           #'consult-completion-in-region
                                         #'completion--in-region))))

@minad
Copy link
Owner

minad commented Oct 23, 2021

This is also documented in the README: https://github.com/minad/vertico#completion-at-point-and-completion-in-region

@DivineDominion
Copy link
Contributor Author

@minad I now realize that, too. Problem was I didn't know this is used by eval-expression. I assume that the question some users have is not "how do I enable Vertico for my completion-in-region-function?", but "how do I enable vertico for eval-expression completion?"

@dmitrym0
Copy link

I assume that the question some users have is not "how do I enable Vertico for my completion-in-region-function?", but "how do I enable vertico for eval-expression completion?"

That is correct. I read through the eval-expression paragraph (int the README) a couple of times but it did not click for me. If I may humbly suggest to word it more explicitly?

@DivineDominion
Copy link
Contributor Author

@dmitrym0 So with the changes from https://github.com/minad/vertico/pull/148/files and the more recent README version, what would you like to see there? @minad accepted my changes after this discussion, so if you have a suggestion that would've been helpful for "past you", I'd suggest to open a PR :)

@dmitrym0
Copy link

@dmitrym0 So with the changes from https://github.com/minad/vertico/pull/148/files and the more recent README version, what would you like to see there? @minad accepted my changes after this discussion, so if you have a suggestion that would've been helpful for "past you", I'd suggest to open a PR :)

I spent some time thinking about it -- I couldn't come with anything better without overloading the already large README. This should be fine, thanks for the documentation :)

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

No branches or pull requests

3 participants