help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: can vertico approximate this ido setup?


From: Samuel Wales
Subject: Re: can vertico approximate this ido setup?
Date: Sun, 4 Jun 2023 18:07:26 -0700

On 6/4/23, Tassilo Horn <tsdh@gnu.org> wrote:

hi tasillo,

> Samuel Wales <samologist@gmail.com> writes:
> Define "very wrong", e.g., with a screenshot of what you get and a
> statement what you'd expect to get.

i will have to do that when i am able to.  not able to get my brain to
think about what makes a good test case etc. now.

>
> FWIW, I see that you put the flex and orderless completion style in
> completion-styles.  You have to be aware that at least flex matches very
> distant candidates, e.g., foo matches after-some-root.  Ok, that's the

ok.

my sequening sounds like it could be bad.

to me, above would be more desirable if f were not a single letter.
to match above i might do ftoot not foo or foot.

i think ido-clever-match got that right:
https://github.com/Bogdanp/ido-clever-match .  it is almost perfect.

btw i have trouble understanding the emacs manual on completion.  the
completion styles don't make sense to me whent they talk about text
after point.  idk what i am missing there.  the descriptions are a bit
over my head i guess.

here is a big long quote from ido-clever-match exactly what it does.
i wonder if vertico/orderless can do it similarly?

vvv
The matcher ranks the input against each item by class and
then by some sub-metric within that class if applicable
(length difference between the two strings in the case of
substr, the cumulative distance of consecutive characters
in the case of flex, whether the match was case-sensitive
or not, etc.).

The match classes are:

exact
    Exact matches score the highest and they require an
    exact string match.
prefix
    Prefix matches score second highest. They are treated
    as a special case of substring matches and will always
    rank higher. This class differentiates between
    sub-matches by comparing the length of the input and
    each match: the closer the two numbers are, the higher
    the score will be.
substring
    Substring matches score third highest. This class
    differentiates between sub-matches in the same way that
    prefix matches do with an additional check on the
    distance between the beginning of the string and the
    first occurrence of the text within that string: the
    further away the substring is from the beginning of the
    string, the lower it will score.
flex
    Flex matches score lowest. This class differentiates
    between sub-matches by computing the cumulative
    distance of consecutive characters: the higher that
    distance is, the lower the score.
^^^

> purpose of the style but I think it's only useful if you place it at the
> very end of completion-styles with more exact styles at the beginning,
> e.g. (partial-completion substring flex).

ok.  even after orderless?

>
> Orderless can also be slightly confusing because fo-ba matches bar-foo.
> Again, that's the purpose of the style but maybe it's also better used
> later in completion-styles, e.g., it's much more exact than flex but
> less so than partial-completion or substring.

i presume just before flex.

btw, in ido, i use c-spc to limit the candidates then enter the second
string when i need bar-foo.

>
> Also, I have the experience that some completion styles work great for
> one kind/category of completion but not for others, so I use
> completion-category-overrides.
>
> --8<---------------cut here---------------start------------->8---
> (setopt completion-styles '(partial-completion substring flex))

ok so we are out of the territory of cl-pushnew or add-to-list i think
now and i have to do my own setopt.  like setq?

>
> (setopt completion-category-overrides
>         '((project-file
>            (styles partial-completion substring initials))

>           (file
>            (styles partial-completion substring initials))

i'd want almple or alcp to match .../alpha-completion.el.  not sure if
this would do it without flex?

unfamiliar with projects and eglot.

>           (eglot
>            (styles partial-completion substring))))
> --8<---------------cut here---------------end--------------->8---
>
>>   - faces don't seem to get recognized when i specify them
>>     - also i don't get variable pitch
>>     - also i don't understand the completion-first-difference face
>
> I go with the defaults (of my theme) so cannot comment on that.  I guess
> that also completion-first-difference is not well-defined with styles
> where matching is not anchored at the beginning of the candidate.  I
> think it's always the character after the last matched character.

ok.  it seems a bit redundant in vertico to me; i can see immediately
that the grey matching text has an end and a first char after that
without this face.  so it must serve a purpose.  but it jumps around.

>
>>   - have not tried consult yet
>>   - embark uses more than window height or confuses
>> [...]
>> i am very limited in computer use, so before i try new things or
>> search, i want to know if it is worth trying to configure vertico to
>> work approximately like my setup.  my question is whether it is
>> configurable to come close-ish to my ido.
>
> I'd rather start out small, i.e., vertico / corfu / marginalia and add
> more stuff (orderless, consult, cape, embark) later on if I feel that
> I'm missing something here and there.  I think ido supports some special

well if i could get it to work, i think i could maybe just use vertico
only to begin with.

> things (creating directories, deleting files during file completion or
> killing buffers during buffer completion?) which you could probably do
> with embark but well...

i don't use those in ido.  embark might have other stuff i'd use.

>
> Bye,
> Tassilo
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



reply via email to

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