From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 21589 invoked from network); 5 Sep 2021 00:27:56 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 5 Sep 2021 00:27:56 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630801676; b=VFVbLL0H5WEfqXpRPECOPt7HtRPnKo21xW9kQQpuZhSo2d8s3FF9kFstWm6KHoE4cQcPbF0Aje nWXYxUHSVPptAjTD9dLpbxLPAn1ZCK3ZJ0/S6f3cWFQ8fC5VvPR/7LxDsJDOGx0aqeBb2a1jJb Rc2DcQuKctB9pZ5lfgQ1ikEHQnjbqltpGkSGyX4SW47b2wjDNZh0idV8DrB5diIUmvcFksmzO7 n4af0hFM9elplkykMPLmqmq+whXJn5VCK8Ob4sRW7qtSDwv/Rvyrbs+UO9plHyHk7Zpib7kefS 9xAyOB8cexKLHIUymu4ZGf3Hi1xajlYdbFErW5Xz+ZVSqg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-wr1-f53.google.com) smtp.remote-ip=209.85.221.53; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1630801676; bh=D5DPuoXMWUoXP5BplX7CtftmdPesCYbFhnbKcPlC4ck=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=c7Sivz3V54eqhxGyxooTo9aNC1u5CHsmhpCKEma/pq5x2N02oDhrApqpozkbgdGFfcJ05InHt2 Dw3aGfRWrB1imMDsTHrPeOCnlKxFrnu0K9fZQtnyveleWH/HNT3F55gCiMvybB08Vz0LqSzGFT YwT2i8h2w7vf9JPrSRet0+vydwmeT2u2hJNO9dkf4Z3qI4KXzGXyRNRjOrKjfnL2sheM/H9Vxm j89MyLxVHMN96FqLDKFJLhWFa0aYk4qfoyVECSo9moTb3OQ4fsCQC53Z+Pj+F1EGIcapelWiaQ uKxrnFRfe6w4R28XQGbbE3xP6B+5OsnW0tExa9fe+hNVPg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=yHypq9ehio4DfMfOE85XPy3CnnlDkFgA67zH9h1sng0=; b=OoXLuPA40JwaiUgRJw2Yh2BWUL zf64JiHIK1mBM2OVTtakowR++h5xrKMjH8QtaSgmuV3SBALd6ZeAIL17UdrFuIMXDj49P0IL+Lxlg 2JZfvdoC7BofggPomMg+B3XRjAsCKpezNHZLNANozcQPIWX5+x5pMTldcwa+TRFSgCf9zi8xLy5bR izPEAGDSsRPjGslfav0zRwR0rig1WY874Sb8/1Kz1K+sxauM6p9s0uQ2tfndqmiqxEmhz9iUnzBuM IhwWMkUKmOxpNL/xfW/rAhOs2aNLLCPS8VFVDA39kgBHF000bNoDnV92RaRCzO6+IXhozfSdlTQLg J8sCUuLw==; Received: from authenticated user by zero.zsh.org with local id 1mMg0o-000IqP-ML; Sun, 05 Sep 2021 00:27:54 +0000 Authentication-Results: zsh.org; iprev=pass (mail-wr1-f53.google.com) smtp.remote-ip=209.85.221.53; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-wr1-f53.google.com ([209.85.221.53]:35577) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mMfzv-000I8R-OZ; Sun, 05 Sep 2021 00:27:00 +0000 Received: by mail-wr1-f53.google.com with SMTP id i6so4135076wrv.2 for ; Sat, 04 Sep 2021 17:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yHypq9ehio4DfMfOE85XPy3CnnlDkFgA67zH9h1sng0=; b=lb/80e6JBdXZ5v+PCxtjURWHn2S4Gg9qRURGvPDUUx62CN/5CUvWDpOc7/QbI5ZfSN kHX4bWZA4HHnIH694ngLkB2vKRU5MK6geMcDdMyGrDJujpisfiJXi07vv0rJoBgdrmqK M/wDWlGu+F6YetxnTnNYxW0nrxWf7wpM9dSlhduQu9ByAKSJqQtQy6j+vww/tVcR2Spp PkSAH/WGQ5yXI325jwp77xG4MSx8zKPh4a+K0N/FRmW/kSCwWpnM3/hePs3DsvfjJ2Cz DuYN/AJO68yf2ghDn5sGgH32h1XxRcl1eDgXAp0PQeqdViKcmNL1WomkorW1WxSbNmsg F4IA== 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=yHypq9ehio4DfMfOE85XPy3CnnlDkFgA67zH9h1sng0=; b=Xs72WVfZeB7tKjNPju37pJXdu8s94pyp+a/f1S2w0wRVdgQuDGTYbBbH38Xd7yWKeJ M+NRtJnpexuXe6CEbLyk/v84OAlE+LmE0APXvHIMGVyiOcPp03wKzrT5PsBXyJUbtnHb rSyrDr1d30kOxf51+z7+6zR2bzM3II8FT5h/5+lf74b2baHoo18W/Gr0sDwN3Cuzfsy/ JNryA6bn2vIRDg2Ylsl/purszFY/k1n5X+iDC57b9C9fouQF4BcF/29e8hffnXPf0+zY SsCxaQgVxGlJxinJME8QhVmbsPoUzweNcCPvoaNU4klww+NlLQfnCu0wcTlIK7qO/7Kt r85Q== X-Gm-Message-State: AOAM530fQr6KyrlGlrcfp/ao8+MtvRYQqUXQiL3xcdg0XzyMmhAekyo9 FITX+9IBCNMiYmt/t0PRgDHRQrhHq5hC8PYmj06A14D5wyk= X-Google-Smtp-Source: ABdhPJyu60kKR9cuLslBTLZe1S9jrDlP7tFUvd3EzHtHc3VNTY8/OrtoNrnJwj8uPvglzKrnpHDpgiTPbWp/yFnfjK8= X-Received: by 2002:adf:c38c:: with SMTP id p12mr5826099wrf.113.1630801619191; Sat, 04 Sep 2021 17:26:59 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Zach Riggle Date: Sat, 4 Sep 2021 19:26:48 -0500 Message-ID: Subject: Re: Accessing the evaluated expression which caused an error To: Bart Schaefer Cc: Zsh Users Content-Type: multipart/alternative; boundary="000000000000360b4605cb3497ce" X-Seq: 27085 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: --000000000000360b4605cb3497ce Content-Type: text/plain; charset="UTF-8" Will the (e) actually evaluate the parameters and execute them again? Or just a single layer of expansion? On Sat, Sep 4, 2021 at 3:08 PM Bart Schaefer wrote: > On Fri, Sep 3, 2021 at 10:38 AM Zach Riggle wrote: > > > > > What exactly might you want captured? > > > > Very frequently I build a create an array that contains a command [...] > > And invoke it like: > > > > "${cmd[@]}" > > Given that you're doing it that way (rather than say "eval" it), you > should be able to use TRAPDEBUG and just do this: > > TRAPDEBUG() { ACTUAL_CMD=${(e)ZSH_DEBUG_CMD} } > > You may want some other "protection" around that, such as only doing > it when ZSH_DEBUG_CMD matches a pattern. > -- *Zach Riggle* --000000000000360b4605cb3497ce Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Will the (e) actually evaluate the parameters and execute= them again? Or just a single layer of expansion?

On Sat, Sep 4, 2021 = at 3:08 PM Bart Schaefer <s= chaefer@brasslantern.com> wrote:
On Fri, Sep 3, 2021 at 10:38 AM Zach Riggle <zachriggle@gmail.com> wrote:
>
> > What exactly might you want captured?
>
> Very frequently I build a create an array that contains a command [...= ]
> And invoke it like:
>
>=C2=A0 =C2=A0 =C2=A0"${cmd[@]}"

Given that you're doing it that way (rather than say "eval" i= t), you
should be able to use TRAPDEBUG and just do this:

TRAPDEBUG() { ACTUAL_CMD=3D${(e)ZSH_DEBUG_CMD} }

You may want some other "protection" around that, such as only do= ing
it when ZSH_DEBUG_CMD matches a pattern.
--

Zach Riggle

--000000000000360b4605cb3497ce--