Subject: bug#45260: 28.0.50; Maybe flex should only sort when there is no sorting metadata?

From: João Távora <[email-masked]>
Date: Tue, 17 Aug 2021 17:58:00 +0100

Omar Antolín Camarena <[email-masked]> writes:

>>  I've not seen an example of a table where its original sorting
>>  mattered more _when_ there is some search pattern.
> I'd argue the case I mentioned in the bug report is a good example. That
> was the case of the consult-line command from Daniel Mendler's consult
> package.

I don't know consult.  Is it a completion table?  For what?

> icomplete-mode (preferably icomplete-vertical-mode since these
> candidates are full lines!), it is jarring that flex jumbles the line
> order.

I see.  A table where the candidates are the lines of a file.  Well, not
jarring the way I look at flex, not the way _I_ use it.  My personal
expectation is to bubble up the tightest matches to the top.  If you're
interested where I picked up the idea, it's from many years of Common
Lisp programming with lots (close to a million IIRC) of named symbols.

Anyway, sounds like a job for a flex-sort-but-only-sometimes completion
style.  Or a flex sorting algorithm with another formula that produces
more ties.

Then, in a file with these 5 lines:

1: fabricate organic ornitopters
2: bar
3: and also using fooey
4: baz
5: using foo

With the pattern "foo", my personal expectation, and the way flex works
right now IINM, is to see 5, 3, 1.

Do you prefer to see 3, 5, 1?  Or keep 1, 3, 5 as presumably the table
stipulates?  Or something else?  Probably your decision in a new 'omar
style.

João