zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zach Riggle <zachriggle@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: TRAPDEBUG vs zsh -x
Date: Wed, 20 Apr 2022 16:55:54 -0700	[thread overview]
Message-ID: <CAH+w=7Ywp-8fciUvKFJaSnn5jstb10P-Auw+0F4Pxd9buzZ+eA@mail.gmail.com> (raw)
In-Reply-To: <CAMP9c5mQwVU4e7z9aHDx8g4vd9hRZuf+Zq3yMCLia6ewv8sQzA@mail.gmail.com>

On Wed, Apr 20, 2022 at 12:46 PM Zach Riggle <zachriggle@gmail.com> wrote:
>
> When using "zsh -x", we see all of the lines after they've been fully evaluated, but there's no way to add syntax highlighting sugar to these lines.

If you have a colorizing program that you want to use, you can do

# Silly example of colorizing
alias colorizing="grep --color '[A-Z]'"
exec 2>>(colorizing)

and the xtrace output will go through that.

> Are there any TRAPXXX functions which are passed the same text as "zsh -x" will emit (sans the $PS4 expansion).

No, there aren't.

You could play around with variations on this hack:

unsetopt DEBUG_BEFORE_CMD
PS4=
emulate zsh +x -c 'exec {stderr}>&2
 preexec() {
  integer in_preexec=1
  exec 2>>(colorizing)
 }
 TRAPDEBUG() {
  ((in_preexec)) || exec 2>>$stderr
 }'


  reply	other threads:[~2022-04-20 23:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20 19:46 Zach Riggle
2022-04-20 23:55 ` Bart Schaefer [this message]
2022-04-21 18:42   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7Ywp-8fciUvKFJaSnn5jstb10P-Auw+0F4Pxd9buzZ+eA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zachriggle@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).