From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18236 invoked by alias); 18 Jul 2016 09:54:23 -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: 38878 Received: (qmail 24305 invoked from network); 18 Jul 2016 09:54:23 -0000 X-Qmail-Scanner-Diagnostics: from nm25-vm4.bullet.mail.ir2.yahoo.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(212.82.97.37):SA:0(0.0/5.0):. Processed in 0.130859 secs); 18 Jul 2016 09:54:23 -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=0.0 required=5.0 tests=FREEMAIL_FROM,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: okiddle@yahoo.co.uk X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.mail.yahoo.com designates 212.82.97.37 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1468835278; bh=BqmF/fPcGlNUfDMLRFsOGhsbNOqCy7/EIkqM6Q9HhYE=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=jm8pH5iJ7orwdxg4DqPaVRg0TxgEti3DpX3iFSnUMe8V1PxzdTu2NT+k3REbNcfC0zdBYC5hI0G0d946HpLSugrXIw23a/S3AHWGBc1kgVX8SLrpv/hsAgdPMFe4cTANc49/Vae4BGa/NhRc08FVBtcfnCGLjczdXc3ET21mNsU3qjZgy1mWd/59W85ZD/WF5Vwu8Slk6AjP6e3n0DcU6qgjhj3i9ozhx3JYBWpl3Vdwh7fhCAgnTdN9SbfjTC+5+hOy5O89GbRLU8qXDJDXLGWUGKleL6yyP9A9n4ydsF1Tulqu6pRKWU0TkAll/6MpfbHHKKEaM50Mi83YtwE/XQ== X-Yahoo-Newman-Id: 426669.46383.bm@smtp121.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: QdDIVy4VM1kRtLo39kkCZ_uMiyTHKcXPP81kgWcjasONGPe T.eJnLWBMMkHhCGazdnd5fcXO4.uFaKHXIt04FEg6H0Mwl0Oe9fW4WefL78a WUh2nlYh1RNBGY_3cyYE9DBTVQDO0cudiSm1E6gbWoScDOKPx3sY9O8v1njr DIm3A96VgbopS2vr5zO_sfcS8uZ1SHPDruWb9w6F8HF6s1zuEE45wUkFs9D6 Iot5latR6AUtPfyLdSrJcVF9AyUXfzYJML16DRVTiff8IkXN9aKQ7xaENYsv wGdhHp_my1JneR7iDyWerlyBnPKMaRkiCWRHN0F_8mzAXzNvz4cgrfZUHsjo OZVb3PQRUg0zhbVQsvwpohBmambNmKeDtytVrREFNWVw9wANaJWCeKZdouF_ rBMtpUO4xyGgBdhYhwS3_hwvbh3gVIg3n_78Xi1ABKo2KQ2Rb5xSjztoCdZV SOM568wfCvoZBvL40WAPyCP6oODVEq9puSAexyEosorl58sVF6p26UAjiu3T sHi8tP5VgoyIBR32wpqws5SOSxRj0l_4XOkUo3wAZy3g- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: <1468767614-9635-1-git-send-email-danielsh@tarsus.local2> From: Oliver Kiddle References: <160716185103.ZM5258@torch.brasslantern.com> <1468767614-9635-1-git-send-email-danielsh@tarsus.local2> To: zsh-workers@zsh.org Subject: Re: [PATCH] _add-zle-hook-widget: New completion. MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <91350.1468835277.1@hydra.kiddle.eu> Date: Mon, 18 Jul 2016 11:47:57 +0200 Message-ID: <91351.1468835277@hydra.kiddle.eu> Daniel Shahaf wrote: > +local context state state_descr line > +typeset -A opt_args Those are only needed if you're using _values or _arguments with states. This function doesn't so that isn't needed. > + _wanted widgets expl "installed hooks" compadd -- ${tmp#<->:} && return 0 The description should be singular - "installed hook". Even if you can specify a list, they are only completed one at a time. > + else > + _wanted widgets expl widget compadd -M 'r:|-=* r:|=*' -k widgets && ret=0 && return 0 > + fi > + return 1 ret was not declared local so ret=0 should not be there. Actually, all this messing with return codes is superfluous. Given an if..then..else block, the last command in either branch determines the final return status. If you have '&& return 0', the 0 is always redundant. But in this case, no return statement at all should be needed. Also, Bart suggested: > compadd "$@" -M 'L:|zle-=' -a hooktypes That L: form makes the zle- a sort of optional prefix. Is that what you intended? Unfortunately it doesn't work together with -M 'r:|-=* r:|=*' and zl won't complete. 'B:zle-=' is a shorter version of the same thing. It might be better to do: compadd "$@" -a hooktypes || compadd "$@" -pzle- -a hooktypes Oliver