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.