From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-workers@zsh.org
Subject: Re: PATCH: expanding parameters like echo/print builtins
Date: Thu, 12 May 2011 12:40:35 +0200 [thread overview]
Message-ID: <BANLkTin7H+ZDRug_MxZrLD_9uVcxbE+JnA@mail.gmail.com> (raw)
In-Reply-To: <110512031050.ZM25147@torch.brasslantern.com>
On 12 May 2011 12:10, Bart Schaefer <schaefer@brasslantern.com> 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/あ
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
)
--
Mikael Magnusson
next prev parent reply other threads:[~2011-05-12 10:40 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-11 13:02 Mikael Magnusson
2011-05-11 15:03 ` Bart Schaefer
2011-05-11 15:14 ` Mikael Magnusson
2011-05-11 16:03 ` Bart Schaefer
2011-05-11 16:22 ` Mikael Magnusson
2011-05-11 16:48 ` Bart Schaefer
2011-05-11 17:11 ` Mikael Magnusson
2011-05-11 15:47 ` Oliver Kiddle
2011-05-11 16:21 ` Peter Stephenson
2011-05-11 16:38 ` Mikael Magnusson
2011-05-11 17:07 ` Peter Stephenson
2011-05-11 17:19 ` Mikael Magnusson
2011-05-11 17:26 ` Peter Stephenson
2011-05-11 17:35 ` Mikael Magnusson
2011-05-11 17:43 ` Mikael Magnusson
2011-05-12 10:10 ` Bart Schaefer
2011-05-12 10:40 ` Mikael Magnusson [this message]
2011-05-12 14:04 ` Bart Schaefer
2011-05-12 15:49 ` PATCH: Add g:: parameter expansion flag Mikael Magnusson
2011-05-12 19:41 ` Mikael Magnusson
2011-05-13 8:54 ` Peter Stephenson
2011-05-13 9:51 ` Mikael Magnusson
2011-05-13 11:54 ` Peter Stephenson
2011-05-13 12:38 ` Mikael Magnusson
2011-05-14 11:41 PATCH: expanding parameters like echo/print builtins Jilles Tjoelker
2011-05-14 18:41 ` Bart Schaefer
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=BANLkTin7H+ZDRug_MxZrLD_9uVcxbE+JnA@mail.gmail.com \
--to=mikachu@gmail.com \
--cc=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/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).