From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6345 invoked from network); 5 Aug 2008 15:51:10 -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; 5 Aug 2008 15:51:10 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 52415 invoked from network); 5 Aug 2008 15:50:57 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 5 Aug 2008 15:50:57 -0000 Received: (qmail 10078 invoked by alias); 5 Aug 2008 15:50:44 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25397 Received: (qmail 10053 invoked from network); 5 Aug 2008 15:50:40 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 5 Aug 2008 15:50:40 -0000 Received: from mail.o2.co.uk (vader.london.02.net [82.132.130.150]) by bifrost.dotsrc.org (Postfix) with ESMTP id EF469804CDE0 for ; Tue, 5 Aug 2008 17:50:36 +0200 (CEST) Received: from sc.homeunix.net (78.105.216.138) by mail.o2.co.uk (8.0.013.3) (authenticated as stephane.chazelas) id 4898742000007AFD; Tue, 5 Aug 2008 16:50:30 +0100 Received: from chazelas by sc.homeunix.net with local (Exim 4.69) (envelope-from ) id 1KQOnt-0002zc-AD; Tue, 05 Aug 2008 16:50:29 +0100 Date: Tue, 5 Aug 2008 16:50:29 +0100 From: Stephane Chazelas To: Peter Stephenson Cc: Zsh hackers list Subject: Re: PATCH: skip command from debug trap Message-ID: <20080805155029.GA5170@sc.homeunix.net> Mail-Followup-To: Peter Stephenson , Zsh hackers list References: <27237.1217946438@csr.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <27237.1217946438@csr.com> User-Agent: Mutt/1.5.16 (2007-09-19) X-Virus-Scanned: ClamAV 0.92.1/7944/Tue Aug 5 17:23:26 2008 on bifrost X-Virus-Status: Clean On Tue, Aug 05, 2008 at 03:27:18PM +0100, Peter Stephenson wrote: > I believe this is the fairly simple code needed to skip a command from a > debug trap. > > The only difficult bit is the way of triggering it, since it's long > established that any non-zero number returned from a trap causes the > enclosing function to return. I was inclined to pick a negative number, > but Rocky wants that for something else. So how about 255, which is > fairly special? [...] How about a special variable containing the code to be run available from the trap and that can be set to something else within the trap. Or how about using some form of exception raising? Also, I don't know if it's been mentionned before, put to have a DEBUG trap before every command, it seems that we should be able to use PS4 with set -x, though there may not be any easy way _not_ to start a subshell: PS4='$(debug_function)' -- Stéphane