From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Can $_ substitute $0 when nofunctionargzero
Date: Fri, 10 Jun 2016 08:12:39 +0200 [thread overview]
Message-ID: <CAKc7PVC=Sus9AyyjcrkO9E6AiuCGr3mW+ZtCcKQMeES87pqDyQ@mail.gmail.com> (raw)
In-Reply-To: <160609134641.ZM4758@torch.brasslantern.com>
On 9 June 2016 at 22:46, Bart Schaefer <schaefer@brasslantern.com> 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="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=red start_in_incremental_search
when sourcing some plugin – 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=${(%):-%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 <schaefer@brasslantern.com> 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.
next prev parent reply other threads:[~2016-06-10 6:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-09 16:44 Sebastian Gniazdowski
2016-06-09 17:06 ` Sebastian Gniazdowski
2016-06-09 18:33 ` Sebastian Gniazdowski
2016-06-09 20:46 ` Bart Schaefer
2016-06-10 6:12 ` Sebastian Gniazdowski [this message]
2016-06-15 16:58 ` Sebastian Gniazdowski
2016-06-15 17:40 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKc7PVC=Sus9AyyjcrkO9E6AiuCGr3mW+ZtCcKQMeES87pqDyQ@mail.gmail.com' \
--to=sgniazdowski@gmail.com \
--cc=schaefer@brasslantern.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).