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

Re: completion



On 01/08/2015 12:31 AM, Bart Schaefer wrote:
On Jan 7,  3:00pm, Ray Andrews wrote:
}
} To put it in English, what I'm reaching for (I think), sounds something
} like this:
}
} If [something-on-command-line] matches [this-pattern] (a filter), then
} expand that pattern using [this-particular-set-of-rules], and then
} search (go find) in [this-particular-group-of-objects] for
} [this-particular-glob-pattern] and put that on my command line.

Incidentally, no, it's not like that at all.  In fact its so far from
that, that I can't even reword the above to give a better sense of it.
Completion involves several layers of loops-within-loops, it can't be
described in a single if-then sentence.
Well that's hardly a surprise to hear, because the square peg of what
my preconception is/was definitely does not go through the round hole
of what happens.  You know, I was going to give completion a rest and
try again in a year, but since Vincent brought the subject up again, and
there's new food to digest, I'd better reread the docs again in the light
of this new explanation and maybe I will get it. At the moment, my mind
just melts down at the 'asterisk' part, I just can't grok ambiguously
omitted field separators, it ain't humanly decent.

If you ignore a lot of the looping parts and the listing of ambiguous
matches, then it's sort of like:

Choose a completer and pass it some information about the command line,
from which it will construct a context which summarizes the meaning of
the command line in about six words.  For each/any configuration option
that may be useful, use the context to find the best definition among
the set of zstyle patterns the user has defined.  Some of those options
(called styles) should explain where to look for [this-particular-group-
of-strings], otherwise use a fallback to find them.  Compare whatever
strings you end up with to the word to the left of or under the cursor
and put the longest unambiguous common substring that matches on the
command line, assuming the other styles said that's what you should do.
If there aren't any matches at all, try again with the next completer
until something is found or there are no more completers.
I'm lost after 'choose a completer' ;-) ... what does that mean? I expect
that zsh *provides* me with the completer ....

Nevermind! I've got to reread.  For now, I'm interested to see how you
respond to Vincent, he already mostly understands this.  I don't
understand enough to be even worth talking to.





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