Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: _values and specifying -M to compadd
- X-seq: zsh-users 11875
- From: Danek Duvall <duvall@xxxxxxxxxxxxxx>
- To: Peter Stephenson <pws@xxxxxxx>
- Subject: Re: _values and specifying -M to compadd
- Date: Mon, 24 Sep 2007 08:36:40 -0700
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <200709240924.l8O9OPNP005103@xxxxxxxxxxxxxx>
- Mail-followup-to: Danek Duvall <duvall@xxxxxxxxxxxxxx>, Peter Stephenson <pws@xxxxxxx>, zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20070924050450.GA32335@xxxxxxxxxxxxxxxxxxxxx> <200709240924.l8O9OPNP005103@xxxxxxxxxxxxxx>
On Mon, Sep 24, 2007 at 10:24:25AM +0100, Peter Stephenson wrote:
> _values is designed to be smart about the values of key/value pairs,
> whereas you need something to be smart about the keys. (_values is
> also a bit of a mess because the internals are delegated to a builtin
> "compvalues" which is only documented in the C source.)
Yeah, that stymied me. :) I wasn't all that intent into diving into the C
source. Though if it's well commented, I might take a look anyway.
> Actually, using compadd directly isn't that hairy here. I got this to work:
Wonderful. I was missing the compset bits, and while I might have
eventually stumbled on the first, I probably wouldn't have gotten the
second.
The only thing remaining is to remove already-completed tokens, which I'm
doing with a simple loop over IPREFIX:
for t in ${(s:,:)${IPREFIX//\\#\!/}}; do
tokens=( ${tokens:#$t} )
done
before passing tokens on to compadd. It looked like there wasn't any
special magic in _values that did this, but it's sufficiently poorly
commented that I wasn't sure exactly where this was happening.
You can't think of a fruit starting with "e" either, eh? :)
Thanks!
Danek
Messages sorted by:
Reverse Date,
Date,
Thread,
Author