From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24204 invoked by alias); 10 Mar 2017 09:01:51 -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: 40816 Received: (qmail 23560 invoked from network); 10 Mar 2017 09:01:51 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.25):SA:0(-0.7/5.0):. Processed in 1.418235 secs); 10 Mar 2017 09:01:51 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=pum dd6ZJMJHe25t8u8B/tFWjOvY=; b=KLRssv7rnaKTmJ0M/iQwoZnkF2qmyGoC/ys OnSE5U1EIbPzK66E0kV8JHjlxKfOacKG8npT0bf4lfCCQFmA31qpMXc9WcUMzu0e NLvuzAO0IGr0b4WlJ51lDlXh7w/aZERKSG6zAYMP3IZF9y/w94Nc0Fhk1kChso73 M6y1aMuM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=pu mdd6ZJMJHe25t8u8B/tFWjOvY=; b=Qa2Q/iTvRWOaVbFyIKY/8qYFe+lqXdojMa sF55hAJ23QpqcCUsvVT0J96sB7yx7vTo14fhJ92ercS0mCqHKcd471KsfKk9A9zt /IvoEh4qJCVgOR3/GLwrSwj0EqhteI1nGpzk6S8/C/lYISDPKFOHEbA7vBvQ8MlV KEjExdMjY= X-ME-Sender: X-Sasl-enc: 0uYs9va9kYHbqniO/NFThMr8ACBE2v2OgVPJTHPUdhq/ 1489136503 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH] Document interaction of 'print -P' and 'print -f'. Date: Fri, 10 Mar 2017 08:56:52 +0000 Message-Id: <1489136212-32247-1-git-send-email-danielsh@fujitsu.shahaf.local2> X-Mailer: git-send-email 2.1.4 --- Doc/Zsh/builtins.yo | 3 +++ Test/D01prompt.ztst | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 37e3865..81c201f 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -1252,6 +1252,9 @@ Perform prompt expansion (see ifzman(EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc))\ ifnzman(noderef(Prompt Expansion))\ ). +In combination with `tt(-f)', +prompt escape sequences are parsed only within interpolated arguments, +not within the format string. ) item(tt(-r))( Ignore the escape conventions of tt(echo). diff --git a/Test/D01prompt.ztst b/Test/D01prompt.ztst index 607ffb6..0818728 100644 --- a/Test/D01prompt.ztst +++ b/Test/D01prompt.ztst @@ -82,9 +82,12 @@ # We could test for that, but we can't be bothered. # I hope LC_ALL is enough to make the format what's expected. +# The $date2 assignment tests that %s is interpreted as a printf format +# string, rather than as a prompt escape (end standout). + LC_ALL=C date1=$(print -P %w) - date2=$(print -P %W) + date2=$(print -P -f %s %W) date3=$(print -P %D) if [[ $date1 != [A-Z][a-z][a-z][[:blank:]]##[0-9]## ]]; then print "Date \`$date1' is not in the form \`Day DD' (e.g. \`Mon 1'" @@ -201,3 +204,8 @@ ?+zsh_directory_name:14> return 0 ?+fn:7> local d='~[:l]' ?+fn:8> print '~[:l]' + +# Test that format strings are not subject to prompt expansion + print -P -f '%%Sfoo%%s\n' bar +0:print -P -f +>%Sfoo%s