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 3960 invoked from network); 28 Jul 2021 09:39:34 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 28 Jul 2021 09:39:34 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1627465174; b=iflhqujir+jLK8+LcWJIX4cllgFkW2bCmK8u6J1WZgO5mXNKkvkQ/CI8yNr3r3e1fAhUDsJdkD 0kdhhu5WEaOmM7lHDx9NvUqR2lRJZ9eFiuMtZawTUm+HSe14PZyZwEWvtS7rSJNeNEaK0W2Grt 1l/Miq+KB7kNmRpqU6PHll8SX80rbkuvmNd0+ItGnbLhHINplv7ioFwLJsD85jhCSpxgiNcR6A 7GKELoeDLQvU+fwP2hl7d60TvPyk0MMRhaECUb+B2cPeHC+1qiLxoaS32rpvCAGCKzRsZ5g/Ca 5f8UsQXpn2QuOsi9ZcgoF+/RrsGwezDUpTUYUrnndHSBCw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (snd01004-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.20; 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=1627465174; bh=1VMsVa9OviRfRB9BPB7ei/pcPjn3D/LFQy/lPLMPkIA=; 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=lT5QyXaIiWacu9yrLOA6lgAgPXkh4P+XJI9eHGaHdPANVmMkw+34qRO5W0WCPy2sow/efns4hd uCpRI7ZwOAHJoU1m69tf2iPkXD9azKyN+QcH2bMYFm3ackKop1TwWIcfqccabDOE3yX8LMk8/D W4idq9bCy+W5zDWBwaNC3zXzje8KDVnUuD8+yPiOwp+DIQko0wA9pmEoLOAmlWf3IqpyPHw+7B YzIQYXN4nNRR8dB1C11NiXS1tz5BeyMZ6Zjr67JVG8bI96LSeOkmJyLikfh4JrhnmCwfhncCnY uFVXqg47yaJYE80piUWleffzFXx3eXvGC2B9G36KWOnviQ==; 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=raHVoxySIrbW6uK7O0vsQ7fjEiSvI/CTB8Ll2kVwh/o=; b=Tj5XcGBArV2K/ji/ulp1bVBmod uhbMG85tV+U/LcxaIyMJ38y6Rt+mEqpCfhcw3SoQp15BXeZMLlq/nGdMpVzm9gczhL3KK2VGxX4nE ye1vo+KDk66NJ1QF7lpTxrDLGgw/5vWLl/aELigCPeRUS+JdcV78XbNeA1f+lCYLvxKLcZD2sanOZ L5zwJ4fPGH9ObCe2gbvfjsbjZR743SpFi3T8UqPAAtSgUjgqze/yyvVKneoCj1otH79/Hj6+qRsIy ReFXdSoC5MmukvrHAkbLVvgIYw3G1WyPmW2flTrSBJfpnGDjsphKF8hr+L2ON+kMDrOcp5yQMaJfu NguGks7g==; Received: from authenticated user by zero.zsh.org with local id 1m8g2H-000Pq6-DV; Wed, 28 Jul 2021 09:39:33 +0000 Authentication-Results: zsh.org; iprev=pass (snd01004-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.20; dmarc=none header.from=kba.biglobe.ne.jp; arc=none Received: from snd01004-bg.im.kddi.ne.jp ([27.86.113.20]:53088 helo=dfmta1003.biglobe.ne.jp) by zero.zsh.org with esmtp id 1m8g1i-000PZG-HP; Wed, 28 Jul 2021 09:39:00 +0000 Received: from mail.biglobe.ne.jp by omta1003.biglobe.ne.jp with ESMTP id <20210728093854553.FGWV.41409.mail.biglobe.ne.jp@biglobe.ne.jp> for ; Wed, 28 Jul 2021 18:38:54 +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 18:38:53 +0900 References: <8FC07840-27C0-48AD-A8AF-120924B44491@kba.biglobe.ne.jp> To: zsh-workers@zsh.org In-Reply-To: <8FC07840-27C0-48AD-A8AF-120924B44491@kba.biglobe.ne.jp> Message-Id: <2DB7CAE3-29F6-41C2-95CE-687CD5E6BA92@kba.biglobe.ne.jp> X-Mailer: Apple Mail (2.3445.104.21) X-Biglobe-Sender: takimoto-j@kba.biglobe.ne.jp X-Seq: 49209 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/27 12:57, Jun T wrote: >=20 > The case in workers/48091 is more obscure for me: >=20 >> autoload -Uz compinit; compinit >> zstyle ':completion:*:functions' ignored-patterns = '[[:punct:]]*[[:alnum:]]*' >> zstyle ':completion:*:options' matcher 'b:-=3D+' >=20 > First _main_complete:218 calls _complete, but it fails (returns 1); = why? It fails because _functions (the last command run in _typeset) fails, and _functions fails because there is no functions whose name starts = with '-'. Not calling _functions when completing options (as in my previous patch) solves the problem, but I think it would be better to correctly set the return value of _typeset as in the patch below. If return value is correctly set, the previous patch - else + elif [[ $PREFIX !=3D [-+]* ]]; then 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 '+'). Also added state_descr to the list of local parameters. diff --git a/Completion/Zsh/Command/_typeset = b/Completion/Zsh/Command/_typeset index aecacb112..be1fc7e85 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 @@ -86,31 +86,31 @@ 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 - else - _functions + _wanted functions expl 'shell function' compadd -a args && ret=3D0 + elif [[ $PREFIX !=3D [-+]* ]]; then + _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