From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: PATCH: sticky emulation
Date: Thu, 12 Feb 2009 09:44:33 +0000 [thread overview]
Message-ID: <20090212094433.30ce1b62@news01> (raw)
In-Reply-To: <090211153758.ZM8681@torch.brasslantern.com>
On Wed, 11 Feb 2009 15:37:58 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Feb 11, 8:28pm, Peter Stephenson wrote:
> }
> } Bart Schaefer <schaefer@brasslantern.com> 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@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
next prev parent reply other threads:[~2009-02-12 9:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-10 23:03 Peter Stephenson
2009-02-11 3:18 ` Bart Schaefer
2009-02-11 20:28 ` Peter Stephenson
2009-02-11 23:37 ` Bart Schaefer
2009-02-12 9:44 ` Peter Stephenson [this message]
2009-02-12 10:10 ` Oliver Kiddle
2009-02-12 15:30 ` Peter Stephenson
2009-02-12 15:41 ` Bart Schaefer
2009-02-12 15:32 ` Bart Schaefer
2009-02-12 2:23 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090212094433.30ce1b62@news01 \
--to=pws@csr.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).