From: Jason McCarty <bclg@iup.edu>
To: zsh-users@sunsite.dk
Subject: Re: In the tla completion function: "${(@P)var_cmd-*:FILE:_files}"
Date: Mon, 16 Aug 2004 20:52:05 -0400 [thread overview]
Message-ID: <20040817005205.GB2869@iup.edu> (raw)
In-Reply-To: <20040816213204.GA6795@s>
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 <bclg@iup.edu>
next prev parent reply other threads:[~2004-08-17 0:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-16 21:32 Haakon Riiser
2004-08-17 0:52 ` Jason McCarty [this message]
2004-08-20 8:55 ` Haakon Riiser
2004-08-20 16:05 ` Bart Schaefer
2004-08-20 16:40 ` Haakon Riiser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040817005205.GB2869@iup.edu \
--to=bclg@iup.edu \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).