emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] `completing-read`: Add `group-function` support to completio


From: Daniel Mendler
Subject: Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 2)
Date: Sun, 2 May 2021 13:01:37 +0200

On 5/2/21 9:07 AM, Eli Zaretskii wrote:
> We don't provide knobs for every behavior, indeed.  But where the
> "right" behavior is a matter of personal preferences, and there are
> large enough groups of people who may want either of the possible
> behaviors, offering an option is TRT.  Advice is not a valid
> replacement for a user option, because writing an advice is orders of
> magnitude harder than flipping an option, and requires the user to be
> proficient in ELisp.

I agree generally regarding advices and options. But here the user
already has the option to use the 'horizontal or 'vertical completions
format. My argument is that in case the user prefers to read
horizontally, the horizontal layout can be used and in case the user
prefers to read from top to bottom the vertical layout can be used.

1) horizontal

=group1=
cand1  cand2  cand3
cand4  cand5  cand6
=group2=
cand7  cand8  cand9
cand10 cand11 cand12

2) vertical

=group1=  =group2
cand1     cand7
cand2     cand8
cand3     cand9
cand4     cand10
cand5     cand11
cand6     cand12

3) vertical with horizontal grouping

=group1=
cand1     cand4
cand2     cand5
cand3     cand6
=group2=
cand7     cand11
cand8     cand12
cand9     cand13

For now didn't see the need to add 3), the vertical format plus
horizontal grouping, as proposed by Juri. If most people agree that
option 3) should be provided we can either add this as a separate
formatting function or as an option. It may be easier to implement this
as a fully separate `completion-insert--vertical+horizontal-grouping`
function. If 3) is the preference of most people I guess we should even
make this the default, in order to avoid to unnecessarily add
configuration options which will be used rarely.

I think a wait and see strategy may be better until we got more
experience where the feature will be put to good use. Juri implemented a
patch which adds grouping to the read-char-by-name function. I hope
there will be more use cases.

In my Consult package I have quite a few use cases for the grouping, but
these commands almost always work best with the 'one-column layout due
their rich annotation functions. My preference is also influenced by my
usage of vertical minibuffer completion UIs (Vertico, Selectrum, Ivy).
However in case the annotations are turned off, the vertical and
horizontal layouts should also work well with the commands.

Daniel



reply via email to

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