You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, thank you for this great package! It has been fun to use and I love how it can read my mind.
I do find myself wanting to narrow my search by adding a second query. For a long time, I have tried combining hotfuzz with orderless, fussy, my own experimental algorithms, etc.
But what I have found most natural, is to split the query (needle) into words, then calculating hotfuzz--cost on each and summing the result. For a single-word query, nothing changes and each additional word narrows the results as expected.
Here is my horribly inefficient proof-of-concept code:
(defunmy/completion-all-completions (stringtablepred&optionalpoint)
(let ((words (string-split string)))
(cl-loopfor (cost . candidate) in (sort (cl-loopfor candidate in (all-completions"" table pred)
with candidate-copy = candidate
for cost = (cl-loopfor word in words
for cost = (hotfuzz--cost word candidate)
if (>= cost 9000) returnnilsum cost)
unless (null cost) do (setq candidate-copy (substring candidate))
anddo (cl-loopfor word in words
do (hotfuzz-highlight word candidate-copy))
andcollect (cons cost candidate-copy))
'car-less-than-car)
collect candidate)))
(put'my/completion'completion--adjust-metadata'hotfuzz--adjust-metadata)
(cl-pushnew '(my/completion completion-flex-try-completion my/completion-all-completions "Custom completion style") completion-styles-alist)
(setq completion-styles '(my/completion))
As soon as we allow more than one word, we open up a world of possible semantics, so this has to be carefully chosen. This code, for example, doesn't do well when the words have characters in common, as the following words' characters are "eaten". This could be addressed by ranking results with a higher count of match characters higher. I will try this when I find time.
Thoughts on this?
The text was updated successfully, but these errors were encountered:
Hello, thank you for this great package! It has been fun to use and I love how it can read my mind.
I do find myself wanting to narrow my search by adding a second query. For a long time, I have tried combining hotfuzz with orderless, fussy, my own experimental algorithms, etc.
But what I have found most natural, is to split the query (
needle
) into words, then calculatinghotfuzz--cost
on each and summing the result. For a single-word query, nothing changes and each additional word narrows the results as expected.Here is my horribly inefficient proof-of-concept code:
As soon as we allow more than one word, we open up a world of possible semantics, so this has to be carefully chosen. This code, for example, doesn't do well when the words have characters in common, as the following words' characters are "eaten". This could be addressed by ranking results with a higher count of match characters higher. I will try this when I find time.
Thoughts on this?
The text was updated successfully, but these errors were encountered: