From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6171 invoked by alias); 7 Mar 2012 17:45:50 -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: 30327 Received: (qmail 17972 invoked from network); 7 Mar 2012 17:45:48 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <120307094536.ZM12724@torch.brasslantern.com> Date: Wed, 07 Mar 2012 09:45:36 -0800 In-reply-to: <20120307113406.GF4383@yahoo.fr> Comments: In reply to Stephane Chazelas "Re: Regarding emulate: a thought, and refresh my memory?" (Mar 7, 11:34am) References: <120303172521.ZM11549@torch.brasslantern.com> <20120306200652.1617879b@pws-pc.ntlworld.com> <20120306202201.GD4383@yahoo.fr> <120306223806.ZM11578@torch.brasslantern.com> <20120307113406.GF4383@yahoo.fr> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Regarding emulate: a thought, and refresh my memory? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Mar 7, 11:34am, Stephane Chazelas wrote: } } Sorry, I realise I wrote the opposite of what I meant. } } What I meant was that instead of introducing a cumbersome } confusing syntax, We could get rid of "emulate" (yes the } contrary of what I actually wrote) and do it with setopt. That doesn't cover the "emulate zsh -c ..." semantics. To replace the current (even without workers/30320) emulate behavior, we'd need: (1) two special parameters for each emulation mode, one with the set of options from "emulate -R" and the other the minimal set; (2) an extension of the "eval" command to unwind the option state and implement "sticky emulation" (this can't be based on localoptions as the emulated code needs license to freely change that); (3) a different mechanism to control the (small) set of behaviors that depend on the global emulation mode rather than on the setopt values; (4) a replacement for the other use of "emulate" which is to test what the current emulation mode *is*, e.g., to be able to discover that the shell was started with ARGV0=sh or similar. I'm not sure the sum of that ends up being any less cumbersome, not to mention breaking ten years' worth of zsh functions that start with "emulate -LR zsh". I also disagree that the emulate syntax is cumbersome or confusing, as it's very similar to sticking the word "emulate" in front of the command you'd use to start a new external shell. When using -c it's cumbersome to properly quote a whole function definition, but to fix that "emulate" (or "eval" in (2) above) would have to be a keyword. "emulate zsh -c ..." is actually pretty close in semantics to "function { setopt localoptions $zsh_options; ... }" except for the parenthetical caveat in (2) above, so if not for (3) above we could use an extension to the function keyword instead of eval, which would eliminate the quoting problem without creating any new keywords. This may be worth thinking about, independently of emulate-vs-setopt. -- Barton E. Schaefer