Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Set option in parent after emulate -L zsh
On Mar 14, 12:17pm, Sebastian Gniazdowski wrote:
}
} () { unsetopt localoptions; setopt promptsubst; } # prompt restored
}
} Doing this I'm able to set promptsubst in caller (which used emulate
} -LR). This looks like: option-scope of (anon) is equated with scope of
} caller. Is it really what happens?
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author