-
Notifications
You must be signed in to change notification settings - Fork 25
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
Support function as the value of prescient-filter-method #110
Support function as the value of prescient-filter-method #110
Conversation
Does this work with the toggling commands in the Selectrum-Prescient package? |
@okamsn Whoops, no—I was not familiar with that feature. I just added a commit which makes it work with the |
Thank you. This seems to work for me. Maybe, in addition to allowing the function value and the flat list it is currently, it might also make sense to just allow That way, instead of everyone needing to copy a function like that which @peterstuart has written, they could just do (setq prescient-filter-method
'((file . (fuzzy))
(command . (fuzzy))
(consult-multi . (fuzzy))
(t . (literal regexp initialism)))) where the key is the completion category and the value is a symbol or list of symbols. Or, if one wanted to mimic (setq prescient-filter-method
'((file . ((style . (fuzzy))
(case-fold . nil)
(char-fold . t)))
(command . ((full-matches-first . t)))
(t . ((style . (literal regexp initialism))
(case-fold . smart))))) which could also locally bind the variables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨ Looks great, thank you!
I see the motivation for this, but I'd prefer not to do that at this time. I think that depending on the user's Emacs configuration there are quite a few potentially reasonable different ways to determine what the "current completion context" is, and I don't really want to tie That said, I remember there was discussion about this in the Selectrum project where I took a similar position---did you end up finding a reasonable solution that was deemed not too fragile to endorse officially? |
Not that I recall. Re-reading the discussions, it doesn't look like any option was found to be the clear best. My understanding of things is that packages like Consult, Embark, and Marginalia make good use of the "completion category" metadata, which might or might not encourage its use in other places. There's also the new variable
I understand. Hopefully a clear best approach arises in the future. |
The discussion (or at least some of it) was actually in this project:
As reported in #146 just now, I haven't yet found any workable solution for my needs based on the above. |
Fixes #83. The use case is to be able to use different filter methods depending on the type of completions. I am testing this with the following config:
I am an elisp beginner—hopefully I've done this correctly 😄