From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21717 invoked from network); 17 Aug 2004 00:54:35 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 17 Aug 2004 00:54:35 -0000 Received: (qmail 12795 invoked from network); 17 Aug 2004 00:54:29 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Aug 2004 00:54:29 -0000 Received: (qmail 3131 invoked by alias); 17 Aug 2004 00:53:46 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7869 Received: (qmail 3121 invoked from network); 17 Aug 2004 00:53:45 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 17 Aug 2004 00:53:45 -0000 Received: (qmail 11501 invoked from network); 17 Aug 2004 00:52:09 -0000 Received: from emfe1.cc.iup.edu (HELO emfe1.iup.edu) (144.80.130.10) by a.mx.sunsite.dk with SMTP; 17 Aug 2004 00:52:07 -0000 X-IUP-Tag1: emfe1.cc.iup.edu X-ExtScanner: Niversoft's Find_Attachments Received: from [24.54.185.148] (account bclg@iup.edu HELO quaternion) by emfe1.iup.edu (CommuniGate Pro SMTP 4.1.8) with ESMTP id 23465907; Mon, 16 Aug 2004 20:52:05 -0400 Received: from jason by quaternion with local (Exim 3.36 #1 (Debian)) id 1BwsCr-0000mL-00; Mon, 16 Aug 2004 20:52:05 -0400 Date: Mon, 16 Aug 2004 20:52:05 -0400 To: zsh-users@sunsite.dk Subject: Re: In the tla completion function: "${(@P)var_cmd-*:FILE:_files}" Message-ID: <20040817005205.GB2869@iup.edu> References: <20040816213204.GA6795@s> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040816213204.GA6795@s> User-Agent: Mutt/1.5.4i From: Jason McCarty X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.1 required=6.0 tests=BAYES_01,RCVD_IN_RFCI, RCVD_IN_SORBS autolearn=no version=2.63 X-Spam-Hits: 0.1 Haakon Riiser wrote: > I was just browsing through the new completion function for tla > in zsh 4.2.1, and I was wondering about the expression shown in > the subject: > > "${(@P)var_cmd-*:FILE:_files}" > > >From what I've read in the manual, I'd guess that the @ flag is > a harmless bug that has no effect since $var_cmd is not an array, > and that the P flag makes the expression expand to the expansion of > the variable name contained in $var_cmd, if $var_cmd is defined; First the value of $var_cmd is substituted by "P", and then the value of the resulting variable (which is an array) is prevented from being joined by "@". See rules 3 and 4 in the "Parameter Expansion" section of zshexpn(1). > if $var_cmd is not defined, I'd expect the expansion to give the > string after the '-': $var_cmd is always defined to something of the form "cmd_*" on line 658. I believe the P flag is evaluated before the - expansion, although I don't see an explicit mention of it in the manpage. The variable named by $var_cmd may or may not be defined, which is where the - expansion comes into play. I'm afraid I came up with many of my fancy substitutions by trial and error ;-) > Is this a bug in the completion file that has gone unnoticed > because var_cmd has always been defined? So no, I don't believe so. HTH, -- Jason McCarty