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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24449 invoked from network); 29 Mar 2021 20:06:27 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 29 Mar 2021 20:06:27 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1617048387; b=Y8ndXWXdSQczgOtq03I1vYHAgazJC9ZoV5OatA3lVnv7k5uAoQFG878Q2MbNyH+cvakCg0kiQK g+FNkEWlIpKJS1GflyB3FJ2U4ceWlgsiTYPptjSKNCFq70MpIZ9Ytie0WjbBmW7mzUBR2nHx2+ SyD6Uu2MB80RcJ+KU+LMr1TwwJpbXCzc86GEHdN5iQ6yViGmVJMzUWkIn2Xt1YaXjrxH6o6CYi +gtE+gaOUjN3/CL9zHvQ3nbEiKftvaHiFyWdbFzgVaJzJUiw5XwDvsXs+H7oiIPsmZVs+HcL9Y VC6AsBcQ38r9bRCqnxrg29hCimRufwdhPrDvrTyUAv7LEg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out5-smtp.messagingengine.com) smtp.remote-ip=66.111.4.29; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1617048387; bh=V7B6pF4anR/E3CwYM4PdWrD+1btjtX+xu2Eb8SbaO2E=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Subject:Cc:To:From: Date:References:In-Reply-To:Message-ID:MIME-Version:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=VfNvTfHyQfoD5KQ11ybq8wkZG/5D/XUm7wR1OE4RRk+LxF2yQC677hDLr2dP6w1MKDb+EqijZD ZgtiC4FwQxy+DeFVs5pFLD6kxHBdfgzdA7bh4DBbiGFyrLQGVFz4EXwekXMgPA24mPlQu5bN2k 5ncBivdJ7+HPfI9CfnnaZnQPD7Nu3ZD/lo81oqG+KBaQzyTaPE2Y7td7vrVPySQ1DftElQABKu LEAuEA2HqsjzPBF7OItgsvjLFIRNw+MceSagijVqfEagTr8CEXgbg0pj/0LNylZMw9riT6J98/ YZq6Bka9ezLTuug9DALrK0o5Qq6Idvvi4DQiSO1q8EoZGw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:Subject:Cc:To:From:Date:References:In-Reply-To:Message-Id: Mime-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=40E+8B17y2M+aeE0MNvRLuEphj129q1N4/yaINkaGY0=; b=C8IyBRlb75V0lWIMwZJSA4o5VQ pPIMR7O8F+XK0acjjlCVuZ44zqqmWmwW4xUSSYzirs6tgkx1owh8oFdX685gaMCe9WC+3tblmuO8b YOM6NUq8iSZGcWQufI51OfCGOYebSSAWvwU1lwmfOtXJICdbHTM120GrDguzmb2gbnFj6pq+xkH64 V3vdFfsxaL4LF7O44Wa2L6LFfYbp0Dtq5BQUUCIHuDv2UCY0Z1Jp26jK7iQgCdUeY1s9RaYEMJVIb DxjFp0f4UKq7A52szNNYUqkNFfcGw5PNf0DpFWsdOH4ERuLQ8MOF0IxH9GJVEM1D0FlzUE3W1aw3U nlBa99uw==; Received: from authenticated user by zero.zsh.org with local id 1lQy9Z-000I1Z-9j; Mon, 29 Mar 2021 20:06:25 +0000 Authentication-Results: zsh.org; iprev=pass (out5-smtp.messagingengine.com) smtp.remote-ip=66.111.4.29; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from out5-smtp.messagingengine.com ([66.111.4.29]:47341) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lQy9L-000HsR-Ss; Mon, 29 Mar 2021 20:06:12 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 21CAF5C014B; Mon, 29 Mar 2021 16:06:11 -0400 (EDT) Received: from imap37 ([10.202.2.87]) by compute3.internal (MEProxy); Mon, 29 Mar 2021 16:06:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=mime-version:message-id:in-reply-to :references:date:from:to:cc:subject:content-type :content-transfer-encoding; s=fm3; bh=40E+8B17y2M+aeE0MNvRLuEphj 129q1N4/yaINkaGY0=; b=QCowya1AGDXhEmZLO3xhNtDnrKUJD4lxy0HB00Isxs 0ur6HNabS0OSCbqbiZzUFCKXCrzk0KWDfLWJbwPQYtPPAKglNLonX1Mjs+Tl8FVQ nNdB9fYFczZw7/7Tnmi/I2wo7s9v7dudBAT89OSs9MW7Lc5lzyJyE1fPQ1XQmkuy EIY+OQaA1muovbY1XwQJqkF1Jm2qnZ1l64U7TzoRGzlOWbeHKC47/C1z41YF0mNL WvZ5HvK2OIk1QOUXZ2tj9H+VkVKPRf0nRgemOFDt3cwZfCdiSghu1Ok21ZZbYUpa lBPIMME4OSmZMjUesBp9vz4Oatf9itHqY/23cokmdewg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=40E+8B17y2M+aeE0MNvRLuEphj129q1N4/yaINkaG Y0=; b=cFtqUw2uLon0kA+HfPTz0qIE1rrBKT6sPtQ5E4myLaKKYMdI+s39I9GS+ gFW1iGsLxxCM7E49JJmrZe9hmQiEeVTPZUbAeZ6o2JO47fSFeISkDajmz4z97JF2 LTTuhtr/g+cQRjn6J/kkgWOpIpFNJsh/gze7Jn0hpub+CkK1k9GlUNzxYixvar2j Q56JmTY3+e3rhpSWKstKT+PfpY1MgMN9rLqvpWbsMQ7RFQwD4v9qg/BBPMDXiXCp XaSrZL1pUczQ0v0RdkCnSQxv1jPfXB65qWG4V7k4wRTnGyb/Exfojcz+bhYwb8PL I/ZRI39sVVHq+PIObTOjUsTk17kMg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudehkedgudegiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdff rghnihgvlhcuufhhrghhrghffdcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrg hmvgeqnecuggftrfgrthhtvghrnhepfefhkeefveeileelheeiffdtkedujeelvdfhtdej tdeggedvuefffeelhefhvdfgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepugdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id C8A5D6B40061; Mon, 29 Mar 2021 16:06:10 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-273-g8500d2492d-fm-20210323.002-g8500d249 Mime-Version: 1.0 Message-Id: In-Reply-To: References: <20210329073913.GP18178@tarpaulin.shahaf.local2> <20210329171120.GA6044@tarpaulin.shahaf.local2> <20210329181452.GB6044@tarpaulin.shahaf.local2> Date: Mon, 29 Mar 2021 20:05:38 +0000 From: "Daniel Shahaf" To: "Marlon Richert" Cc: "Zsh hackers list" Subject: Re: Feature Patch: Use completion to view parameter values Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 48334 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: Marlon Richert wrote on Mon, 29 Mar 2021 20:00 +00:00: > On Mon, Mar 29, 2021 at 9:14 PM Daniel Shahaf = wrote: > > And in Marlon's patch with the ${(t)=E2=80=A6*special*} exclusion by= passed: > > . > > % zstyle \* extra-verbose yes > > % AUTOFOO=3D42 > > % echo $AUTO > > AUTOFOO -- 42 AUTOINCREMENT -- 2 > > AUTOFOO -- 42 AUTOINCREMENT -- 4 > > > > Yes, it does actually increment the variable twice, probably because= the > > _parameters patch uses both ${(t)${(P)}} and then ${(P)}, and the fo= rmer > > does an increment too: > > . > > % echo $AUTOINCREMENT ${(tP)AUTOINCREMENT} $AUTOINCREMENT > > 0 array-special 2 > > % >=20 > Hm, that made me realize that using ${(tP)=E2=80=A6} is wholly unneces= sary, > since _parameter already uses $parameters anyway. So, here's a new > patch that uses $parameters instead of ${(tP)=E2=80=A6}: >=20 Yes, using $parameters[AUTOINCREMENT] doesn't increment it. > commit 5ef8fcaabe243c8c4e04de92e1f971543470ce87 > Author: Marlon Richert > Date: Mon Mar 29 22:56:34 2021 +0300 >=20 It's better to post git-format-patch(1) output than git-show(1) output because the former can be fed to git-am(1) but the latter can't. (Unless that has changed since I last look? It's rather like today's xk= cd=E2=80=A6) Also, your previous patch was hard wrapped, so it couldn't easily be applied. It's best to send patches as an attachment named *.txt (unless= you look up your MUA-specific way of saying "Don't munge whitespace in the body in any way"). Cheers, Daniel > Let `zstyle extra-verbose` show parameter values >=20 > When completing parameters and > `zstyle -t ":completion:${curcontext}:parameters" extra-verbose`, > display values of non-special parameters as descriptions. >=20 > diff --git a/Completion/Zsh/Type/_parameters b/Completion/Zsh/Type/_pa= rameters > index 207e5cf78..b32e049f7 100644 > --- a/Completion/Zsh/Type/_parameters > +++ b/Completion/Zsh/Type/_parameters > @@ -6,13 +6,18 @@ > # If you specify a -g option with a pattern, the pattern will be used= to > # restrict the type of parameters matched. >=20 > -local expl pattern fakes faked tmp i pfilt > +local MATCH MBEGIN MEND \ > + disp dopt expl fakes faked i matches pattern pfilt sep tmp >=20 > if compset -P '*:'; then > _history_modifiers p > return > fi >=20 > +_tags parameters > +( _tags && _requested parameters ) || > + return > + > pattern=3D(-g \*) > zparseopts -D -K -E g:=3Dpattern >=20 > @@ -32,8 +37,19 @@ zstyle -t ":completion:${curcontext}:parameters" > prefix-needed && \ > [[ $PREFIX !=3D [_.]* ]] && \ > pfilt=3D'[^_.]' >=20 > -_wanted parameters expl parameter \ > - compadd "$@" -Q - \ > - =20 > "${(@M)${(@k)parameters[(R)${pattern[2]}~*local*]}:#${~pfilt}*}" \ > - "$fakes[@]" \ > - "${(@)${(@M)faked:#${~pattern[2]}}%%:*}" > +_description parameters expl parameter > +compadd "$expl[@]" -O matches - \ > + "${(@M)${(@k)parameters[(R)${pattern[2]}~*local*]}:#${~pfilt}*}" \ > + "$fakes[@]" \ > + "${(@)${(@M)faked:#${~pattern[2]}}%%:*}" > + > +if zstyle -t ":completion:${curcontext}:parameters" extra-verbose; th= en > + zstyle -s ":completion:${curcontext}:parameters" list-separator sep= =20 > || > + sep=3D-- > + zformat -a disp " $sep " \ > + =20 > ${matches[@]:/(#m)*/"${MATCH}:${${parameters[$MATCH]:#*special*}:+${(P= kv@q+)MATCH}}"} > + disp=3D( "${disp[@]:/(#m)*/$MATCH[1,COLUMNS]}" ) > + dopt=3D( -d disp ) > +fi > + > +compadd "$expl[@]" $dopt -Q -a matches > diff --git a/Test/Y01completion.ztst b/Test/Y01completion.ztst > index 571f3cf16..e5901b8e5 100644 > --- a/Test/Y01completion.ztst > +++ b/Test/Y01completion.ztst > @@ -222,7 +222,7 @@ F:regression test workers/31611 > comptesteval "zstyle ':completion:*:tst:*' ignored-patterns 2" > comptest $'tst 1,\t' > comptesteval "zstyle -d ':completion:*:tst:*' ignored-patterns" > -0:-F doesn't break _sequence > +0:-F doesn=E2=80=99t break _sequence > >line: {tst 1,}{} > >DESCRIPTION:{desc} > >NO:{2} > @@ -237,6 +237,28 @@ F:regression test workers/31611 > >FI:{file1} > >FI:{file2} >=20 > + comptesteval "bar=3D({$'\\0'..$'\\C-?'}); baz=3D\$bar" > + comptesteval 'zstyle ":completion:*:parameters" extra-verbose yes' > + comptest $': $ba\t' > +0:extra-verbose shows parameter values > +>line: {: $ba}{} > +>DESCRIPTION:{parameter} > +>NO:{bar -- '^@' '^A' '^B' '^C' '^D' '^E' '^F' '^G' '^H' '\t' '\n' > '^K' '^L' '^M' '^N} > +>NO:{baz -- '^@ ^A ^B ^C ^D ^E ^F ^G ^H \t \n ^K ^L ^M ^N ^O ^P ^Q ^R= > ^S ^T ^U ^V ^W } > + > + comptest $': $path\C-D' > +0:extra-verbose does not show special parameter values > +>DESCRIPTION:{parameter} > +>NO:{path} > + > + comptesteval 'zstyle -d ":completion:*:parameters" extra-verbose' > + comptest $': $ba\t' > +0:parameter values not shown without extra-verbose > +>line: {: $ba}{} > +>DESCRIPTION:{parameter} > +>NO:{bar} > +>NO:{baz} > + > comptesteval '_tst() { local disp=3D( {a..z} ); compadd -ld disp > $disp[@]; comppostfuncs=3D( _pst ) }' > comptesteval '_pst() { local disp=3D( > "$compstate[insert]" ); compadd -Qld disp $disp }' > comptesteval "zstyle ':completion:*' menu select=3Dlong-list" >