From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3449 invoked from network); 16 Feb 2000 11:52:24 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 16 Feb 2000 11:52:24 -0000 Received: (qmail 7687 invoked by alias); 16 Feb 2000 11:52:13 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9762 Received: (qmail 7678 invoked from network); 16 Feb 2000 11:52:11 -0000 From: "Bart Schaefer" Message-Id: <1000216115206.ZM26052@candle.brasslantern.com> Date: Wed, 16 Feb 2000 11:52:06 +0000 In-Reply-To: <38AA7E36.135EBD1E@u.genie.co.uk> Comments: In reply to Oliver Kiddle "Re: help with _match, globcomplete etc. (with a PATCH)" (Feb 16, 10:38am) References: <200002151608.RAA14415@beta.informatik.hu-berlin.de> <38A9AECE.5B213E7@u.genie.co.uk> <1000216064743.ZM18361@candle.brasslantern.com> <38AA7E36.135EBD1E@u.genie.co.uk> X-Mailer: Z-Mail (5.0.0 30July97) To: Zsh workers Subject: Re: help with _match, globcomplete etc. (with a PATCH) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Feb 16, 10:38am, Oliver Kiddle wrote: } Subject: Re: help with _match, globcomplete etc. (with a PATCH) } } The reason I wanted this is basically that I use a number of associative } arrays to point to different areas of the system I work on. [...] } } [...] This leads me to make a suggestion which may or may not be easy } but would solve my problems: in the same way as a variable whose } value is a directory can be refered to with ~, could the same be made } to work for associative arrays (and arrays in general I suppose), } allowing me to use stuff like ~code[ai] and ~test[$area]? Hrm. You can already manually stuff things into the nameddir hash: zagzig% unsetopt glob zagzig% typeset -A xx zagzig% xx=($(print -l $path | cat -n)) zagzig% echo $xx[9] /usr/etc zagzig% for x in ${(k)xx}; hash -d xx[$x]=$xx[$x] zagzig% cd ~xx[9] zagzig% cd ~xx[9]/ Well, would you look at that. But if there I press return, I get: cd: no such file or directory: ~xx[9] That's because the [ and ] are tokenized most of the time, so they don't match what has been added to the hash even if the typtab is modified to treat them as IUSER. It's probably an accident that the trailing slash gets added that first time; you can't complete any further after it. So it may be possible to make this work by using a more sophisticated parse than simply scanning past all the IUSER characters, and then throwing in a few calls to untokenize(); but I don't think I'm going to attempt it. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com