From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22661 invoked by alias); 9 Jun 2016 20:46:34 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21637 Received: (qmail 14642 invoked from network); 9 Jun 2016 20:46:32 -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=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:in-reply-to :comments:in-reply-to:comments:to:subject:mime-version; bh=aLpcvNnYb+mrfZ8vSbTOf541r0iP5vwfAf8H8s5559A=; b=t0JDksUChEjrGFZX7gWijIyTKY3OJ9wRdZMjAneOW0ZI0nbg6pFu6XTXT/xW+ACA6z jqcxT0JXOFzpec4mKNH2hdV8zVXC56Btb+Ox9airqDUzi/0NuAN9+YO4dorbgG9b8QiH uG+XCbA8Ox1w1j/M5LecJo6rQGuS9GhhB/vIyTZ7nhZkOoLARc3gCZQtEKrnbHttks60 Iq4PRnYtamQEyvX6z0ujq0rkbGi1gVxy8thj4+w4cumbAZ3o2hR9W1EaE3NL4SiOEtje KwlFL8/ygtSG96VklfImyBEocNst8nZ2ytRSAaQtONwFcAxxM2rSva2ObiKulJ8vAnN3 zcgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:in-reply-to:comments:in-reply-to:comments:to:subject :mime-version; bh=aLpcvNnYb+mrfZ8vSbTOf541r0iP5vwfAf8H8s5559A=; b=k2nSNCOMyXcPbCwQZU/yuO/id4RFWjQWeYJkMOLHraZKOFtSxP6N9hMSK6s7J82U7v IQYT+kcKjddC1mmt4Jzb8rhU+W0wZeSWte+92em/JZiMlgvW9sXz5rj41QQPcQKONWtW U4Ozkl2ZrNdIulAOC8j1iIy+FnY0mFqEgBJfk9mjLFw85zpXhKcq+pdAjzP4O0XXx6tf rE6Lg4Flzr3pQTz0hZTLrZAUiiieKPTwF7iNK+FaPbI6gM2nANks9rS4Qh5zZ+gkw9MB aUE79uLPQDdOhqPSSZViFHXvSijeqtZRL7fhVaxSnHMtW3C4G1CwNfYnEbXkpU+USEhx txlw== X-Gm-Message-State: ALyK8tLKkKWsYq81Snruuj0QAdjLJYMGRm50GRrB8E8L1fBRo7+R0+3WFEi2Lqp3+P08Cg== X-Received: by 10.66.249.234 with SMTP id yx10mr14343711pac.29.1465505189848; Thu, 09 Jun 2016 13:46:29 -0700 (PDT) From: Bart Schaefer Message-Id: <160609134641.ZM4758@torch.brasslantern.com> Date: Thu, 9 Jun 2016 13:46:41 -0700 In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Can $_ substitute $0 when nofunctionargzero" (Jun 9, 6:44pm) References: In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Re: Can $_ substitute $0 when nofunctionargzero" (Jun 9, 7:06pm) In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Re: Can $_ substitute $0 when nofunctionargzero" (Jun 9, 8:33pm) X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: Can $_ substitute $0 when nofunctionargzero MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 9, 7:06pm, Sebastian Gniazdowski wrote: } Subject: Re: Can $_ substitute $0 when nofunctionargzero } } documentation says: "The last argument of the previous command. } Also, this parameter is set in the environment of every command } executed to the full pathname of the command." That should probably say "the environment of every external command" because the second part does not apply to builtins and subshells. } Turns out it's the first sentence that happens. Last argument to } `source' is substituted for $_. But in real word, $_ can still be used } when option functionargzero is unset, unless someone will came up with } a standard of how plugins can be parametrized - they're normally } sourced without any additional arguments. } } Any more flaws in this? I had a bit of trouble untangling your "unless" clause there but if I understand you correctly then I don't think you've overlooked any other problems. On Jun 9, 8:33pm, Sebastian Gniazdowski wrote: } Subject: Re: Can $_ substitute $0 when nofunctionargzero } } I read through discussion on ZSH_SCRIPT and ZSH_ARGZERO. Could there } be one more parameter added? At the risk of becoming one of PWS's second category of outraged frothy gibberers, there are already several other ways to obtain this: $(print -P %N), which works for any zsh of the past 16 years ${(%):-%N}, which has worked for the past 13 years ${funcstack[1]} (or $funcstack[0] if ksharrays), somewhat newer (Not all versions that have $funcstack also treat "source" as a stack position, as I recall, though $funcstack has been around a long time.) If the concern (see discussion of add-zsh-hook-widget) is that plugins need to work arcoss a range of versions, then adding another builtin parameter is not going to be very useful.