From: Sebastian Gniazdowski <psprint3@fastmail.com>
To: zsh-users@zsh.org
Subject: Re: Set option in parent after emulate -L zsh
Date: Tue, 14 Mar 2017 13:39:37 -0700 [thread overview]
Message-ID: <1489523977.4124278.911343016.3B025336@webmail.messagingengine.com> (raw)
In-Reply-To: <170314132418.ZM10585@torch.brasslantern.com>
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@fastmail.com
prev parent reply other threads:[~2017-03-14 20:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-09 8:58 Sebastian Gniazdowski
2017-03-09 22:06 ` Bart Schaefer
2017-03-10 5:47 ` Daniel Shahaf
2017-03-14 19:17 ` Sebastian Gniazdowski
2017-03-14 20:24 ` Bart Schaefer
2017-03-14 20:39 ` Sebastian Gniazdowski [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=1489523977.4124278.911343016.3B025336@webmail.messagingengine.com \
--to=psprint3@fastmail.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).