GNU bug report logs - #45260
28.0.50; Maybe flex should only sort when there is no sorting metadata?

Previous Next

Package: emacs;

Reported by: Omar Antolín Camarena <omar <at> matem.unam.mx>

Date: Tue, 15 Dec 2020 18:48:01 UTC

Severity: normal

Found in version 28.0.50

Full log


Message #53 received at 45260 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 45260 <at> debbugs.gnu.org,
 Omar Antolín Camarena <omar <at> matem.unam.mx>
Subject: Re: bug#45260: 28.0.50; Maybe flex should only sort when there is
 no sorting metadata?
Date: Tue, 28 Sep 2021 23:17:07 +0100
Dmitry Gutov <dgutov <at> yandex.ru> writes:

> And more, if we count the underlying technical issue that is the
> headline of this report.

Underlying technical isse?  As I see it it's a simple feature request.
It even starts with the word "Maybe".  It started with a description of
the "Consult" system, which was very clear.  Then I understood the
problem and decided that it goes against some fundamental flex
behaviour.  That is all.

Anyhoo, here's my poor man's consult directly from an Emacs -Q
*scratch*:

   ;; This buffer is for text that is not saved, and for Lisp evaluation.
   ;; To create a file, visit it with C-x C-f and enter text in its buffer.
   (require 'cl-lib)
    
   (defun confabulate ()
     (interactive)
     (let* ((lines (cl-loop for i from 1
                            for s in (split-string (buffer-string) "\n")
                            collect (format "%s: %s" i s)))
            (choice (completing-read
                     "Hey, choose a line: "
                     (lambda (string pred action)
                       (if (eq action 'metadata)
                           `(metadata (cycle-sort-function . ,#'identity))
                         (complete-with-action action lines string pred)))
                     nil t)))
       (goto-line (string-to-number choice))))

Eval this and M-x confabulate.  Pick your favourite UI (vertico?) and
style (orderless?)  Does this work how you want?  I guess it does, no
flex involved.

But I use flex and icomplete in my .emacs, and I like the way it works
for me, just fine and quite a useful little snippet.

I type 'oos' and I get line 7 as my first candidate.  Omar would prefer
line 1, I guess.  I don't.  I suppose orderless gives line 1.  I'm fine
with that.

> That seems optimistic. Especially since 'flex' is a rare exception
> among other completion styles, in that it affects sorting (through an
> opaque mechanism), and not just filtering.

I don't care if it's an exception, it's also the only one to do scoring
of completions.  Quite an important part of it.  Without it, it's pretty
useless.  You think the original table order is _more_ important and
should override scoring.  I don't get that, but I certainly won't judge
you for wanting it.  That behaviour is ONE cusotmization variable away.
Or a new completion style, which isn't complicated.  Do you want me to
add this customization variable, yes or no?

> Omar brought in a scenario of something the user does, starting with
> the UI, and the full use case.
> You responded with an abstract piece of behavior.

Abstract?  I gave a super-clear example, with a three-number answer, and
now have even coded it in Elisp.  Really, I'm not the one with the
"non-categorical evidence" here!

> I didn't do 'flex' and I don't do 'flix'. I'm not the
> person/place/piece-of-software people come to for completions
> styles. I have to deal with existing styles. Even if just one of them
> has a problem, that can bring a question or a bug report on my
> doorstep.

If it's not your bug and you don't know how to answer the question, then
just say that to the user.  I sympathize with your care for beginner
users, I've said that.  But here there's nothing I can do.  Flex works
as designed, to the best of my knowledge.

João




This bug report was last modified 3 years and 261 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.