Zsh Mailing List Archive
Messages sorted by:
- X-seq: zsh-workers 22979
- From: Peter Stephenson <pws@xxxxxxx>
- To: "Zsh hackers list" <zsh-workers@xxxxxxxxxx>
- Subject: Re: Hooks
- Date: Tue, 07 Nov 2006 18:46:33 +0000
- In-reply-to: <061107091449.ZM1096@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <5db995410611060845y53f673e6je029a9c60659f116@xxxxxxxxxxxxxx> <20061106174053.GA4323@sc> <5db995410611061314l26e089b8wb214da46064c8235@xxxxxxxxxxxxxx> <20061106215051.GB4323@sc> <Pine.OSX.4.61.0611061617370.1112@xxxxxxxxxxxxxxx> <20061107081800.GA4420@sc> <20061107104916.d01e2fa5.pws@xxxxxxx> <dbfc82860611070711u322a6948m675ef9a38d097717@xxxxxxxxxxxxxx> <061107091449.ZM1096@xxxxxxxxxxxxxxxxxxxxxx>
Bart Schaefer wrote:
> For example, if one of the functions causes an error condition (the
> sort of thing that would jump to the final clause of an "always" block)
> is the whole chain aborted, or only the one function?
Currently we don't reset the errflag. In some cases (precmd and
periodic) we abort all precommand processing on a failure: this is how
it has always worked, for suitable values of "always", in the case of
chained activities before a prompt. This probably needs to be
documented, however it works.
> Related but more subtle, if a function returns a non-zero status,
> should that affect the rest of the functions in the array in any way?
> Put another way, are there rules for cascading the hooks?
I thought of this, but decided it wasn't that helpful. The whole point
of being able to do this automatically is that you shouldn't care what
other functions are doing. However, maybe there's a counterexample.
> And what is the value of "$@" when these functions are called? Does
> is differ depending on which hook array they're in? (The signatures
> of preexec, precmd, and chpwd are quite different.)
It's the same as the currently defined function for that context.
That seems the only sensible way of doing it.
> I'd suggest that, at least as a first pass, rather than coded up in C,
> this be implmented with a few functions distributed in Functions/Misc
> and designed to be installed as preexec, precmd, and/or chpwd.
Certainly I could mimic the current system in shell functions, but I'm
not sure what that gains: the whole point of doing it in C is that you
can rely on it always being there. I will certainly consider changes to
the current system.
I made one screwup: preexec_functions aren't handled unless preexec
exists as well. I've used a different optimisation to avoid needing the
argument handling if there's nothing to do.
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
Messages sorted by: