unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 45260@debbugs.gnu.org, "Omar Antolín Camarena" <omar@matem.unam.mx>
Subject: 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	[thread overview]
Message-ID: <87ilykcplo.fsf@gmail.com> (raw)
In-Reply-To: <e8745aec-9af6-7fae-1cb0-cc05bff856ac@yandex.ru> (Dmitry Gutov's message of "Tue, 28 Sep 2021 19:30:49 +0300")

Dmitry Gutov <dgutov@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





      reply	other threads:[~2021-09-28 22:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 18:47 bug#45260: 28.0.50; Maybe flex should only sort when there is no sorting metadata? Omar Antolín Camarena
2021-08-17 10:41 ` João Távora
2021-08-17 12:42   ` Dmitry Gutov
2021-08-17 14:05     ` João Távora
2021-08-17 14:49       ` Dmitry Gutov
2021-08-17 15:27         ` Omar Antolín Camarena
2021-08-17 16:58           ` João Távora
2021-08-17 16:38         ` João Távora
2021-09-27 23:11           ` Dmitry Gutov
2021-09-27 23:25             ` João Távora
2021-09-27 23:40               ` Dmitry Gutov
2021-09-28  0:36                 ` João Távora
2021-09-28  0:39                   ` João Távora
2021-09-28 12:38                   ` Dmitry Gutov
2021-09-28 16:09                     ` João Távora
2021-09-28 16:30                       ` Dmitry Gutov
2021-09-28 22:17                         ` João Távora [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilykcplo.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=45260@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=omar@matem.unam.mx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).