Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: $_ with anonymous



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)";



Messages sorted by: Reverse Date, Date, Thread, Author