emacs-devel
[Top][All Lists]
Advanced

[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: Stefan Monnier
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, 27 Feb 2019 12:12:16 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> This may be off topic now, but to the best of my recollection this
> discussion started from the question of the ability to add flex matching to
> particular completion tables. So that's where I was coming from, FWIW.

I see.  I was taking the point of view of a generic `flex` method for
use anywhere you like (I think the original motivation was to use it in
conjunction with `icomplete-mode` to more closely match to `ido`
behavior).

> Also also, combining the flex sorting with most other kinds will most likely
> make the flex sorting hard to notice.

Depends on the ordering (see below).

>> - Add global sorting config var(s?), to choose which kind of sorting to
>>    use, which would default to sorting based on "scores first and
>>    alphabetical after that".
>
> Put those defaults into completion-category-defaults, and you basically have
> my proposal, isn't that right?

completion-category-defaults is an alist providing extra settings for
specific categories, so it's not "global" in the sense I meant above
because can't be used to choose the sorting used for categories not
mentioned in completion-category-defaults.

>> - What about the distinction between cycle-sort and display-sort?
> TBH, I still don't know what's the difference between these.

display-sort is the sorting used when displaying the candidates in
a list like *Completions* whereas cycle-sort is the sorting used when
your TAB cycles through possible candidates (and it's also used in
icomplete-mode).

In display-sort we currently sort alphabetically whereas in cycle-sort
we want to use a heuristic that puts more likely choices first.

Maybe we should drop this distinction and just use the same sorting
everywhere (which would have to be the cycle-sort by default I think,
because the alphabetical sort is really a poor choice when cycling in
my experience).

The downside of the heuristic sort of cycle-sort is that sometimes/often
the heuristic is poor (by default it's just based on string
length ;-( ), so the *Completions* buffer would look "unsorted".

>> In any case, in the mean time we can probably just introduce the new
>> sorting based on "scores first and alphabetical after that" and use it
>> by default.
> *thumbsup*

OK, let's go with that for now.


        Stefan




reply via email to

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