Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:subject:message-id:mail-followup-to:mime-version
         :content-disposition:user-agent;
        bh=EQP/kuU/NwvLeBveOTLBxt1pII/lpE/MD0rHJ0/S2fc=;
        b=EEn/MVxytgNrDGv36z16kM0ck2c5LYFRWu0g8fKr2D59wcd7nYC49pTOYTreEKOJHy
         MBX8p2XjpnsZggYuYFHneQjgQFaEVNPg9dFG3POrwew89r7IKjS7eXIpmQ8sR3uNEk+2
         oz68trosftccPWNkJQLAQ/gFCjv+IsJiOsurJaPF1o6vv4gyzC8/Bjyf3FWccGuGQAkl
         EngjitQwFAnQwo8Xa4k2HMDz5riQ3ygBSh73BydPaLyyN+XaLs1ueb/SkIbpgFFP9ubS
         nJSeLjfuXr2zT3DgZ/kZEpxQHPiWlZNW9aew0QdmC+IGIdG2d5PPO3lxOdKHXzEPMmAA
         LQSg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to
         :mime-version:content-disposition:user-agent;
        bh=EQP/kuU/NwvLeBveOTLBxt1pII/lpE/MD0rHJ0/S2fc=;
        b=KTN96pNtHpfL7k4zGABm+fe3flF65txa+LKP2+nrEhQOeO3oSQG9/6MoRsGQ+U7ve3
         fgxclv1Z1nvjBHA4B/HyTlZ4kv2U1HwPcttw3zm4eXtLM6cCoO4CwwuZFccVAiljysjO
         v1O5zJLILzb2dJtvpl7GfmX0ozSulPO/fWOWW8HS4vxgM6TdBl3lrs/8MXQ0ZRQ+o7Wo
         sN/+/n+9W9dBbF4cgyxYxrnOSyT+p2K5TgUylflJjcQC8z1NqkqAOslasf472yfJG2gV
         JcQqIHyOqs+EmK5aE5neROGa5QlfRFHmUp2uafCzquOpPaC8pN4rGhAK3zk8kxsNLNM3
         FFcw==
X-Gm-Message-State: AOPr4FWOlX6istmklQ5+w3+w8eFVKQGxT6n8tPYbnRoVuVZWwaeGzYKc19cBC8SB+4uzjw==
X-Received: by 10.194.242.65 with SMTP id wo1mr10940934wjc.54.1462539410997;
        Fri, 06 May 2016 05:56:50 -0700 (PDT)
Date: Fri, 6 May 2016 13:56:49 +0100
From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [PATCH] [doc] & not recognized in :s/LHS/&RHS with HIST_SUBST_PATTERN
Message-ID: <20160506125649.GA15015@chaz.gmail.com>
Mail-Followup-To: Zsh hackers list <zsh-workers@zsh.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Seq: zsh-workers 38412

It looks like

${var:s/foo/...&}

(or in glob qualifiers or history expansion)

doesn't work when HIST_SUBST_PATTERN is set.

This patch just makes a note of it in the doc.

One can use ${var:s/(#m)foo/...$MATCH} though.

diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index c6e7b6f..851b837 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -301,25 +301,26 @@ item(tt(x))(
 Like tt(q), but break into words at whitespace.  Does not work with
 parameter expansion.
 )
 enditem()
 
 The tt(s/)var(l)tt(/)var(r)tt(/) substitution works as follows.  By
 default the left-hand side of substitutions are not patterns, but
 character strings.  Any character can be used as the delimiter in place
-of `tt(/)'.  A backslash quotes the delimiter character.  The character
-`tt(&)', in the right-hand-side var(r), is replaced by the text from the
-left-hand-side var(l).  The `tt(&)' can be quoted with a backslash.  A
-null var(l) uses the previous string either from the previous var(l) or
-from the contextual scan string var(s) from `tt(!?)var(s)'.  You can
-omit the rightmost delimiter if a newline immediately follows var(r);
-the rightmost `tt(?)' in a context scan can similarly be omitted.  Note
-the same record of the last var(l) and var(r) is maintained across all
-forms of expansion.
+of `tt(/)'.  A backslash quotes the delimiter character.  Unless the
+tt(HIST_SUBST_PATTERN) option is set, the character `tt(&)', in the
+right-hand-side var(r), is replaced by the text from the left-hand-side
+var(l).  The `tt(&)' can be quoted with a backslash.  A null var(l) uses
+the previous string either from the previous var(l) or from the
+contextual scan string var(s) from `tt(!?)var(s)'.  You can omit the
+rightmost delimiter if a newline immediately follows var(r); the
+rightmost `tt(?)' in a context scan can similarly be omitted.  Note the
+same record of the last var(l) and var(r) is maintained across all forms
+of expansion.
 
 Note that if a `tt(&)' is used within glob qualifiers an extra backslash
 is needed as a tt(&) is a special character in this case.
 
 Also note that the order of expansions affects the interpretation of
 var(l) and var(r).  When used in a history expansion, which occurs before
 any other expansions, var(l) and var(r) are treated as literal strings
 (except as explained for tt(HIST_SUBST_PATTERN) below).  When used in

