From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,URIBL_SBL,URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id dd2e2a06 for ; Sat, 26 Oct 2019 01:38:22 +0000 (UTC) Received: (qmail 17932 invoked by alias); 26 Oct 2019 01:38:14 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44872 Received: (qmail 7184 invoked by uid 1010); 26 Oct 2019 01:38:14 -0000 X-Qmail-Scanner-Diagnostics: from mail-lf1-f67.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.0/25608. spamassassin: 3.4.2. Clear:RC:0(209.85.167.67):SA:0(-0.3/5.0):. Processed in 2.02982 secs); 26 Oct 2019 01:38:14 -0000 X-Envelope-From: rocky.bernstein@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.167.67 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=M6nYPXAzDsL4juyHpIIJhQZ5nEQYMGByCz3BbijFuc8=; b=fm5pp2eIUesYhNJ0tTZzvAZLc+E4ZpTIWCt7obxLY0FC2jXyJqcjGOtWyfg9JbiTSh 8q8ZfN6cn6ntw1EBIP+IJHHj7cDZHjZ2jztN8gHRohEOTt+Vm+WqQiFwwouduJiHF38J 5puhcDXb7dTXvsZ6gbZnaDn0UOuXG5uqZnipd/lF+kU2R23vXz6lXIxYTEEIqjVdq4wk FCO2VEAXrukh7e5RmyJyX3135AQkBCGr85xlV0NqljCbuDunzh76sq4caAflcc0KnZaL ox+zwVN8fwmhPhE+9vAm+4o2yzIC2hzheq4cPAh9m0uRtNMryAyAmGNud3XhUoQMkMOq S0sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=M6nYPXAzDsL4juyHpIIJhQZ5nEQYMGByCz3BbijFuc8=; b=BXOwRAbWk+7wnsMJAFsmqch3KGiWKHyhhjgqVAxHWX3VCiOKqBiFJjpLnixrs3nXgc 4T6X8yRhDxhBby2Y7i32dBGC1e5F3VN6+tZdohio3obITVm5YHmVUwWKPu7EnaWI5Gt9 nQiIImC1fcO/oPu00dFbfTLe/AnbMd2BXRgWV2sL96n38sNtPiGAfdMm1czd/lrattDN vB/aiAVd3BzJu7j5QdiE0O56k496qW6H5y37Fk41oeUYEhTHDCdOYec/AT4zBDrezS+3 UPSFmHPh/rv99nF6p2oV70gJYuaKYHFDTDJS+vAJw0JgcKDXIFob6ZG0Kudvsv9trU6k sksw== X-Gm-Message-State: APjAAAWHpOlXhrVBNwvJbun3VCXAt0u4d8Luhi5WcCfelSnvvaEPhp9h Pv16IFQ7chbSE6O6g19MygXRZfY5IYQWwnIme1k= X-Google-Smtp-Source: APXvYqzLbC68ijU+VLApfS/Ypqql5Kugob773JEmzXcgAVY+83Dko6AqkyXHezMGZHC4IvAio9vGa1KvriC7aQTwNXQ= X-Received: by 2002:a19:c606:: with SMTP id w6mr4407455lff.71.1572053856930; Fri, 25 Oct 2019 18:37:36 -0700 (PDT) MIME-Version: 1.0 References: <20191025175206.7lpnhzcenlwqs4el@chaz.gmail.com> In-Reply-To: <20191025175206.7lpnhzcenlwqs4el@chaz.gmail.com> From: Rocky Bernstein Date: Fri, 25 Oct 2019 21:37:25 -0400 Message-ID: Subject: Re: Feature Request: Allow skipping zsh statement on return from trap DEBUG To: Stephane Chazelas Cc: zsh-workers@zsh.org Content-Type: multipart/alternative; boundary="000000000000b5d1df0595c64f1e" --000000000000b5d1df0595c64f1e Content-Type: text/plain; charset="UTF-8" My apologies for not realizing this. I _did_ look at the trap DEBUG command and even noticed the DEBUG_BEFORE_CMD, but I guess I didn't read carefully enough to notice ERR_EXIT. At any rate with commit https://github.com/rocky/zshdb/commit/d3f00505f58ddb3d781a2140d92baa19dcc0a200 (and the one before that) this is now all in the debugger, and it works great! When I get a chance, a new release, 1.1.0, will go out soon with this in it. Thanks, yet again, to Stephane for helping me out here. -- I make mistakes, that's why I work on debuggers. On Fri, Oct 25, 2019 at 1:52 PM Stephane Chazelas < stephane.chazelas@gmail.com> wrote: > 2019-10-24 16:17:27 -0400, Rocky Bernstein: > > A while ago I wrote a debugger for zsh called zshdb > > . See also > > https://repology.org/project/zshdb/versions . > > > > A feature that is missing in the debugger and that is available in the > > corresponding debugger for bash, bashdb, is the skip command. > > > > This command skips over the upcoming statement to be executed. The way > this > > works in bashdb, is that if the debug hook returns with a nonzero value. > > The way BASH works is that if the trap DEBUG hook returns a nonzero > value, > > BASH skips statement to be run. > > > > Thoughts about extening zsh so that it too will skip the upcoming > statement > > if the zsh trap DEBUG hook return a non-zero value. Or more generally > some > > means by which a DEBUG hook can indicate to zsh to skip the upcoming > > statement? > [...] > > See info zsh trap: > > } If SIG is DEBUG then ARG will be executed before each command if > } the option DEBUG_BEFORE_CMD is set (as it is by default), else > } after each command. Here, a 'command' is what is described as a > } 'sublist' in the shell grammar, see *note Simple Commands & > } Pipelines::. If DEBUG_BEFORE_CMD is set various additional > } features are available. First, it is possible to skip the next > } command by setting the option ERR_EXIT; see the description of the > } ERR_EXIT option in *note Description of Options::. Also, the shell > } parameter ZSH_DEBUG_CMD is set to the string corresponding to the > } command to be executed following the trap. Note that this string > } is reconstructed from the internal format and may not be formatted > } the same way as the original text. The parameter is unset after > } the trap is executed. > > Was added in 2008: https://www.zsh.org/mla/workers/2008/msg01075.html > > You participated in that discussion, sounds likely you actually > requested the feature then. > > TRAPDEBUG() { > echo "$ZSH_DEBUG_CMD" > [[ $ZSH_DEBUG_CMD = *x* ]] && set -o errexit > } > echo x > echo y > > > gives: > > echo x > echo y > y > > -- > Stephane > --000000000000b5d1df0595c64f1e--