From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17001 invoked by alias); 9 Apr 2018 05:20:04 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23327 Received: (qmail 16482 invoked by uid 1010); 9 Apr 2018 05:20:04 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f53.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(74.125.82.53):SA:0(-1.9/5.0):. Processed in 15.058999 secs); 09 Apr 2018 05:20:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS, T_DKIMWL_WL_MED,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=FjqfeS+VQvMTaJoKM7KrpDC6K0mxdfXm3uIVVNeooAU=; b=cDTOFXtgV7bSDwg9ox6RDXVaYrb8yUBCUOtjf+rK5IuhxVrMBgVwSKslBZkSzLruWm zc0FWL21QNLJNv878jn+/d1gBSFRNlcnasTAix28N4Ys55wGPl8zeCX0TzzM4g4Vq9+d 4Bsmlmfwo0ke3VzOYs7S2Ex4eixWl0GXOy5aGHSpQm1MFED4yqb/RwQ/DPQwOc6U1Nc7 4SDR0hYaISqA6XcLkO7g19YzrtZcnF0d/8/zZIGARVXID91goR/kk2+P54mQPG1suMn0 zo0uj6cJEw4hPFvox9Yegfh9BIb+rNNmKeW/MQ11l8a7H30oTkJq19xumrYzzZZVAd2A HfuQ== X-Gm-Message-State: AElRT7GtPBdo9yjjmJTXE8zOkvu3oPxyRU7BhtUTls0bya6OMC4bHSsa 4FV7trcvjxV7FLuunwMFttDWcpFB9DZENXDZ8ld5zMnm X-Google-Smtp-Source: AIpwx4/2c8TMv5+zpJpQ1Oh5OwqqYD1TrcyyF0dTA+tedSMSg0qp6D1dYYT8rifeSoTyi8HpuOnM2SOYRJYI19AYheY= X-Received: by 10.46.62.12 with SMTP id l12mr21067764lja.66.1523251184900; Sun, 08 Apr 2018 22:19:44 -0700 (PDT) MIME-Version: 1.0 From: Bart Schaefer Date: Sun, 8 Apr 2018 22:19:44 -0700 Message-ID: Subject: Line numbers and debugging verbosity To: Zsh Users Content-Type: text/plain; charset="UTF-8" On Fri, Apr 6, 2018 at 9:29 AM, Ray Andrews 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 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.