Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: A method to not leak unneeded functions
On Thu, 3 Oct 2019 at 23:18, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> Is there any way to speed this up?
Uhm, the solution is pretty obvious - to use a global ef-parameter. It
doesn't even need to be leaked outside the function - example snippet
for a `zpview' project:
typeset -g zpview_ef
zpview_ef=( ${(k)functions} )
trap "unset -f -- \"\${(k)functions[@]:|zpview_ef}\" &>/dev/null;
unset zpview_ef" EXIT
trap "unset -f -- \"\${(k)functions[@]:|zpview_ef}\" &>/dev/null;
unset zpview_ef; return 1" INT
As said, the method is fully instant, it takes only 1 ms to do the unset.
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author