[Top][All Lists]

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

Re: [Emacs-diffs] scratch/new-flex-completion-style 2c75775 2/2: Score,

From: João Távora
Subject: Re: [Emacs-diffs] scratch/new-flex-completion-style 2c75775 2/2: Score, sort and annotate flex-style completions according to match tightness
Date: Wed, 06 Feb 2019 10:09:31 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Dmitry Gutov <address@hidden> writes:

> On 03.02.2019 02:28, Jo�o T�vora wrote:
>> +          ;; Sort again in case the completion style has propertized
>> +          ;; completions with a 'completion-style-sort-order.
>> +          (setq completions
>> +                (sort completions
>> +                      (lambda (a b)
>> +                        (let ((va (get-text-property 0 
>> 'completion-style-sort-order a))
>> +                              (vb (get-text-property 0 
>> 'completion-style-sort-order b)))
> Shouldn't we be concerned that this overrides display-sort-function
> returned by the completion table?

Perhaps.  But it only does so when the completion style explicitly
wanted it.  And even so, the sort order should be stable, i.e. if the
completion style puts numerically equal values in two completions, they
should retain the backend's order.  And, obviously, it it doesn't put
any values in that property, then the backend's order is also retained.

In my experience, at least for the "flex" (also called "scatter", by the
way) completion style, the frontend's sorting takes precedence

> Maybe some sort of customizable mechanism is in order, similar to
> completion-styles.

It is already customizable: you don't have to use "flex" completion
style.  Let's first try it out and then see if we need _more_

> Or more simply, we just leave it to the completion table's author to
> set display-sort-function to a special value that makes use of these
> properties. It's not like setting it to a different value is going to
> make sense in this case.
>> +          ;; Annotate completions with <...>
>> +          ;; the completion style annotation.
> Is this for debugging?

At the moment, yes mostly.  But it could not be.  In SLY, I give users
an indication of how the scoring algorithm is working.  See it in



reply via email to

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