Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Set option in parent after emulate -L zsh
On Tue, Mar 14, 2017, at 01:24 PM, Bart Schaefer wrote:
> There is only one option scope: the global one. When a function call
> is made, the current values of all the options are stored. When the
> call returns, the setting of localoptions is checked, and if set, then
> the saved options from the start of the call are restored (with those
> exceptions previously noted); otherwise the options are not changed
> (again with noted exceptions).
>
> Given thusly that all option scopes are the same, yes, the scope of
> (anon) is the scope of the caller, and as long as the options you are
> frobbing are not among those exceptions, you can disrupt the caller's
> settings all you like.
Cool, ensured that this works (forgive one-liness, but maybe it's better
that way):
() { emulate -LR zsh; echo 1_$options[promptsubst]; () { emulate -LR
zsh; () { unsetopt localoptions; setopt promptsubst; }; echo
2_$options[promptsubst]; }; echo 3_$options[promptsubst]; }
1_off
2_on
3_off
--
Sebastian Gniazdowski
psprint3@xxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author