From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19530 invoked from network); 12 Feb 2009 09:47:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 12 Feb 2009 09:47:48 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 13603 invoked from network); 12 Feb 2009 09:47:26 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 12 Feb 2009 09:47:26 -0000 Received: (qmail 4303 invoked by alias); 12 Feb 2009 09:47:20 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26560 Received: (qmail 4288 invoked from network); 12 Feb 2009 09:47:20 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 12 Feb 2009 09:47:20 -0000 Received: from cluster-d.mailcontrol.com (cluster-d.mailcontrol.com [85.115.60.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 57868802720F for ; Thu, 12 Feb 2009 10:47:16 +0100 (CET) Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly19d.srv.mailcontrol.com (MailControl) with ESMTP id n1C9khYZ006629 for ; Thu, 12 Feb 2009 09:47:15 GMT Received: from news01 ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Thu, 12 Feb 2009 09:44:39 +0000 Date: Thu, 12 Feb 2009 09:44:33 +0000 From: Peter Stephenson To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: PATCH: sticky emulation Message-ID: <20090212094433.30ce1b62@news01> In-Reply-To: <090211153758.ZM8681@torch.brasslantern.com> References: <18952.1234307021@pws-pc> <090210191804.ZM7110@torch.brasslantern.com> <20090211202840.000b37aa@pws-pc> <090211153758.ZM8681@torch.brasslantern.com> Organization: CSR X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.8; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 12 Feb 2009 09:44:39.0332 (UTC) FILETIME=[85EA0640:01C98CF6] X-Scanned-By: MailControl A_08_51_00 (www.mailcontrol.com) on 10.68.0.129 X-Virus-Scanned: ClamAV 0.92.1/8981/Thu Feb 12 01:28:11 2009 on bifrost X-Virus-Status: Clean On Wed, 11 Feb 2009 15:37:58 -0800 Bart Schaefer wrote: > On Feb 11, 8:28pm, Peter Stephenson wrote: > } > } Bart Schaefer wrote: > } > What about zcompiled functions? Obviously there's no special case for > } > them, but their treatment may be worth explanation at doc time. > } > } I've done that. > > I guess I'm specifically interested in what happens with "zcompile -c" > which takes a function already defined in the shell and writes it out > compiled. Suppose this is used on a function with sticky emulation. > If the compiled form is then reloaded, is it still sticky? I suspect the answer's no, but I don't understand the internals and I don't know how to execute the file in such a way that the reloaded function isn't marked for autoloading, and autoloading certainly isn't handled. > Date: Wed, 11 Feb 2009 18:23:06 -0800 > Documentation nit: My info-viewer and my emacs both display the list > of emulate rules like so: >... > (and so on with the floating numbers one line up and one character too > far "outdented"). Frankly, if I had time to look at things like what the back end of the documentation tools is producing I'd be out of work. > (Aside: > Does the doc really not explain "autoload -z" anywhere? Have I just > missed it?) A quick glance suggests it actually is missing: the flag appears in the list at the top, but there's nothing in the description. > % emulate sh -c "allopt" > (list of options appears as expected, with "sh" states) > zsh: allopt: function not defined by file > > OK, clearly allopt should be getting "autoload -z" treatment. >... > So there's no way to cause an autoloaded function to acquire sticky > emulation, which is what's meant by "No special handling for ... > autoload." Yes, that's right. We may want to add this later; it should be no harder than -k or -z. However, saving a zcompile'd function in the appropriate format may be harder (I've stayed sane by avoiding that code). I've just gone through my initialisation files adding "-z"s everywhere as a consequence. Index: Doc/Zsh/builtins.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/builtins.yo,v retrieving revision 1.119 diff -u -r1.119 builtins.yo --- Doc/Zsh/builtins.yo 11 Feb 2009 20:42:16 -0000 1.119 +++ Doc/Zsh/builtins.yo 12 Feb 2009 09:38:00 -0000 @@ -131,6 +131,11 @@ With the tt(-w) flag, the var(name)s are taken as names of files compiled with the tt(zcompile) builtin, and all functions defined in them are marked for autoloading. + +The flags tt(-z) and tt(-k) mark the function to be autoloaded in +native or ksh emulation, as if the option tt(KSH_AUTOLOAD) were +unset or were set, respectively. The flags override the setting of +the option at the time the function is loaded. ) findex(bg) cindex(jobs, backgrounding) -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070