From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1905 invoked from network); 7 Aug 2008 08:55:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) 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.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 7 Aug 2008 08:55:29 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 80441 invoked from network); 7 Aug 2008 08:55:19 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 7 Aug 2008 08:55:19 -0000 Received: (qmail 23357 invoked by alias); 7 Aug 2008 08:55:12 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25413 Received: (qmail 23324 invoked from network); 7 Aug 2008 08:55:07 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 7 Aug 2008 08:55:07 -0000 Received: from cluster-g.mailcontrol.com (cluster-g.mailcontrol.com [208.87.233.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 28FF8805A433 for ; Thu, 7 Aug 2008 10:55:01 +0200 (CEST) Received: from rly19g.srv.mailcontrol.com (localhost.localdomain [127.0.0.1]) by rly19g.srv.mailcontrol.com (MailControl) with ESMTP id m778snwi003116 for ; Thu, 7 Aug 2008 09:54:57 +0100 Received: from submission.mailcontrol.com (submission.mailcontrol.com [86.111.216.190]) by rly19g.srv.mailcontrol.com (MailControl) id m778siLF002871 for zsh-workers@sunsite.dk; Thu, 7 Aug 2008 09:54:44 +0100 Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly19g-eth0.srv.mailcontrol.com (envelope-sender Peter.Stephenson@csr.com) (MIMEDefang) with ESMTP id m778sgfI002678; Thu, 07 Aug 2008 09:54:43 +0100 (BST) Received: from news01 ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Thu, 7 Aug 2008 09:54:42 +0100 Date: Thu, 7 Aug 2008 09:54:41 +0100 From: Peter Stephenson To: "Rocky Bernstein" Cc: "Zsh hackers list" Subject: Re: DEBUG_CMD_LINE (Was Re: PATCH: skip command from debug trap) Message-ID: <20080807095441.3058605d@news01> In-Reply-To: <6cd6de210808061419q2a81856cv62969490069e8f3e@mail.gmail.com> References: <6cd6de210808061419q2a81856cv62969490069e8f3e@mail.gmail.com> Organization: CSR X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.8; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 07 Aug 2008 08:54:42.0008 (UTC) FILETIME=[3B4BED80:01C8F86B] X-Scanned-By: MailControl A-08-50-03 (www.mailcontrol.com) on 10.71.1.129 X-Virus-Scanned: ClamAV 0.92.1/7968/Thu Aug 7 10:32:30 2008 on bifrost X-Virus-Status: Clean On Wed, 6 Aug 2008 17:19:14 -0400 "Rocky Bernstein" wrote: > > (By the way, it wouldn't be too hard, if not completely trivial, to pass > > down the code about to be executed in a variable, say DEBUG_CMD_LINE, as > > reconstructed text, i.e. the same sort of format as what you get if you > > get the shell to output a shell function that's already loaded. But > > it's messy enough that I won't unless it's definitely useful.) > > My secret plan was to get the debugger working enough for folks to > realize this would be useful. In bash the variable $BASH_COMMAND holds > the command that is up for execution next. It is not the "line" (as > suggested in the name DEBUG_CMD_LINE) > but the last command or statement. That's not quite how it works in zsh at the moment. The DEBUG trap is run at the level of a "sublist", which is anything separated by ;, &, end of line, or special terminators in certain cases (e.g. end of case markers) so in your examples > [[ -z $FOO ]] && bar || baz > temp=x; x=y; y=temp the sublists are [[ -z $FOO ]] && bar || baz tmp=x x=y y=temp and you get one execution of the trap for each group. So DEBUG_CMD_LINE would include the whole of each sublist. Without having looked at it in depth, it sounds is if zsh is being a bit more structure-based rather than line-based compared with bash. It would be possible with a bit of fiddling to get the DEBUG trap to happen at the level of elements of a sublist, i.e. commands separated by && and ||, but I'm not sure if that's worth it. Beyond that you run into the hideous complexity of pipelines and I don't think it can be pushed that far down. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070