zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Roland Eggner <edvz2@systemanalysen.net>,
	zsh workers <zsh-workers@zsh.org>
Subject: Re: Parameter + prompt expansion %D{%T.%.} parser issue
Date: Tue, 19 Jul 2016 02:21:39 +0200	[thread overview]
Message-ID: <CAHYJk3QPHyH30z+iZ8=o9WPviA4F_=sFMFwEeVdBq65GkWEddw@mail.gmail.com> (raw)
In-Reply-To: <20160718203149.GA11086@mobil.systemanalysen.net>

On Mon, Jul 18, 2016 at 10:31 PM, Roland Eggner
<edvz2@systemanalysen.net> wrote:
> emulate -R zsh -c 'print -l ${(%):-%D{%T.%.} %~} "${(%):-%D{%T.%.} %~}" ${(%):-"%D{%T.%.} %~"}'
>
> Expected:
> 22:03:02.324 ~
> 22:03:02.324 ~
> 22:03:02.324 ~
>
> Observed:
> 22:03:02.324 ~
> 22:03:02.324 %~}
> 22:03:02.324 ~
>
>
> Note the trailing “%~}” in the 2nd line.
>
> ZSH_PATCHLEVEL=zsh-5.2-282-ga22f4ea
> uname -m -o
> x86_64 GNU/Linux
>
> Usage error?  Bug?  Feature?

Usage error, but it's kind of hard to understand what's going on there
admittedly. When ${} is unquoted, then the parser "knows" which {}
belong together, but when you have them under double quotes the {} for
the %D are not special in any way, so the terminating } for %D matches
the ${ as well. You need "${(%):-%D{%T.%.\} %~}" (It would also be a
good idea to use -r for print when testing quoting things although in
this case it makes no difference.)

The same thing happens when you use %F{} etc.

-- 
Mikael Magnusson


  reply	other threads:[~2016-07-19  0:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-18 20:31 Roland Eggner
2016-07-19  0:21 ` Mikael Magnusson [this message]
2016-07-19  3:48   ` 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='CAHYJk3QPHyH30z+iZ8=o9WPviA4F_=sFMFwEeVdBq65GkWEddw@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=edvz2@systemanalysen.net \
    --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).