zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: What's the opposite of ZSH_ARGZERO?
Date: Wed, 6 Mar 2024 21:16:27 -0800	[thread overview]
Message-ID: <CAH+w=7YedsQCk56Bvygc_NvsByDJf_MWK57XZYEoO4Xtx1eXww@mail.gmail.com> (raw)
In-Reply-To: <CAMP44s3JuCYoNYQEgVUMwPLwGb7AJSzFF=KLe00v0g_q0z1Kaw@mail.gmail.com>

On Wed, Mar 6, 2024 at 1:57 PM Felipe Contreras
<felipe.contreras@gmail.com> wrote:
>
> But what if someone wants to do the opposite? Use the zsh $0 even if
> POSIX_ARGZERO is on?

Of course the zsh $0 depends on the setting of FUNCTION_ARGZERO, but I
know what you mean.

> So far I've found that ${(%):-%N} is the best option, but I wonder if
> there is a better one.

$funcstack[1] would be the other option, unless for some odd reason
the zsh/parameter module is not available.

An advantage of $funcstack is that you can use
${${(@)funcstack:#'(anon)'}[1]} to get the name of the nearest
non-anonymous function.


  reply	other threads:[~2024-03-07  5:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06 21:56 Felipe Contreras
2024-03-07  5:16 ` Bart Schaefer [this message]
2024-03-15 16:28   ` What's the equivalent of ${BASH_SOURCE[0]}? Felipe Contreras
2024-03-16  5:07     ` Bart Schaefer
2024-03-16  9:33       ` Felipe Contreras
2024-03-17 21:36         ` Bart Schaefer
2024-03-16  9:43     ` Roman Perepelitsa
2024-03-16 11:59       ` Felipe Contreras

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='CAH+w=7YedsQCk56Bvygc_NvsByDJf_MWK57XZYEoO4Xtx1eXww@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=felipe.contreras@gmail.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).