From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23873 invoked from network); 18 Jun 2000 05:05:05 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 18 Jun 2000 05:05:05 -0000 Received: (qmail 11236 invoked by alias); 18 Jun 2000 05:04:57 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11964 Received: (qmail 11228 invoked from network); 18 Jun 2000 05:04:55 -0000 From: "Bart Schaefer" Message-Id: <1000618050444.ZM12851@candle.brasslantern.com> Date: Sun, 18 Jun 2000 05:04:44 +0000 In-Reply-To: <1000618044219.ZM12778@candle.brasslantern.com> Comments: In reply to "Bart Schaefer" "Tags vs. groups, and ZLS_COLORS (Re: wish for a colored completion system)" (Jun 18, 4:42am) References: <200006130925.LAA29687@beta.informatik.hu-berlin.de> <1000618044219.ZM12778@candle.brasslantern.com> X-Mailer: Z-Mail (5.0.0 30July97) To: Sven Wischnowsky , zsh-workers@sunsite.auc.dk Subject: Re: Tags vs. groups, and ZLS_COLORS (Re: wish for a colored completion system) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 18, 4:42am, I wrote: } } } The problem is really that the code in _setup can't find out what } } pattern was used when defining the style. } } I don't think that's the problem. Note in the trace above that we end up } with `:(argument-1)...:' in $ZLS_COLORS. That's nonsensical; there's no } group named `argument-1'. The problem is that _setup can't differentiate } between a "real tag" and a group name being used as a tag. The *right* } behavior, I think, is for all "real tag" lookups to use `(-default-)' in } ZLS_COLORS, whereas group names being used as tags use their actual name. } } Can we devise a way to tell _setup whether $1 is a real tag, or a group? (Sound of hand smacking forehead.) If $1 is a real tag, then it'll be the same as the last field of the context, right? E.g. this bit of trace output: +_setup:5:if: zstyle -a :completion::complete:ssh:argument-1:argument-1 list-colors val So what if _setup was to do the following? if zstyle -a ":completion:${curcontext}:$1" list-colors val; then zmodload -i zsh/complist if [[ "$1" = default ]]; then ZLS_COLORS="${(j.:.)${(@)val:gs/:/\\\:}}" elif [[ "$curcontext" = *:"$1" ]]; then eval "ZLS_COLORS=\"(-default-)\${(j.:(-default-).)\${(@)val:gs/:/\\\:}}:\${ZLS_COLORS}\"" else eval "ZLS_COLORS=\"(${1})\${(j.:(${1}).)\${(@)val:gs/:/\\\:}}:\${ZLS_COLORS}\"" fi # ... fi This seems to do exactly the right thing in the few cases I attempted. Of course, it doesn't address the problem with (group-name) in the value of the list-colors style, nor the gname problem in _description ... -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net