From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 650 invoked by alias); 5 Jan 2018 14:54:36 -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: List-Unsubscribe: X-Seq: 42228 Received: (qmail 28762 invoked by uid 1010); 5 Jan 2018 14:54:36 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net 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(205.235.26.22):SA:0(-1.4/5.0):. Processed in 1.980129 secs); 05 Jan 2018 14:54:36 -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=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS,T_DKIM_INVALID,T_RP_MATCHES_RCVD autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=bkm2=EA=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1515164058; bh=LzbNnQNAffK+3W82hDdZfwvVVt3S0DWtb22fcYcxcJc=; h=From:References:To:Subject:Date:From:Subject; b=jHvANcp5dqRYoS+tlZEIQavORXlfwnmIl4jjjs+tnjISad+d8tTDzyTV4jYabGObPnQtWdBalOuGmb4kRK/DlRZL1rF0MbI0YD2+ZMe1/2CGsXABDm0A46dIW7WSmBIu4Hy5CRaHvhSLlDBJbCnA/5xATsXyMERWOjRf1Gt0jEL53s+xk8MAORhr+nAhmmXyFO3k4TOvHrZDT/PW7bQqXhLBChBZDWQmiOeweMzsT3PBT3MOh7YkfYF3kYCg/LowyYoQkW7t21Du6Muaufqp4hlprvlptWkIopNUn6V/N6tbLdGqBg2sjV2HVqZb9rl4nIoGr7a3Tt48WFkDMovBYA== X-YMail-OSG: lBjkgp4VM1kmsYAq5tiz1kdKqXL6F0YeW6hmeFI2QbpZuuEd2MofuDeXYZWhm9. 7UYa_JqPfN48UMtFKZ._1IFXN4itGQmwFOKe2ig08jwighD1fXJCEakqa_4d1unUrEPTNrxZilUe 20OjMOINkwa5MBe0gdJDUbObbebmPV76Cf6rdyofc30h94Svyh1sFPDLWoNYPdr3d9iIxr_sLijM MWp7WsuhHTmBBfm.1QGCLa7xZTYORO6QnYn5TP4bOjbB8OEAQrIMFQKTxcNgdc9.HgOyHztFgE.q ZnYcde9pg6c2GeHVrXqOpR66c.Mf1d.nTny_JdAOJiHlt5Xr0XYOiA_9DfCa6mFmQEuLXVe.dkT0 YWo9hUHebRhMaWQzUNRmApLTE._U9jjNaEFwM1QQIpIOmjJM2hwaHj.bzLOd9qwmUUvzy_nfMIHs f0WPw7soPicEXjhaPKryGFHvMqjx9UJ1GH3pSVZ9kHSvCGl357BisA84o_GGHB0gwm5Z5 In-reply-to: <0ED247D6-B6E3-40AB-A59D-DDEFC4083BEE@dana.is> From: Oliver Kiddle References: <0ED247D6-B6E3-40AB-A59D-DDEFC4083BEE@dana.is> To: zsh-workers@zsh.org Subject: Re: [PATCH] Completion batch #4: New UNIX functions MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <24752.1515164052.1@thecus.kiddle.eu> Date: Fri, 05 Jan 2018 15:54:12 +0100 Message-ID: <24753.1515164052@thecus.kiddle.eu> dana wrote: > new functions belonging to the 'Unix' group. None of them are particularly Actually, I think sublimetext belongs under X. X is supposed to cover anything that needs a GUI so stuff like acroread, netscape, matlab etc are there. I've also called it _sublimetext rather than _subl which is how things are normally named. > As always, let me know if you see anything i've done weird. I've tweaked the other functions to remove superfluous local statements and correct the return status in one case. _arguments' local requirements are unfortunately somewhat confusing: If you don't use states (:-> syntax) no extra variables need to be declared local. If you do, you need to declare context, state and line local. state and context are arrays and you should loop over them calling, _wanted -C "$context[1]" as appropriate. However, in the vast majority of cases, it is only ever possible for state and context to have one element in them. You need something like optional arguments for multiple simultaneous states to be an issue. In this case, as a simplification, you can call _arguments -C and instead of using context, $curcontext is modified directly with the context for the one state. For this to work, you need to preserve the existing value, hence this usage: local curcontext="$curcontext" state line opt_args ought also to be declared local but we tend to be lax about that. state_descr is a relatively new addition and most functions predate it. I tend not to bother. With the return status, it is key to remember that if people unset the prefix-needed style, _arguments is likely to add matches and return a state so don't do: _arguments -options '*: :->state' && return the common && ret=0 idiom works for this case along with an explicit check that $state is set. Oliver