Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: zsh-3.1.5-pws-9, TRAPZERR fix for new completion
- X-seq: zsh-workers 5456
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: "Matt Armstrong" <mattarmst@xxxxxxxxxxx>, zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: zsh-3.1.5-pws-9, TRAPZERR fix for new completion
- Date: Sun, 21 Feb 1999 11:50:50 -0800
- In-reply-to: <19990221184045.24549.qmail@xxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <19990221184045.24549.qmail@xxxxxxxxxxx>
On Feb 21, 10:40am, Matt Armstrong wrote:
} Subject: Re: PATCH: zsh-3.1.5-pws-9, TRAPZERR fix for new completion
}
} As far as restoring it, Do'h! I thought I tested that, but obviously
} not. Is there an easy way to bind a function to a different name and
} restore it? I've tried games with stuff like foo=$(functions TRAPZERR)
} ... eval $foo, but that seems suboptimal.
You can do
zsh% eval newname "$(functions oldname)"
zsh% oldname() { ... }
zsh% eval oldname "$(functions newname)"
zsh% unfunction newname
as long as newname is unique and oldname isn't awaiting autoload.
For traps, if you use the "trap" builtin instead of a TRAPxxx() function,
the trap is automatically removed at the end of the local scope. That
does not restore any outer-scope traps, though (global-scope TRAPxxx() is
deleted by local-scope "trap ... xxx" commands).
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author