From: Heime via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Eli Zaretskii <eliz@gnu.org>, 65459@debbugs.gnu.org
Subject: bug#65459: completing-read INITIAL-VALUE unaware of COLLECTION and REQUIRE-MATCH
Date: Thu, 24 Aug 2023 21:45:13 +0000 [thread overview]
Message-ID: <NH7WSL98VuVhT01YPvHBmORrvkYUh8gwdMSlJJyYlMJLr_pCtePAocmflbebgW7XmRPiYigDGFlRqd34EbxcvuvRMBehnW1JWm_V6DX3zq8=@protonmail.com> (raw)
In-Reply-To: <jwvh6oonpm5.fsf-monnier+emacs@gnu.org>
Sent with Proton Mail secure email.
------- Original Message -------
On Friday, August 25th, 2023 at 9:02 AM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> > > Using the DEFault arg gives you the same benefit without prefilling the
> > > minibuffer, so I must be missing something. What would be the advantage
> > > for the users by prefilling the minibuffer with "Chronological Dating"?
> > > Yes, without prefilling the minibuffer. Prefilling the minibuffer is
> > > quicker for users, giving them the possibility to see the current
> > > stage if they forget default key shortcuts.
>
>
> The `format-prompt` thingy in my example code is there to show to the
> users what the default will be.
>
> > The more we discuss this the more it seems the prefilling
> > the minbuffer was something we never wanted users to have.
>
>
> Indeed, it was never intended for regular use. It's only meant to be
> used in specific cases like `read-file-name` where we do have something
> to prefill that is almost always useful.
>
> [ You used the term "dogma" earlier, but I like to think of Emacs
> design as being rather undogmatic in that we go through a lot of
> trouble to allow people to do even those things that we don't want
> them to do. ]
>
> > > > > So, IIUC, you have a `completing-read` call asking them which template
> > > > > to insert, and you want to order the set of completions based on
> > > > > knowledge of the stage at which they are?
> > > > > No ordering actually happens, a particular element in collection is used
> > > > > to prefill the minibuffer entry and consecutive elements in simple
> > > > > cycling continue through the next stages.
> > >
> > > Yes, the ordering I'm talking about is the order in the operational
> > > flow refined such that if the likely next stage is "Composition and
> > > Provenance", then you'll want to use:
> > >
> > > "Composition and Provenance" "Isotope Analysis" "Physical Analysis" "Chronological Dating"
> > >
> > > That's what you want, right?
> >
> > Correct, but the actual collection might still be
> >
> > "Physical_Analysis" "Chronological Dating" "Composition and Provenance" "Isotope Analysis"
> >
> > Rather than applying modifications to it, I can just specify the start index.
>
>
> That's an implementation detail.
>
> E.g. you can use
>
> (defconst my-phases
> '("Physical_Analysis" "Chronological Dating" "Composition and Provenance" "Isotope Analysis"))
>
> (defun my-rotate (collection first)
> (let ((x (member first collection)))
> (if (not x) collection
> (let ((idx (- (length collection) (length x))))
> (append x (seq-take collection idx))))))
>
> [...]
> (let ((next-phase (my-guess-next-phase)))
> (completing-read (format-prompt "Phase" next-phase)
> (my-rotate my-phases next-phase)
> nil t nil nil next-phase))
> [...]
>
> > > You mean, if they use, say, `icomplete-mode` or `vertico-mode`, you'd
> > > prefer that those UIs use an alphabetical ordering rather than the one
> > > based on operational flow?
> >
> > I would think that if they use vertico, there is a reason that is convenient
> > to them to use cempletion, if they are not employing simple cycling (through
> > repeated use of <down>).
>
>
> Both `icomplete-mode` and `vertico-mode` offer/encourage the use of
> cycling (but their cycling code is completely different from the one
> you're using so it doesn't obey `next-history-element`), so I expect
> their users would also appreciate if the ordering of the completions is
> chosen with the same care as what you do for the
> `next-line-or-history-element` case.
>
> > Quite right, and help programmers from the need to go as low level as
> > calling 'minibuffer-with-setup-hook' hacks. The unfortunate thing is that
> > the inclusion of INITIAL makes people want to use it, as I did in certain
> > circumstances. Having to go through 'minibuffer-with-setup-hook' hacks
> > is not something one looks forward to do in the interactive clause of a
> > function.
>
>
> +1
>
> I guess we really should work on a replacement for `completing-read`, eh? - Stefan
If we want to surpass the present conundrum, the path in clear. completing-read has evolved
through incremental changes without considering the long-term implications. And we continue
to accumulate additional parameters, flags, and branches to accommodate new functionalities.
This has led to a serious lack of cohesion and a convoluted structure. Making it difficult
to discern its primary purpose. I have concluded that its evolution today requires it acquire
dependencies on other parts of its codebase. Instead, we have started changing the documentation
to discourage this usage, that usage, and so on. For short-term one can accept it, but robust design
is needed for long-term usage.
FREDDY - Ahl. Would you mind telling me whose brain I put in?
IGOR - And you won't be angry?
FREDDY - I won't be angry.
IGOR - Abbey someone.
FREDDY - Abbey?? Abbey who?
IGOR - Abbey normal.
FREDDY - ABBEYNORMAL???
IGOR - I'm almost sure that was the name.
FREDDY grabbing Igor's throat
I put -- an abnormal brain -- into a seven-and-a-half
foot long, fourty-four inch wide GORILLA?
next prev parent reply other threads:[~2023-08-24 21:45 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-22 22:04 bug#65459: completing-read INITIAL-VALUE unaware of COLLECTION and REQUIRE-MATCH Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-23 11:29 ` Eli Zaretskii
2023-08-23 11:57 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-23 13:07 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-23 15:29 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-23 16:05 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-23 16:39 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-23 16:58 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-23 18:12 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-23 21:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-23 22:44 ` Drew Adams
2023-08-23 23:06 ` Gregory Heytings
2023-08-24 2:30 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-24 12:30 ` Gregory Heytings
2023-08-24 13:19 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-25 6:59 ` Juri Linkov
2023-08-24 13:46 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-26 8:06 ` Gregory Heytings
2023-08-31 9:42 ` Eli Zaretskii
2023-09-04 21:35 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-04 22:16 ` Stefan Kangas
2023-09-05 11:05 ` Eli Zaretskii
2023-09-05 12:59 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-05 13:14 ` Eli Zaretskii
2023-08-24 9:02 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-24 13:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-24 14:51 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-24 16:45 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-24 18:50 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-24 19:35 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-24 20:22 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-24 21:02 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-24 21:45 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-08-26 8:10 ` Gregory Heytings
2023-08-26 14:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27 6:45 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27 14:40 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27 16:21 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27 16:26 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27 16:35 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27 18:01 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27 21:11 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27 21:48 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27 22:59 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-28 3:12 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-28 9:14 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-28 12:44 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-28 12:50 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-28 13:04 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-28 13:13 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27 16:42 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27 18:02 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27 20:54 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27 21:26 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
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='NH7WSL98VuVhT01YPvHBmORrvkYUh8gwdMSlJJyYlMJLr_pCtePAocmflbebgW7XmRPiYigDGFlRqd34EbxcvuvRMBehnW1JWm_V6DX3zq8=@protonmail.com' \
--to=bug-gnu-emacs@gnu.org \
--cc=65459@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=heimeborgia@protonmail.com \
--cc=monnier@iro.umontreal.ca \
/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).