From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27521 invoked from network); 5 Sep 2007 21:12:24 -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.6 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 21:12:24 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 15011 invoked from network); 5 Sep 2007 21:12:17 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 5 Sep 2007 21:12:17 -0000 Received: (qmail 28253 invoked by alias); 5 Sep 2007 21:12:10 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11823 Received: (qmail 28243 invoked from network); 5 Sep 2007 21:12:09 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 5 Sep 2007 21:12:09 -0000 Received: (qmail 13832 invoked from network); 5 Sep 2007 21:12:09 -0000 Received: from wr-out-0506.google.com (64.233.184.234) by a.mx.sunsite.dk with SMTP; 5 Sep 2007 21:12:02 -0000 Received: by wr-out-0506.google.com with SMTP id c48so1055938wra for ; Wed, 05 Sep 2007 14:12:01 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:received:date:from:to:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=fdQaX2YmNjlzn2C/1y28OyHkD99OzKcCD8SPHnSTaeGAkBCWY33QEtzP8fho4k6JxMvuzMePadvIsVYnbnr6V0df4LXScGb7JxfTlsa/j8JedLkhrqtmVHLF3xPsCH3o4KRQKpyYRZwd/oXguBG5MGoV9U9Vow2Yk1LWgNy1w/g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:date:from:to:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=I7eWsRN31JSSBEeXjZ6vaRLxfv7PdKbhdX37byhqBLXRJz9F549KUj1xTuPkgnHX15nGf6C7W+J0kpt8hnDWDJ58q0ULXioPP5CfCrh7QKIbUEpg5WV3S3or5jO7QPLw+PEPnaWv/2C9iWdWVjfhRD8VLu6Yo7tQW9X8WAXw6n4= Received: by 10.90.74.1 with SMTP id w1mr3281877aga.1189026689117; Wed, 05 Sep 2007 14:11:29 -0700 (PDT) Received: from mastermind ( [76.99.60.158]) by mx.google.com with ESMTPS id 14sm6913643wrl.2007.09.05.14.11.26 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 05 Sep 2007 14:11:28 -0700 (PDT) Received: by mastermind (sSMTP sendmail emulation); Wed, 05 Sep 2007 17:11:23 -0400 Date: Wed, 5 Sep 2007 17:11:23 -0400 From: Matthew Wozniski To: zsh-users@sunsite.dk Subject: Re: preexec hook: possible enhancement? Message-ID: <20070905211122.GD26710@mastermind> References: <070905101420.ZM28165@torch.brasslantern.com> <200709051905.l85J5cHX003985@pws-pc.ntlworld.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200709051905.l85J5cHX003985@pws-pc.ntlworld.com> User-Agent: Mutt/1.5.15+20070412 (2007-04-11) On Wed, Sep 05, 2007 at 08:05:38PM +0100, Peter Stephenson wrote: > Bart Schaefer wrote: > > > > 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. Yeah, that's what I gathered. Since there doesn't seem to be a way to get the text of the currently executing command from the debug trap, nor to even tell if the currently executing was entered interactively, I don't see any reasonable way to proceed down that road. > 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. I had a feeling it wouldn't be easy, but maintained a bit of hope that somewhere along the line there was a function being called that was both called for every command in an interactive pipeline and knew the full text of the command it was being called for. zsh's source is still a bit scary for me, so I figured I should ask. > It doesn't look like there's a clean way to do this. Thanks for the input PWS. :) ~Matt