Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

RE: 3.1.6-dev-18



>
> > Still, how much do you gain by being able to put them in matcher-1 and
> > matcher-2?  Is that more powerful than just using array elements of the
> > style in order, rather than simply more cumbersome?  The only examples I
> > can think of where you gain something are where _matcher is followed the
> > second time by _prefix instead of _complete (or vice versa), or
> where some
> > other element of the context is different between the matcher-1 and
> > matcher-2 cases.  These seem to me to be to abstruse to be
> useful.  But I
> > may well have missed something.
>
> I can only repeat... I would have no problems with turning the matcher
> style as used by _matcher (or even renaming it for clarity) into one
> that is used as an array. The first _matcher would then use the first
> string in the value, the second one the second string and so on. I
> just thought -- and I may very well be wrong here -- that it would
> make users more aware of what they are doing if we use this more
> explicit setting we have now. I.e., even with the suggested
> array-interpretation of the matcher style one would have to add a new
> call to _matcher in the completer list when adding a new string to the
> matcher style.
>

Please, no. It will be worse than it is now.

When I spoke about array, I meant absolutely different thing. Remove
_matcher completer alltogether. Setup a style with match specs, that will be
tried in order. In other words

zstyle :completion::complete::::: match_specs "" spec1 spec2 ...

with semantics

_complete should try this list in order until it gets matches.

I agree, that your way provides more fine grained control ... the question
is, how complex completion system is going to be? Do you think, that an
everage user would ever need such a complexity?

And what occured to me ... why _oldlist, _prefix etc are completers at all?
They look much more like actually a styles to me! They do not generate any
matches - rather, they say completion system _how_ to generate matches. So,
somewhat revolutionary ;-) idea:

leave only _complete
use styles to describe, just how _complete should do completion. Something
like

:completion::complete:::::pass-1 flags normal
:completion::complete:::::pass-2 flags prefix
:completion::complete:::::pass-3 flags match keeplist
:completion::complete:::::pass-4 flags approximate prefix

and additional

:completion::complete:::::pass-1 match_specs "" spec1 spec2

with semantics

first try normal with completion with empty, spec1, spec2. If nothin works,
try prefix; if this fails, try match keeping old list; and if this fails,
try approximate.

/andrej



Messages sorted by: Reverse Date, Date, Thread, Author