From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17629 invoked by alias); 12 May 2011 10:40:50 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29238 Received: (qmail 4187 invoked from network); 12 May 2011 10:40:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.220.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=qzWRl5Vy9r/1GR/zf0i4Y4b4a9HEfvA0aclPUwqFcv8=; b=T+dUYMcTujC+9Smq+pAXzvwEePU8tzQKZ8hFKjKnQzI45PSVMUIFku7nKwRC1d2xT+ 1ZoyvxixgkDdV2B+/u5JHi08A8iB7MGqlLFZaMFw3CA1MHuXxTEBGImRbMNt/AQ1A7A6 fhW3F+0NZ8nPlP2O54eNhQfHvNvivdNMgmMOQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=FeFn1T/L3Fh08+ZiErn/9l8hX4r9t5pr+xNL0KKZLeUqsE1QjH/6r3EhZD0q4eg0Gf oiVT7Aqai/JSQu87TZaTYWCm6+LOrwfO5ufWWtLlDKpbRAE1enhbzhB0XisEmSHAKXBF bWuA84eP6LESuVQp3n4w67rPx/JNYfeMnyKmg= MIME-Version: 1.0 In-Reply-To: <110512031050.ZM25147@torch.brasslantern.com> References: <1305118971-25617-1-git-send-email-mikachu@gmail.com> <20110511172114.56080d04@pwslap01u.europe.root.pri> <20110511180748.18f4e67e@pwslap01u.europe.root.pri> <20110511182657.2d1d99ae@pwslap01u.europe.root.pri> <110512031050.ZM25147@torch.brasslantern.com> Date: Thu, 12 May 2011 12:40:35 +0200 Message-ID: Subject: Re: PATCH: expanding parameters like echo/print builtins From: Mikael Magnusson To: Bart Schaefer Cc: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 12 May 2011 12:10, Bart Schaefer wrote: > On May 11, 7:43pm, Mikael Magnusson wrote: > } Subject: Re: PATCH: expanding parameters like echo/print builtins > } > } What I meant was that the relation between V and g:: isn't documented, > } but yeah, I did miss the whole list :). Here's a patch, minus the > } renumbering of subsequent items. > > Renumbering the subsequent items is a nasty bit to leave out, because > there are cross-references among the items that always get forgotten; > I just fixed all of those up a few months ago. > > It might be better just to add this to item 12 rather than introduce > a new number. Ah, good point. > } Any better names than echo-type expansion? :) > > Elsewhere these kinds of things are referred to as "escape sequences" > but then so are %-dohickeys for prompts. Probably would have been > a good idea years ago to refer to the % forms as "expandos" or some > such word ... > > But, given that they're all escapes, we could go with > > item(tt(12.) em(Escape sequence replacement))( > First any prompt-style formatting from the tt((%)) family of flags is > applied, then any replacements from the tt((g)) flag are performed. > ) > > The (g) stuff usually involves making the string *shorter* so to call > it an "expansion" is a bit odd. Also a good point, I can change it to "process escape sequences like the echo builtin" also in the description of the g:: flag, that's what the print description calls it. > [Is there a potential conflict where > (%) inserts something that (g) then incorrectly replaces, if you use > both of them togher?] Well, if (%) inserts something before (g) processes it, (g) will replace it, but what would make it incorrect? /tmp/\u3042% echo -E ${(g::%):-%~} /tmp/=E3=81=82 It is of course possible to move (g) somewhere else in the sequence if wanted, I just figured it was closest logically to (%) and put it there. (But if you don't like the order, all you have to do is /tmp/\u3042% echo -E ${(%)${(g::):-%~}} /tmp/\u3042 ) --=20 Mikael Magnusson