From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3253 invoked by alias); 14 Mar 2017 20:23:44 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22569 Received: (qmail 26786 invoked from network); 14 Mar 2017 20:23:44 -0000 X-Qmail-Scanner-Diagnostics: from mail-vk0-f47.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.213.47):SA:0(-2.3/5.0):. Processed in 1.425626 secs); 14 Mar 2017 20:23:44 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_SORBS_SPAM,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.213.47 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=z+/vZK+JuiYwqTuV0PDIx41L3ys8dGKomZ2hv51Hk/U=; b=Zka2+CZdwWvEExxJziDHAQK+A7BbglgsUx0xXVmLRHIgkNP8Q+DYeFba0yf/jkZW4+ d8p55B1MqMSefPXoB4Ts+tIQB8dsfxq0bU8UeDMAIXGTUKWNHo5x+5pf3FSdfmpPB4rH jaYeElZDpE9hMA8SLl9+NqTCGJs0U746j8LuCA0JIvj3w4Srs6A7qeTuDx5q0tgrWYKE 7hl0QRpgt55GHp3jP7CnFUOaAwFWGlYl+QIg8E+sdee4zTDZQsug0OjolR33WVY/Ypv6 7tCvjRU9mNvBrFBAAaytfc18mIe8mJLZvpesUvBVuhUjgb8SFUSz6UyvHN1ApE0I9bxh gjrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=z+/vZK+JuiYwqTuV0PDIx41L3ys8dGKomZ2hv51Hk/U=; b=ace5i81/X4uSyDJOI6+V4Y4xAPsVr1yWhGmNBFSJoVoJfWuFybLaeggR1/voOjEMUs BLUNJk3OUPp7BNqwxD8OHdG5uEzqeGolsh+jYcbnStw7WQR/JPwEly8MrHfi+SC3/lCC TUQTKWwzqVgImRaGfDh4+jp6ut6upt7w+IH83dyZPp6HHGMVZKsTaX0Aon7Vbxx0Loqx eVRo/eqt+c1G9NELXjUB5VSvRj2COla61BK8q4CHO1xy8NeuL2CkYK7EqTVVg6OyPhx8 /ltMO4AHioeHPiJoyZG/vq7aX0d1YPjJSI3SbDW03X4jmojB+y3eAnTBj4zGql25T9xp J6VQ== X-Gm-Message-State: AMke39nhUqta/iDpCQlCPtMuL/J/xTvr0FUc2UWTLZWdW5nHOtR9jN5OKsKvP8pMYldKbw== X-Received: by 10.31.10.193 with SMTP id 184mr18629091vkk.5.1489523017483; Tue, 14 Mar 2017 13:23:37 -0700 (PDT) From: Bart Schaefer Message-Id: <170314132418.ZM10585@torch.brasslantern.com> Date: Tue, 14 Mar 2017 13:24:18 -0700 In-Reply-To: <1489519062.3305775.911250584.6989BBE9@webmail.messagingengine.com> Comments: In reply to Sebastian Gniazdowski "Re: Set option in parent after emulate -L zsh" (Mar 14, 12:17pm) References: <1489049936.3120661.905537968.237F11E3@webmail.messagingengine.com> <170309140613.ZM30720@torch.brasslantern.com> <1489519062.3305775.911250584.6989BBE9@webmail.messagingengine.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Set option in parent after emulate -L zsh MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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.