Zsh Mailing List Archive
Messages sorted by:
Re: preexec hook: possible enhancement?
- X-seq: zsh-users 11821
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: preexec hook: possible enhancement?
- Date: Wed, 05 Sep 2007 20:05:38 +0100
- In-reply-to: Message from Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> of "Wed, 05 Sep 2007 10:14:20 PDT." <070905101420.ZM28165@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
Bart Schaefer wrote:
> On Sep 5, 12:34pm, Matthew Wozniski wrote:
> } While we're on the topic of using the preexec hook to set the
> } titlebar, I'd like to bounce something off the list and see if 1) it's
> } possible and 2) people would consider it useful. So, would it be
> } possible and/or useful to have the preexec hook (or some other, new
> } hook) fire once for each pipeline in the current command, rather
> } than just once using the entire current line?
> The TRAPDEBUG function is called at these points in the execution,
> if you "setopt DEBUG_BEFORE_CMD". However, I don't remember offhand
> whether it's possible to access the command text that is about to be
> executed. The documentation for TRAPDEBUG is pretty sparse.
> (Also DEBUG_BEFORE_CMD requires a very recent zsh version.)
I doubt if there's much joy there... debug traps are called before/after
every command, including in precmd and preexec, so probably far too
often. (They're for debugging, right?) The only argument to a
TRAPDEBUG function is the signal number, which is meaningless in this
case anyway. The older stuff like this ksh import doesn't tend to be
tightly enough defined to be useful interactively.
The idea of a hook between pipelines is actually rather different from
preexec and precmd; those get run around the time the shell fetches the
line for editing, rather than in the middle of execution. Running
something after every pipeline would have to dig its mitts into into the
execution tree, which is why Bart suggested debug traps.
It doesn't look like there's a clean way to do this.
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by: