Per source matching and sorting customization #2572
Replies: 3 comments
-
matthuszagh ***@***.***> writes:
I have a source (from helm-build-sync-source) for which the default
matching and sorting isn't quite working how I want. So, I'd like to
customize this behavior. From reading helm-source.el, it seems one way
to do this would be to override the values of helm-fuzzy-sort-fn and
helm-fuzzy-match-fn. However, I think this would be applied to all
sources, not just this one, which I don't want. I think an alternative
would be to perform matching and sorting in :candidates (with setting
:match-dynamic to t). Is that the intended way to do accomplish what I
want?
No, but you can of course.
I think of a better way:
1) Instead of using helm-build-sync-source with :fuzzy-match slot, setup
your own class inheriting from sync-source.
2) define a cl-defmethod helm-setup-user-source (or helm--setup-source
id needed maybe with :after slot) adding your sort fn to filtered-candidate-transformer and
your match fn to match fns.
3) Create your source with helm-make-source and use it.
… Thanks!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.*Message ID: ***@***.***>
--
Thierry
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the advice Thierry. My understanding is that Is there a way to accomplish this with the method you describe above? |
Beta Was this translation helpful? Give feedback.
-
matthuszagh ***@***.***> writes:
Thanks for the advice Thierry. My understanding is that
filtered-candidate-transformer is applied after candidate limiting. Is
that right?
Yes.
If so, I was hoping for something that performed sorting after
matching but before candidate limiting.
Did you try candidate-transformer instead?
I like the default candidate limit of 100, but my source/matching can
match more than that. In that case, Sorting will show the best matches
first, then candidate limiting will restrict to 100. If I sort after,
then I won't be getting the best matches.
I see.
…--
Thierry
|
Beta Was this translation helpful? Give feedback.
-
I have a source (from
helm-build-sync-source
) for which the default matching and sorting isn't quite working how I want. So, I'd like to customize this behavior. From readinghelm-source.el
, it seems one way to do this would be to override the values ofhelm-fuzzy-sort-fn
andhelm-fuzzy-match-fn
. However, I think this would be applied to all sources, not just this one, which I don't want. I think an alternative would be to perform matching and sorting in:candidates
(I'll be sure to also set:match-dynamic
tot
). Is that the intended way to do accomplish what I want?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions