Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Line numbers and debugging verbosity
- X-seq: zsh-users 23327
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Line numbers and debugging verbosity
- Date: Sun, 8 Apr 2018 22:19:44 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=FjqfeS+VQvMTaJoKM7KrpDC6K0mxdfXm3uIVVNeooAU=; b=DT1cdZfK9mY44YCXHycehw4FtoX6BI9aC5c37eXEqtKRsJAJXzYKMoNEnFFstL7tys MVkOn0MoskgfOQeu31xsmH54EFaEuoRYneUAlihSh7xn3AE+r2Ouwv4c0d21DCoJ3HKt pUc8G+GWkDFI2wkDrUprYgHQIXyfEc6GJVvyv3I93O5WAXHC2YUEpNecahvy3d3percd zoxGorsrWu4+JxL/sD++UFMWG1tNN8FgQ+VyG1f0tXi61sAIus7+NR4RyHx5oggOHMM9 ZytWcDHANmEIN0xC4NU63vz8gcT5YbOThyKgiKrsFq1/+xxQUoAhahYKIk7G2Ig4xr9e iEMw==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
On Fri, Apr 6, 2018 at 9:29 AM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> What I'm actually trying to do is reduce verbosity of a function by
> redefining various message printer functions as null. It works fine with
> functions, but if the message printers are aliases (which seem to be the
> only way to get: ${(%):-%x %I} ... line information printed, it seems that
> can't be done in a function) ... then it goes sour.
On Sun, Apr 8, 2018 at 3:38 PM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> Is there a new strategy that might work? Nullify the function and/or the
> alias? Really, just some way of stopping messages from printing at all?
There are several possible approaches. For one, you could stop using
your own "echo"/"print" statements and instead turn tracing on and off
for the surrounding function:
functions -T test1
If you want to keep printing your own messages instead of using the
xtrace facility, let's get you away from aliases. The information for
%x and %l are in the $funcfiletrace variable, and will give you the
result you want from inside a function.
warningmsg() {
print -n "${funcfiletrace[1]}: " && magline "$*"
}
For another approach, you had a perfectly good example:
> [[ "$vverbose" < 3 ]] &&
> {
> warningmsg () { ; }
> }
Just put a similar test in the definition of "warningmsg" e.g.
warningmsg() {
(( $dbg )) &&
print -nr - "${funcfiletrace[1]}: " && magline "$*"
}
Now you don't have to modify the function, you just assign dbg=1 or dbg=0.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author