zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Set option in parent after emulate -L zsh
Date: Tue, 14 Mar 2017 13:24:18 -0700	[thread overview]
Message-ID: <170314132418.ZM10585@torch.brasslantern.com> (raw)
In-Reply-To: <1489519062.3305775.911250584.6989BBE9@webmail.messagingengine.com>

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.


  reply	other threads:[~2017-03-14 20:23 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 [this message]
2017-03-14 20:39       ` Sebastian Gniazdowski

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=170314132418.ZM10585@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).