From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18691 invoked by alias); 14 Mar 2017 20:39: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: 22571 Received: (qmail 20525 invoked from network); 14 Mar 2017 20:39:44 -0000 X-Qmail-Scanner-Diagnostics: from new1-smtp.messagingengine.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(66.111.4.221):SA:0(-0.4/5.0):. Processed in 1.768007 secs); 14 Mar 2017 20:39: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=-0.4 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: psprint3@fastmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at spf.messagingengine.com designates 66.111.4.221 as permitted sender) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=K+4XoVhZwV4wKj88GYQoiNPmwk o=; b=Q/691JvbjGWl8VKwMGzQnXlggnnygHHD/SoenqSwwK3MdHRoiriggyUI2P Sly+BKXajIoES6CSCgIfUvLajEUelD1ZeoqyP4amqZFuPL5tbP2tm8mvUXtNuV5x 4Rb1aARgIG6WzZ7SJHUKK7i1UaT/COvQmrZzVQSuQ8XiFs0eU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=smtpout; bh=K+ 4XoVhZwV4wKj88GYQoiNPmwko=; b=itm+iicJ0tR5Dnq+t+oUSdQVanC2gpHeXL 8Vkln4HC4IyUU48wFyd5xTobYA9FXolgnQ40oX5fnhWozwSLc4C+FjxvxbLmxad3 NboAa5x3Thbgu2l/RQzy/qF+Q0wsogLHqpefLjjl7gFlih0KcYbdPj2ORZdc5voR bB3X0UrtE= X-ME-Sender: Message-Id: <1489523977.4124278.911343016.3B025336@webmail.messagingengine.com> From: Sebastian Gniazdowski To: zsh-users@zsh.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-aac97429 References: <1489049936.3120661.905537968.237F11E3@webmail.messagingengine.com> <170309140613.ZM30720@torch.brasslantern.com> <1489519062.3305775.911250584.6989BBE9@webmail.messagingengine.com> <170314132418.ZM10585@torch.brasslantern.com> Subject: Re: Set option in parent after emulate -L zsh Date: Tue, 14 Mar 2017 13:39:37 -0700 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