From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1490 invoked by alias); 10 Jun 2016 06:13:04 -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: 21638 Received: (qmail 1624 invoked from network); 10 Jun 2016 06:13:03 -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,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=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=aLdd5H9xyIv0AgUlI4Pd0JwPYqDcg4z+/pJ0Q5YguLk=; b=qZR/hgp7Z3WjZtuq3QHv2Q/iK6QZ21G1KKSOAvk5BE61qHmKT2NN6vSpgji3//t7aS UXaBfh7Jzcz6AA4HbhDlGEJGlTYD3jzbKyaJroClXfCrvJQa9iiM7BH3nRtBRvdxum0i vqXrSFA1BFuVo5Z8r/PxoyGKeLvHOKJbozQS/nNgigMcoZc88TGZXwwJiHPqXgYDuWK5 WlfFGUHAYl0MQ+YRyO2Q90AidRD8dEmu2hcigxqbS7AT/SJuMMV9blbpAvWwKDMkbbXx osJ1Yjrq6rROg9rhAMzSnU9vQ82h1Y0GuqvpFf8Jhbhxr1b+Y5p6LO1f4y08Fdmgn0uF B73A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=aLdd5H9xyIv0AgUlI4Pd0JwPYqDcg4z+/pJ0Q5YguLk=; b=QPUOcYylAY63ET5hylNBywZF+yCMvawl9OXmBGEH3p3b85p4wD8xEbC4AUCzsqfBgh uZTrQDfzKENZfES9apwunfb66dVP+7TQsjeWOFU+zwb72n0JqP6Afdym4JhVNMMlsDfk IOu0YXR2gXT6MjUK4YHeqQe4JWbRkTAV4wLgM2e0e7irlNXJzrXaLNUuDNlhHX1IThQp 7wO61DLXfRSxrFBui6GPRxoQ39eubfR+hTf89CyUpLX684Pu0jcIeIjzm6sP2XfZz+Gx POYewrhLpjvw/+Ee4SU8SdoL9clbkuSFvfE7wkXt+Aa/UQO38RGZMf0n1p493WA075ly X1Vw== X-Gm-Message-State: ALyK8tLztC+dP4y1EBzNwgBblPPE1zLFS4EqnZlSvE/rpbdoA0Rlkror3waJvf9j1WidBDZtCaA/DWxspD5Gng== X-Received: by 10.55.99.216 with SMTP id x207mr207695qkb.163.1465539179159; Thu, 09 Jun 2016 23:12:59 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <160609134641.ZM4758@torch.brasslantern.com> References: <160609134641.ZM4758@torch.brasslantern.com> From: Sebastian Gniazdowski Date: Fri, 10 Jun 2016 08:12:39 +0200 Message-ID: Subject: Re: Can $_ substitute $0 when nofunctionargzero To: Bart Schaefer Cc: Zsh Users Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 9 June 2016 at 22:46, Bart Schaefer wrote: > That should probably say "the environment of every external command" > because the second part does not apply to builtins and subshells. It is little hard to understand. For example something works in following: local var=3D"I am $_" > I am local Wonder if some nice trickery can be done with $_, maybe in patterns > 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. I thought about e.g.: source "/path/plugin" color=3Dred start_in_incremental_search when sourcing some plugin =E2=80=93 that what I meant by "parametrizing". > 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 That's just great, thanks! I already added "0=3D${(%):-%N}" to my plugins. Should have just asked earlier. > 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. Yeah I thought about future being sure there's no current remedy for nofunctionargzero. Best regards, Sebastian Gniazdowski On 9 June 2016 at 22:46, Bart Schaefer wrote: > 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.