From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25393 invoked from network); 31 Aug 1999 12:01:15 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 31 Aug 1999 12:01:15 -0000 Received: (qmail 26491 invoked by alias); 31 Aug 1999 12:01:09 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7574 Received: (qmail 26482 invoked from network); 31 Aug 1999 12:01:07 -0000 Date: Tue, 31 Aug 1999 13:45:59 +0200 (MET DST) Message-Id: <199908311145.NAA29781@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Zefram's message of Tue, 31 Aug 1999 10:29:13 +0100 (BST) Subject: Re: PATCH: new parameter flag? Zefram wrote: > Actually I think it'll do full prompt expansion, affected by the options > PROMPT_EXPAND, PROMPT_BANG and PROMPT_PERCENT. It would be nice to > have another flag to do just % sequences, i.e., do prompt expansion with > options NO_PROMPT_EXPAND, NO_PROMPT_BANG and PROMPT_PERCENT temporarily > set. Say, (%) for just % sequences, and (%%) for full prompt expansion. Sounds good. (I'd still like to have a non-forking version of `$(...)' -- `${{...}}' doesn't seem to do anything useful at the moment, searching for a parameter named `{...}' with braces tokenized.) Bye Sven --- os/subst.c Tue Aug 31 13:25:35 1999 +++ Src/subst.c Tue Aug 31 13:34:04 1999 @@ -938,7 +938,7 @@ break; case '%': - presc = 1; + presc++; break; default: @@ -1659,8 +1659,12 @@ } } if (presc) { - int len; + int ops = opts[PROMPTSUBST], opb = opts[PROMPTBANG]; + int opp = opts[PROMPTPERCENT], len; + opts[PROMPTPERCENT] = 1; + if (presc < 2) + opts[PROMPTSUBST] = opts[PROMPTBANG] = 0; if (isarr) { char **ap; @@ -1679,6 +1683,9 @@ val = unmetafy(promptexpand(metafy(val, len, META_NOALLOC), 0, NULL, NULL), &len); } + opts[PROMPTSUBST] = ops; + opts[PROMPTBANG] = opb; + opts[PROMPTPERCENT] = opp; } if (quotemod) { if (isarr) { diff -u od/Zsh/expn.yo Doc/Zsh/expn.yo --- od/Zsh/expn.yo Tue Aug 31 13:25:48 1999 +++ Doc/Zsh/expn.yo Tue Aug 31 13:42:33 1999 @@ -604,7 +604,10 @@ ) item(tt(%))( Expand all tt(%) escapes in the resulting words in the same way as in -prompts (see noderef(Prompt Expansion)). +prompts (see noderef(Prompt Expansion)). If this flag is given twice, +full prompt expansion is done on the resulting words, depending on the +setting of the tt(PROMPT_SUBST) and tt(PROMPT_BANG) options. The +tt(PROMPT_PERCENT) option is temporarily turned on in any case. ) item(tt(X))( With this flag parsing errors occuring with the tt(Q) flag or the -- Sven Wischnowsky wischnow@informatik.hu-berlin.de