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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13999 invoked from network); 28 Jul 2021 11:14:11 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 28 Jul 2021 11:14:11 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1627470851; b=febWTxjKK6/62ouhZvrYnOIx7GA3cXcrtWFGQHacGpAVOc+/nLVvDkB+m/GL4Rqpvvgoy42/IG I5si2r6G68z0qc7BFEZ5fiThHjn1rt8PVlCH2DRTX0UeuqXJfolm/KhX2DCShxohFXy3wl4cE3 OANLMllOPgmK1P3/q0Nzod1JF3vmTt0hH2O58cNf73QV/+Zz+H9rvOsBGuQWNe5nRYfC0LdLgJ UDg+gnMCZtJrj1CbvywXo2XditPiBFIKjHxkx6gdKJ8O2BUUQjt0ZmC1BkvFRWbfo3mv4ujE1z wA4PbTYSIs5Y0XricGZFOYyWZXXnPHqDdJRmO83+39dqhg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (snd01001-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.17; dmarc=none header.from=kba.biglobe.ne.jp; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1627470851; bh=oT3tSCxyI/ItxtaTZP1KCXE976kSxNRBvdj4VL7PRnI=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Message-ID:In-Reply-To:To:References:Date:Subject: MIME-Version:Content-Transfer-Encoding:Content-Type:From:DKIM-Signature; b=N3oM7CHAvzUp9LW6RF2vqhjGAB3MXU3rnDmMSjbU2hqdBrKbvpR6kXq15nBpCyHKEbrwM9W7Yv QsfUNMXRqaOAQJg2fC7qYCmJ8H+BvUvgPq0BnXoxAG92JwK98BBBTBUkpzyGg9mOdrTZWmvvyu FokjylxE4br7Y0SdzQg2kV3JzN6958rGFXDVPLswTnRf6JxePf8Hadj1V0g818ry/ZXE/qasOG RL1bq3zsUInvX8sohfEoThejo+BnaSP8YJsAJr1BOOtTsnKPH4iZQBd//ash+Hzgsv9bmMoBj/ ojvsu4nvC/XZabf7fuoTKsadc59PJHCA35wZeA6x503VPg==; 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:Message-Id:In-Reply-To:To:References: Date:Subject:Mime-Version:Content-Transfer-Encoding:Content-Type:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=R+Wx2T/hqAWC+aMpZfnFuBiCoAoPz5oFwXS/5agozyo=; b=lN1FI7TVCM3YjwZ9QgGJoThzLo CoG83uOA5o2amARb0Tda4Ksw2cw7KkUtbjQgaYwT6yErsYz8VYz0W7SxtiI5tD3XiEbSUbp0uZUcb uWzOLA/RTHWX8LmbqRLj/HtCDT4dL37A7iy6KIYktaseaUViDJ1wIhyTR1Xsbu6I1Ynofn2OcaM1Y isspEvM0zC37D1CYzl9hH3w9DySXrsa8Jebrzs3JnB+Pnx9Sgx6sEMt5jsBv6dCq6YlvtgxA31tTk Qci/6XbbiXI4bVfyMWfFEPbY2RsVyMvKYk82tER99O1s94Ava6fXhepLDjt7aXW/lejFey8gFyNe8 GVN+XNug==; Received: from authenticated user by zero.zsh.org with local id 1m8hVp-0004hx-Nt; Wed, 28 Jul 2021 11:14:09 +0000 Authentication-Results: zsh.org; iprev=pass (snd01001-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.17; dmarc=none header.from=kba.biglobe.ne.jp; arc=none Received: from snd01001-bg.im.kddi.ne.jp ([27.86.113.17]:30371 helo=dfmta1015.biglobe.ne.jp) by zero.zsh.org with esmtp id 1m8hVG-0004PE-P1; Wed, 28 Jul 2021 11:13:36 +0000 Received: from mail.biglobe.ne.jp by omta1015.biglobe.ne.jp with ESMTP id <20210728111330430.FJYC.71761.mail.biglobe.ne.jp@biglobe.ne.jp> for ; Wed, 28 Jul 2021 20:13:30 +0900 From: Jun T Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: [BUG] _gnu_generic completer produces broken output Date: Wed, 28 Jul 2021 20:13:30 +0900 References: <8FC07840-27C0-48AD-A8AF-120924B44491@kba.biglobe.ne.jp> <2DB7CAE3-29F6-41C2-95CE-687CD5E6BA92@kba.biglobe.ne.jp> To: zsh-workers@zsh.org In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3445.104.21) X-Biglobe-Sender: takimoto-j@kba.biglobe.ne.jp X-Seq: 49211 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: > 2021/07/28 19:29, Mikael Magnusson wrote: >=20 > On 7/28/21, Jun T wrote: >>=20 >>=20 >> If return value is correctly set, the previous patch >>=20 >> - else >> + elif [[ $PREFIX !=3D [-+]* ]]; then >>=20 >> is not necessary, but I kept it because calling _functions when = completing >> options is just a waste of time (I assume no one would create a = function >> whose >> name starts with '-' or '+'). >=20 > You are (unfortunately) wrong about that: (snip) > I'm now seeing the stuff given by +vi-git-st() > 00:17 If I encounter a function like "function +foo() { ... Thanks. I removed the previous patch. Then: % -foo () : % functions - this correctly offers '-foo' (in addition to options), but % functions -foo functions: bad option: -f I need to type % functions -- -foo but % functions -- - offers nothing.=20 This is fixed by modifying 'onopts' so that '-' is not included in it. diff --git a/Completion/Zsh/Command/_typeset = b/Completion/Zsh/Command/_typeset index aecacb112..3f7de9706 100644 --- a/Completion/Zsh/Command/_typeset +++ b/Completion/Zsh/Command/_typeset @@ -1,6 +1,6 @@ #compdef autoload declare export functions integer float local readonly = typeset =20 -local expl state line func i use curcontext=3D"$curcontext" +local expl state state_descr line func i use curcontext=3D"$curcontext" = ret=3D1 local fopts=3D"-f -k -z +k +z" local popts=3D"-A -E -F -L -R -T -Z -a -g -h -H -i -l -r -x" local -A allargs opt_args @@ -79,38 +79,38 @@ esac # This function uses whacky features of _arguments which means we # need to look for options to the command beforehand. local onopts offopts -onopts=3D${(j..)${${words[1,CURRENT-1]:#^-*}##-}} +onopts=3D${(j..)${${words[1,CURRENT-1]:#^-[^-]*}##-}} offopts=3D${(j..)${${words[1,CURRENT-1]:#^+*}##+}} =20 for ((i=3D1;i<=3D$#use;++i)); do args+=3D( = ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[dUurRtT]]:+$func}]} ) done =20 -_arguments -C -s -A "-*" -S "${args[@]}" '*::vars:=3D ->vars_eq' +_arguments -C -s -A "-*" -S "${args[@]}" '*::vars:=3D ->vars_eq' && = ret=3D0 =20 if [[ "$state" =3D vars_eq ]]; then if [[ $func =3D f ]]; then if (( $+opt_args[+M] || ( $+opt_args[-M] && $+opt_args[-m] ) )); = then _wanted functions expl 'math function' compadd -F line - \ - ${${${(f)"$(functions -M)"}##*-M }%% *} + ${${${(f)"$(functions -M)"}##*-M }%% *} && ret=3D0 elif (( $+opt_args[-M] )); then _arguments ':new math function:_functions' \ ":minimum arguments${(k)opt_args[-s]:+:(1)}" \ ":maximum arguments${(k)opt_args[-s]:+:(1)}" \ - ':shell function:_functions' + ':shell function:_functions' && ret=3D0 elif (( $+opt_args[-w] )); then - _wanted files expl 'zwc file' _files -g '*.zwc(-.)' + _wanted files expl 'zwc file' _files -g '*.zwc(-.)' && ret=3D0 elif [[ $service =3D autoload || -n $opt_args[(i)-[uU]] ]]; then if [[ $PREFIX[1] =3D [/~] ]]; then # Autoload by absolute path - _files + _files && ret=3D0 else args=3D(${^fpath}/*(-.:t)) # Filter out functions already loaded or marked for autoload. local -a funckeys funckeys=3D(${(k)functions}) args=3D(${args:|funckeys}) - _wanted functions expl 'shell function' compadd -a args + _wanted functions expl 'shell function' compadd -a args && = ret=3D0 fi elif [[ -n $onopts$offopts ]]; then if [[ -n $offopts ]]; then @@ -127,22 +127,23 @@ if [[ "$state" =3D vars_eq ]]; then [[ $PREFIX !=3D [_.]* ]]; then args=3D(${args:#_*}) fi - _wanted functions expl 'shell function' compadd -a args + _wanted functions expl 'shell function' compadd -a args && ret=3D0 else - _functions + _functions && ret=3D0 fi elif [[ "$PREFIX" =3D *\=3D* ]]; then compstate[parameter]=3D"${PREFIX%%\=3D*}" compset -P 1 '*=3D' - _value + _value && ret=3D0 elif (( $+opt_args[-a] || $+opt_args[-A] )); then - _parameters -q + _parameters -q && ret=3D0 elif (( $+opt_args[-T] )); then _arguments \ ':scalar parameter:_parameters -g "*scalar*" -q -S "=3D"' \ ':array parameter:_parameters -g "*array*"' \ - ':separator character' + ':separator character' && ret=3D0 else - _parameters -q -S '=3D' + _parameters -q -S '=3D' && ret=3D0 fi fi +return ret