From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9585 invoked by alias); 14 Sep 2017 06:54:25 -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: X-Seq: 41700 Received: (qmail 1381 invoked by uid 1010); 14 Sep 2017 06:54:25 -0000 X-Qmail-Scanner-Diagnostics: from out3-smtp.messagingengine.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(66.111.4.27):SA:0(-2.6/5.0):. Processed in 3.126681 secs); 14 Sep 2017 06:54:25 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=BMQMkaSsCh8/9hpCQ2 P2rne149LT63juDkTZe/k2QaM=; b=eGQOLDuGMjikg2Z7RHWEz2u9pODSF76duh QuoGjHiE2JvBQ5i0wiKW0QYsPMb0rsPetcax58qq+EyqXyoD7BoP2xcpjnvlyKKe QDGNeuRrTLW39yBiwjuHF1ZQmKQuVjA0IbJ8pI3z4pqVDIwkefLoNCP6shV9C0/K TnxmdBDlr1M8qRM41+wCas6GeQMekX1KwpGduZ8l+4IqoRkNzhsnyE31HKmZeW9G yAu9SfdKgReU0rXHPiyh/fmrA6netvYTmeMoZWqmpbWs2uDOVla+v+fRDhvEL3hf JthPqDhr+icu1tWy9vSiVeVuH3dHiYTYQPcBJj0Iex23Gg4g5i8Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=BMQMkaSsCh8/9hpCQ2 P2rne149LT63juDkTZe/k2QaM=; b=h/VVCeBvjMHSN+rAcqMnJbYNYdeNUfvcJd fRpBaXWDmuufeEWt6yFGxLoWgOdnA3VZ5FH/LhwwMOissiyhp4faVweINuRE2COO yvctCMmEvMdn8VcOIwYZ9cZBeLemXE2xxcRZrCntCnEu207xf5tAg3afFIT7Wj8w 9eGhW2B3YjC7Bu/TDD5lbLAHTEp+fAMnpc6ECJo6HJuq7YVHrJwYak6ZJO4b1LkQ WTseXO4BNUERquzSREUF7sx5gZ7FYKyxFHZNYz6crJtxKm3md+HpUCvTYcKFflnb /EfOF9MUcCWDbHM0fFlkfpt0ov8hbhRDdlVduS3ocnOXj+pFqygw== X-ME-Sender: X-Sasl-enc: 2e2Wm6nsgovQ9l4Nq+5Zoumr70+Q+Ed0DwPtcC4hGHhR 1505372058 Date: Thu, 14 Sep 2017 06:54:17 +0000 From: Daniel Shahaf To: Zsh hackers list Subject: 'typeset -p' of assocs (was: Re: PATCH: [key]=value syntax, work in progress) Message-ID: <20170914065417.mbwmxpdkz33wjm56@tarpaulin.shahaf.local2> References: <20170911215115.6aa27dec@ntlworld.com> <20170912212519.3d873212@ntlworld.com> <30374.1505294044@thecus.kiddle.eu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="qok47dnjkmvdybkb" Content-Disposition: inline In-Reply-To: <30374.1505294044@thecus.kiddle.eu> User-Agent: NeoMutt/20170113 (1.7.2) --qok47dnjkmvdybkb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Oliver Kiddle wrote on Wed, Sep 13, 2017 at 11:14:04 +0200: > It would be good to make typeset -p output use this new syntax by default > for associative arrays because (without other cues like alignment) it > can be clearer which items in the list are keys and which values. I've been using a local patch that prints one space between key and its value, but two spaces between value and the following key: % typeset -p color typeset -A color=( 00 none 01 bold 02 faint 03 standout 04 underline 05 blink 07 reverse 08 conceal 22 normal 23 no-standout 24 no-underline 25 no-blink 27 no-reverse 28 no-conceal 30 black 31 red 32 green 33 yellow 34 blue 35 magenta 36 cyan 37 white 39 default 40 bg-black 41 bg-red 42 bg-green 43 bg-yellow 44 bg-blue 45 bg-magenta 46 bg-cyan 47 bg-white 49 bg-default bg-black 40 bg-blue 44 bg-cyan 46 bg-default 49 bg-green 42 bg-grey 40 bg-magenta 45 bg-red 41 bg-white 47 bg-yellow 43 black 30 blink 05 blue 34 bold 01 conceal 08 cyan 36 default 39 faint 02 fg-black 30 fg-blue 34 fg-cyan 36 fg-default 39 fg-green 32 fg-grey 30 fg-magenta 35 fg-red 31 fg-white 37 fg-yellow 33 green 32 grey 30 magenta 35 no-blink 25 no-conceal 28 no-reverse 27 no-standout 23 no-underline 24 none 00 normal 22 red 31 reverse 07 standout 03 underline 04 white 37 yellow 33 ) I think I posted it once, but here it is again. Cheers, Daniel --qok47dnjkmvdybkb Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Print-two-spaces-in-typeset-p-of-assocs.patch" >>From 714da4bb3a26957cbd65058f7fb4afca85f82ee2 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 28 Sep 2016 13:15:04 +0000 Subject: [PATCH] Print two spaces in 'typeset -p' of assocs (tweaked for upstream 39704/0f5e670cde5f844680a20f986786249dfe983584) --- Src/params.c | 6 ++++-- Test/V10private.ztst | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Src/params.c b/Src/params.c index ef72cba44..39af27c40 100644 --- a/Src/params.c +++ b/Src/params.c @@ -5298,6 +5298,7 @@ printparamvalue(Param p, int printflags) if (!(printflags & PRINT_KV_PAIR)) { putchar('('); putchar(' '); + putchar(' '); } { HashTable ht = p->gsu.h->getfn(p); @@ -5309,9 +5310,10 @@ printparamvalue(Param p, int printflags) putchar(')'); break; } - if (printflags & PRINT_KV_PAIR) + if (printflags & PRINT_KV_PAIR) { putchar(' '); - else + putchar(' '); + } else putchar('\n'); } diff --git a/Test/V10private.ztst b/Test/V10private.ztst index 7ebf5a87f..d1d9b0887 100644 --- a/Test/V10private.ztst +++ b/Test/V10private.ztst @@ -128,7 +128,7 @@ print ${(kv)hash_test} 0:private hides value from surrounding scope in nested scope >typeset -a hash_test=( top level ) ->typeset -A hash_test=( in function ) +>typeset -A hash_test=( in function ) >typeset -g -a hash_test=( top level ) >array-local top level >top level --qok47dnjkmvdybkb--