zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zach Riggle <zachriggle@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Disabling an option for a single statement
Date: Mon, 22 Aug 2022 21:18:30 -0700	[thread overview]
Message-ID: <CAH+w=7Y7GwF0Pjs+FgmLZXfZ+j_vyjXLcSrCHdAPhXKaufFXpw@mail.gmail.com> (raw)
In-Reply-To: <CAMP9c5=rjSbDNs1QdDPY-s8Ki0iMM_0h7T6CP30_+wuB4FcmAw@mail.gmail.com>

On Mon, Aug 22, 2022 at 10:46 AM Zach Riggle <zachriggle@gmail.com> wrote:
>
> It's not uncommon that I want to disable a specific option (in my case, cdablevars) for a single statement.

There's not really a better way in general.  There are of course the
noglob and nocorrect "precommand modifiers" which have this effect for
the GLOB and CORRECT options, but it's not generalized.

You can sort of make it work with something like

alias nocdv='() { setopt localoptions nocdablevars; "$@" } '

but that doesn't affect things that happen during argument
interpretation, such as potentially ${(D)var}, so there are several
options for which using an alias is not very helpful.


      reply	other threads:[~2022-08-23  4:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-22 17:46 Zach Riggle
2022-08-23  4:18 ` Bart Schaefer [this message]

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=7Y7GwF0Pjs+FgmLZXfZ+j_vyjXLcSrCHdAPhXKaufFXpw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zachriggle@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).