Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: sticky emulation
- X-seq: zsh-workers 26560
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: Re: PATCH: sticky emulation
- Date: Thu, 12 Feb 2009 09:44:33 +0000
- In-reply-to: <090211153758.ZM8681@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: CSR
- References: <18952.1234307021@pws-pc> <090210191804.ZM7110@xxxxxxxxxxxxxxxxxxxxxx> <20090211202840.000b37aa@pws-pc> <090211153758.ZM8681@xxxxxxxxxxxxxxxxxxxxxx>
On Wed, 11 Feb 2009 15:37:58 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Feb 11, 8:28pm, Peter Stephenson wrote:
> }
> } Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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 <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author