From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10782 invoked by alias); 4 Jun 2014 00:03:57 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32689 Received: (qmail 12666 invoked from network); 4 Jun 2014 00:03:43 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=5wsbBSfCfHzB84XT83XoKUSRryuXtJghOYbn2Xk9AZg=; b=Nbcu995vxnv7b2zYq9wkEFwO27giQrBYW3TZB1hEybBZAsgE91u7P91GUW5tpDjrmL U6n/ZKJSclZe0wLq+GXutw0TGO5AO8hxiH9O8C9YTx8HAWCPOQwGzW6OigX0UME90C1y 5+OBi0I7/xZ991glDXUnAQwABtsQSIG11hyGXb7mFnPzHKYebIEPVibPaAA38ndGuTSa 90RChd06J/6EDEbvUpIP941iysG+Wdc/WKD8Vrps+T7Puk/aepAolWmT9DwISV/lwsRh CvB8A8iB+vPYLkSiWxUbK6wiWJggRyCP39/wF6OGjmBXcZa/BH1ODMgjs9/6cF5bx4zr FInQ== X-Gm-Message-State: ALoCoQk8t8qYw3SvBVQ6xpSztLlAogbpOQ33agFe33i2QOweeoGpSRqlgTerTTPAur+VazpKrjni MIME-Version: 1.0 X-Received: by 10.140.20.68 with SMTP id 62mr58150474qgi.30.1401840219921; Tue, 03 Jun 2014 17:03:39 -0700 (PDT) In-Reply-To: <538E5212.6000506@bbn.com> References: <5387BD0D.8090202@bbn.com> <140529204533.ZM5362@torch.brasslantern.com> <5388461D.8060203@bbn.com> <140530100050.ZM18382@torch.brasslantern.com> <5388F4C3.6070801@bbn.com> <140530221301.ZM31798@torch.brasslantern.com> <538E2CDD.7070106@bbn.com> <538E5212.6000506@bbn.com> Date: Tue, 3 Jun 2014 17:03:39 -0700 Message-ID: Subject: Re: 'emulate sh -c' and $0 From: Bart Schaefer To: zsh-workers@zsh.org Content-Type: multipart/alternative; boundary=001a11c125b657358704faf75c62 --001a11c125b657358704faf75c62 Content-Type: text/plain; charset=UTF-8 On Jun 3, 2014 3:54 PM, "Richard Hansen" wrote: > > I was thinking more along the lines of temporarily > restoring the top-level (non-emulated) option state when calling a > function that was not defined inside of 'emulate -c'. (Maybe > there's not a significant implementation difference between what I'm > thinking and assigning sticky options to all functions.) Implementation aside, operationally this still violates dynamic scoping. It means for example that the completion system can't set extendedglob on entry and be sure it remains in effect throughout any helper functions it calls. The reason sticky emulation works the way it does is because it allows the function author to explicitly assert that dynamic scoping should not apply to the options in effect in that function, but the default scope is still dynamic for all other functions. It might be possible to introduce another builtin/precommand that temporarily unwinds one level of option state before entering the next, sort of a "go play at Grandma's house" wrapper ... but I haven't really thought about how that could be done. It would require exporting a bunch of the local C state of doshfunc(), I bet. --001a11c125b657358704faf75c62--