From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17935 invoked from network); 5 Sep 2007 19:06:15 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 5 Sep 2007 19:06:15 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 56100 invoked from network); 5 Sep 2007 19:06:08 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 5 Sep 2007 19:06:08 -0000 Received: (qmail 10977 invoked by alias); 5 Sep 2007 19:05:58 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11821 Received: (qmail 10967 invoked from network); 5 Sep 2007 19:05:57 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 5 Sep 2007 19:05:57 -0000 Received: (qmail 54830 invoked from network); 5 Sep 2007 19:05:57 -0000 Received: from mtaout01-winn.ispmail.ntl.com (81.103.221.47) by a.mx.sunsite.dk with SMTP; 5 Sep 2007 19:05:51 -0000 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com with ESMTP id <20070905190546.GBOG1783.mtaout01-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com> for ; Wed, 5 Sep 2007 20:05:46 +0100 Received: from pws-pc.ntlworld.com ([81.107.45.67]) by aamtaout04-winn.ispmail.ntl.com with ESMTP id <20070905190546.LZFO29112.aamtaout04-winn.ispmail.ntl.com@pws-pc.ntlworld.com> for ; Wed, 5 Sep 2007 20:05:46 +0100 Received: from pws-pc.ntlworld.com (pws-pc.ntlworld.com [127.0.0.1]) by pws-pc.ntlworld.com (8.14.1/8.13.8) with ESMTP id l85J5cHX003985 for ; Wed, 5 Sep 2007 20:05:38 +0100 Message-Id: <200709051905.l85J5cHX003985@pws-pc.ntlworld.com> From: Peter Stephenson To: zsh-users@sunsite.dk Subject: Re: preexec hook: possible enhancement? In-Reply-To: Message from Bart Schaefer of "Wed, 05 Sep 2007 10:14:20 PDT." <070905101420.ZM28165@torch.brasslantern.com> Date: Wed, 05 Sep 2007 20:05:38 +0100 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 Web page now at http://homepage.ntlworld.com/p.w.stephenson/