Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: local functions
The current git head has a new utility function
Completion/Base/Utility/_shadow that can be used to simulate local
function names. You write
{
_shadow myfunc
function myfunc {
# Do your new thing
}
# call myfunc as needed
} always {
_unshadow myfunc
}
If there is already a function named "myfunc" it gets moved aside and
replaced by the new one, and then moved back by _unshadow. This can
also be used to temporarily replace a builtin.
The functions aren't really local -- they exist in the global scope,
so there's still a chance that something that wants to call the
original one will get the newer one by mistake -- but that's pretty
similar to what happens with local parameters.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author