emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] master b0e318d 2/2: Score flex-style completions accor


From: João Távora
Subject: Re: [Emacs-diffs] master b0e318d 2/2: Score flex-style completions according to match tightness
Date: Sun, 17 Mar 2019 21:27:55 +0000

[sorry for the double mail Dmitry]

On Sun, Mar 17, 2019 at 8:22 PM Dmitry Gutov <address@hidden> wrote:
>
> On 17.03.2019 21:09, João Távora wrote:
>
> >> You did, but that's neither here not there. A fix PR would be welcome,
> >> but I'll get around to it otherwise myself, no problem.
> >
> > I sent you a PR that should fix it.
>
> Thanks!
>
> > That would be nice, of course, but it's not strictly required to
> > start making use of it in company.el: you can look for it and act
> > accordingly when it's found.
>
> The sorting function to use should come from somewhere, right?

Yes, in this case it would come from company. I was thinking you
could sort by `completion-score` in descending order.

> But if you just want to try and see how well the sorting works, you can
> add one to `company-transformers`.

Thanks, I added

(defun sort-by-company-score (cands)
  (cl-sort cands
           #'>
           :key (lambda (cand) (or (get-text-property 0
'completion-score cand) 0)))

(add-to-list 'company-transformers 'sort-by-company-score)

And it behaves much better.  My idea is that something like this could be
be built-in into company (after the lexicographical sort).

João

On Sun, Mar 17, 2019 at 8:22 PM Dmitry Gutov <address@hidden> wrote:
>
> On 17.03.2019 21:09, João Távora wrote:
>
> >> You did, but that's neither here not there. A fix PR would be welcome,
> >> but I'll get around to it otherwise myself, no problem.
> >
> > I sent you a PR that should fix it.
>
> Thanks!
>
> > That would be nice, of course, but it's not strictly required to
> > start making use of it in company.el: you can look for it and act
> > accordingly when it's found.
>
> The sorting function to use should come from somewhere, right?
>
> But if you just want to try and see how well the sorting works, you can
> add one to `company-transformers`.



-- 
João Távora



reply via email to

[Prev in Thread] Current Thread [Next in Thread]