From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Bug (?) with ${(M)NAME:+WORD} and ${(P)NAME}
Date: Tue, 24 Jan 2023 10:41:26 +0100 [thread overview]
Message-ID: <CAHYJk3SRyMt8seTnuzjn4d9i2ebOuMO7OYXDJfC7LXM0pQo9uw@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7bPY30U5Gjmk8_GjPBSkABA9OStAebWorP2y-rXPb0oBQ@mail.gmail.com>
On 1/23/23, Bart Schaefer <schaefer@brasslantern.com> wrote:
> This works:
>
> () {
> local foo
> () {
> print ${(Mt)foo:#*local*}
> print ${${(Mt)foo:#*local*}:+LOCAL}
> }
> }
>
> This does not:
>
> () {
> local foo
> () {
> print ${(MtP)1:#*local*}
> print ${${(MtP)1:#*local*}:+LOCAL}
> } foo
> }
>
> No alternate nesting of (M) and (P) gives the expected result from :+
>
> The (t) there is not the issue, the same thing happens with:
>
> () {
> local foo=xx-local-xx
> () {
> print ${(MP)1:#*local*}
> print ${${(MP)1:#*local*}:+LOCAL}
> } foo
> }
>
> Am I missing something?
print ${${(Mt)${(P)1}:#*local*}:+LOCAL}
? It's weird that the case without :+ doesn't need the wrapping though...
--
Mikael Magnusson
prev parent reply other threads:[~2023-01-24 9:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-23 20:45 Bart Schaefer
2023-01-24 9:41 ` Mikael Magnusson [this message]
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=CAHYJk3SRyMt8seTnuzjn4d9i2ebOuMO7OYXDJfC7LXM0pQo9uw@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).