From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12414 invoked by alias); 12 Feb 2015 19:41:18 -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: 34519 Received: (qmail 8775 invoked from network); 12 Feb 2015 19:41:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Originating-IP: [86.6.153.127] X-Spam: 0 X-Authority: v=2.1 cv=cpwVkjIi c=1 sm=1 tr=0 a=39NrsSuza2clQiZR/7fYWQ==:117 a=39NrsSuza2clQiZR/7fYWQ==:17 a=kj9zAlcOel0A:10 a=NLZqzBF-AAAA:8 a=Coiok-VDqNOs6et2-rUA:9 a=UN6a9mkXRh_HWFOB:21 a=HwzY-L-uY9nslTLr:21 a=CjuIK1q_8ugA:10 Date: Thu, 12 Feb 2015 19:35:26 +0000 From: Peter Stephenson To: Zsh hackers list Subject: PATCH: $_ with anonymous Message-ID: <20150212193526.65fb73b5@ntlworld.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit This bit looks straightforward if we're not going to be clever (and we're not). As I said, this is entirely separate from the other issues. pws diff --git a/Src/exec.c b/Src/exec.c index 3b0e936..302e2b5 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -4456,7 +4456,7 @@ execfuncdef(Estate state, Eprog redir_prog) if (!names) { /* * Anonymous function, execute immediately. - * Function name is "(anon)", parameter list is empty. + * Function name is "(anon)". */ LinkList args; @@ -4477,6 +4477,9 @@ execfuncdef(Estate state, Eprog redir_prog) } } + setunderscore((args && nonempty(args)) ? + ((char *) getdata(lastnode(args))) : ""); + if (!args) args = newlinklist(); shf->node.nam = "(anon)";