-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Deprecating Selectrum in favor of Vertico #237
Comments
The dark blue face you are seeing here is probably the If you want to use a setup which is comparable to your Selectrum setup I recommend the following: (vertico-mode)
(setq completion-styles '(orderless basic)) ;; orderless filtering
(savehist-mode) ;; remember minibuffer history, useful for sorting by recency (not frecency) If Prescient gets completion styles support at some point (radian-software/prescient.el#89) you could integrate that with Vertico and use it for sorting by frecency and filtering. For now I suggest you try Orderless since this package behaves similarly to Prescient. |
I think I asked this before, but I don't remember how the completion system works or if this is actually easily possible. Would it be possible for prescient's sorting and filtering to be implemented separately, so that orderless' filtering could be used with prescient's frecency sorting? Orderless' current style of filtering was inspired by prescient (space separating multiple filters that all much match rather than acting as ".*"), but it is a lot more customizable. It would be great to be able to use orderless with frecency sorting (which I do prefer a little over the recency-only sorting that vertico currently supports). |
Yes, my preferred solution would be to develop a prescient-new-gen package which takes care of sorting by frecency only. As you wrote, Orderless filtering has advantages over Prescient filtering (flexibility, also performance and it is already a completion style). We can hook Prescient sorting into Vertico quite easily by setting the Personally I think I don't need sorting by frencency, since I am happy with recency-based sorting so far. Sorting by recency is simpler and more predictable and we can reuse the minibuffer history instead of implementing a custom persistence mechanism. But if someone steps forward extracting the frecency-sorting from Prescient I would appreciate it, since then we would get a solution which can fully substitute Selectrum+Prescient. The great thing about a separate prescient-new-gen package would be that it is separate and orthogonal from filtering and as such fits the spirit of small composable packages better. Frecency non-believers like myself could omit it. ;) I assume that it should also be very easy to hook the existing Prescient into Vertico+Orderless. See also https://github.com/radian-software/selectrum#alternative-2-orderless, where a configuration for Selectrum is described which uses Orderless and Prescient sorting. |
See radian-software/radian#505 for @raxod502's current attempt at replacing Selectrum with Vertico in his Radian Emacs config. |
Btw @noctuid, I've considered before to move out Vertico sorting to a separate extension (see https://github.com/minad/vertico/compare/extract-sort). Sorting is truly a separate feature which does not necessarily have to come with the completion UI directly. |
Right, it was developed independently. I was just talking about the space separating multiple components but was misremembering. No idea whether or not that was inspired by prescient (I think no). It was the added support for initialisms that was inspired by prescient (orderless originally only supported basic regexp components).
That seems reasonable. So sorting cannot be implemented in some generic way at a level below/separate from vertico then? |
The UI calls the sort function but the sort function itself is mostly agnostic to the UI. My point here is only that the UI doesn't necessarily have to come with sort functionality out of the box so it could be provided by either a small separate extension package like vertico-sort or by prescient. |
See the comment by @Dima-369 about using Prescient for sorting only in Corfu/Vertico: radian-software/prescient.el#112 (comment). This seems to work without much effort. And Orderless can be used for filtering. |
Great to hear that sorting is worked on! Would this allow for qualitative sorting? For example when filtering (using orderless) "Interface .cpp" -> in the results, sort "interface.cpp" before "interfaceFoo.cpp". |
@ghosty141 Sure, this is already possible. In Vertico you can configure your own sorting function, see |
(How) can Vertico implement an equivalent of For the record, I sorely miss prescient-style frecency sorting from Vertico. |
If you missed it, savehist-mode comes close
|
@haselwarter Prescient (frencency) sorting can be used in principle with Vertico. There is no need for selectrum-read-file-name. You can simply use the Emacs builtin read-file-name. |
@minad That's great, how do I do that? It would be worth documenting this in the readme if it can be made to work without too much difficulty.
@raxod502 can probably explain this better, but |
@haselwarter I have no recipe on how to connect Prescient with Vertico. But it should be possible. I linked above to another issue where someone tried to connect Vertico/Corfu+Prescient. Overall this needs a little bit of work to make sure that it works smoothly. To enable the special file completion add partial-completion to the completion-styles. This is documented in the Vertico readme. This is not a Selectrum-specicic feature but already available out of the box by Emacs completion. |
I must confess I actually did not know this was possible! (Although I just tested it and can see that it does.) So, unfortunately, I don't have any insight to shed here. |
@okamsn and @Dima-369 have added instructions to the Vertico/Corfu wiki on how to connect Prescient sorting to Vertico/Corfu. See also radian-software/prescient.el#112 and radian-software/prescient.el#120. |
I tried to switch from Selectrum (with prescient) to Vertico and I see a very noticeable slow-down in showing What can be the reason for that? such slowness is not acceptable as I notice that every time running Here's my vertico setup: (use-package vertico
:config (vertico-mode 1))
(setq completion-styles '(basic substring partial-completion flex))
(setq read-file-name-completion-ignore-case t
read-buffer-completion-ignore-case t
completion-ignore-case t) |
@velppa The profile you showed here is not suspicious. For Selectrum it will look essentially the same. The time is spent almost entirely during candidate computation (all-completions). For me M-x is fast for both UIs. How does the comparable profile look for Selectrum in your setup? |
Selectrum may end up deprecated in favor of Vertico, see minad/vertico#237.
Selectrum may end up deprecated in favor of Vertico, see minad/vertico#237.
@minad Since updating to emacs 29 i am also experiencing severe lag that i do not notice with selectrum. secletrum:
vertico:
|
It is possible your build of Emacs 29 is the issue? I'm on Emacs 29 as well, and I find
|
GNU Emacs 29.0.50 (build 1, x86_64-apple-darwin20.6.0, NS appkit-2022.70 Version 11.6.7 (Build 20G630)) of 2022-08-25 It does appear to not just be veritco. Using icomplete:
I realze this might not be the thread to be posting these things, but maybe could help others if they stumble upon it too.
Removing orderless has seemed to fix this |
@sawwheet Please report this upstream or ask on the emacs mailing list about this. This is a regression in Emacs 29 if multiple packages are affected by this inefficiency. The issue might be that Emacs 29 added an expensive version check in the completion predicate, see https://github.com/emacs-mirror/emacs/blob/4015d561c39d29200bf1ac542844fd5f3ba99426/lisp/simple.el#L2334. Can you create a minimal reproducible starting from emacs -Q? Only Icomplete/Vertico with or without Orderless? Narrowing down the precise commit in Emacs 29 which caused this via git-bisect could also help. |
@okamsn Regarding the toggles in selectrum-prescient/vertico-prescient, isn't it possible to implement this in an UI agnostic way? I think UI specific code is only needed to refresh the UI (the call to vertico--exhibit). |
Only for candidates that were filtered by Because of those things, I think that it makes better sense to control the sorting at the interface level instead of the completion-style level.
That's good to know. I will simplify the docs with that in mind.
I agree, so long as the variables can be made local to the UI's buffer. I will check whether advising such generic commands to run the UI-specific code is enough. The modes could just add/remove the advice. |
Alright, I missed that you want to use override styles. Then I suggest to remove prescient-enable-completion-sort and the metadata adjustment entirely from Prescient. It is better to offer a single technique which works everywhere. This keeps Prescient simpler, given that the metadata adjustment is messy. Furthermore we follow the design of Orderless/Vertico more closely, since sorting and filtering are decoupled in this case. See also #237 (comment). |
It is better to make the various completion UIs use `prescient-completion-sort` directly, as this allows the sorting of candidates filtered by other completion styles and avoids Company Prescient re-sorting candidates from `company-capf`. To keep things simple, the option of modifying completion-table metadata is removed. See radian-software#129 and conversations in minad/vertico#237.
It is better to make the various completion UIs use `prescient-completion-sort` directly, as this allows the sorting of candidates filtered by other completion styles and avoids Company Prescient re-sorting candidates from `company-capf`. To keep things simple, the option of modifying completion-table metadata is removed. See #129 and conversations in minad/vertico#237.
Ok, I've merged my PR updating Radian to use Vertico instead of Selectrum, and have been using Vertico personally for the last few weeks. Is the next step to update the Selectrum README noting that Selectrum is soft-deprecated, and linking to the migration guide? |
@raxod502 Yes, this is the next step. I am sure we will receive more feedback then, such that we can extend the migration guide. |
Selectrum doesn't fully support dynamic completion tables, which are widespread in Emacs (find-file, completion-table-dynamic, ...) and has other technical issues. Since there are multiple fully compliant completion UI alternatives available, we phase out Selectrum support in Consult. Furthermore we consider deprecating Selectrum in favor of Vertico. Vertico is simpler than Selectrum and has been designed specifically to address the shortcomings of Selectrum. See minad/vertico#237 and https://github.com/minad/vertico/wiki/Migrating-from-Selectrum-to-Vertico. In the future the plan is to only support UIs which are fully compliant in Consult. For the package ecosystem it is better to stick to fully compliant UIs, since this reduces the amount of UI-specific workarounds across the ecosystem. If you have feedback regarding the deprecation, please let me know. For the time being, the deprecation message can be disabled by adding the following to your init.el: (with-eval-after-load 'consult-selectrum (advice-remove 'consult--read 'consult-selectrum--deprecated))
Ok cool. Although I guess it makes sense to wait until radian-software/prescient.el#131 is merged, so we can point people at that. |
To give you a status update: @okamsn added the vertico-prescient-mode and corfu-prescient-mode to the prescient repository and updated the wikis including the migration guide accordingly. The integration packages vertico-prescient and corfu-prescient are already available on MELPA. |
I'm not sure if it is possible to use both orderless for filtering and prescient for sorting, but either way I think it's a question that people will have that should be documented some place and I don't see it now. |
@hmelman Yes, it is possible to enable only prescient sorting. See the documentation https://github.com/radian-software/prescient.el#for-vertico. |
@minad Good to know and see. It would be nice if orderless was specifically mentioned so someone search for "using prescient with orderless" would be directed there. |
@hmelman Sure. In case anyone is interested in such a configuration and has it running in their setup, I'd appreciate a contribution to the wiki. The wikis are open for everyone. But I suspect that Orderless+Prescient is a fringe configuration which isn't very popular given that Vertico already sorts the candidates by recency out of the box. |
@raxod502 Did you try updating your radian configuration to use vertico-prescient-mode? Shall we proceed with adding a note to the Selectrum README as you proposed in #237 (comment)? |
@raxod502, As a heads-up, I (and maybe someone else in radian-software/prescient.el#137) had install issues arising from the different URL's in the old version of Prescient's recipe and Vertico/Corfu-Prescient's recipe. I just made Straight redownload everything, but there's probably a better way. |
Yep, I didn't get to this last week but here you go! radian-software/selectrum#601 Thank you very much for the help! Let me know what you think of the update, feel free to adjust and merge as desired. I personally don't have recipe issues with the latest MELPA version, but I can very much believe that's because I instinctively knew the right sequence of knobs to twiddle. There are issues in this area for |
I guess that is that, then. At some point when I have more time (I'm focusing on improving maintainability for a different of my projects right now), I will go through Selectrum and help contribute to the migration guide, potentially rewrite Selectrum as a Vertico shim, basically finalize the process of getting everyone off the old version, and go through and clear out the issue tracker. |
@raxod502 Thank you, looks good. I merged the PR. I've also considered creating a shim. It may suffice to not emulate all Selectrum features 1 by 1. Instead selectrum-mode could simply enable Vertico with reasonable defaults and print a warning message. |
Hey @minad, per radian-software/selectrum#598 (comment) I'm investigating what's needed to deprecate Selectrum in favor of Vertico. Mostly, this means making sure Vertico has feature parity with Selectrum. I figured there would probably be a bit of discussion necessary on a variety of topics, so I opened this issue to have a single place for those.
My first question is about faces used by Vertico. Vertico defines four faces of its own (
vertico-multiline
,vertico-group-title
,vertico-group-separator
,vertico-current
) but it appears that other faces are used as well, at least by default. I presume these faces come from the default Emacs completion system. For example, here is a dark blue face I'm seeing (with zerodark-theme):Which doesn't match any of Vertico's faces:
Is there a list of the faces that will end up in the minibuffer by default with Vertico, so that users know what they have to customize in order to change the appearance?
The text was updated successfully, but these errors were encountered: