From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20804 invoked by alias); 21 Sep 2011 17:16:04 -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: 29794 Received: (qmail 9894 invoked from network); 21 Sep 2011 17:16:01 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at yahoo.co.uk does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1316625029; bh=xLl4XoxcWUQC2Yv+hjAUhF93zC1bQGoZS0enCdBeqOw=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:In-reply-to:From:References:To:Subject:Date:Message-ID; b=B+xVbXPBcgdwSVBSSA/QUg/efeN4wakXPtOOzXi5XvjbKqYWJPeDY1vxTcUBr3HaYgjdCHeWzrrWnTUnkKnXhwNurF68KWYoCzMWQKTrT8v+sU2CagR1440yt+2Kee0xYBBAzY95mJDMlpXuVzr2jGaY++olrI/BfnHo4GUN3Lc= X-Yahoo-Newman-Id: 461635.50643.bm@smtp121.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: jxDjsW8VM1n9hpjUO8Ssoph6KvakmmhnnMfM3KtTjxVr63B pqMACx2LtSIFjap_FP9NOTm6WJLIbK7nFN45wytqDnk6qZoj2zNztM_wjWf1 .kYNz6qLiksMZcJQxlwhj9Uy0yJ.FXOSDGgs4KXJb9k1TXAKm1M.Zk3lKFQs pieu_lNUqMVQjzj97.rzl8z6bfjgukY16n3E4qYtKZbxzRIxUWd4VjASYHGl NLQTPVEhyQlPWP3B9TO8P9sEy7SGDZBzhLIeDIPrLQkODdF.iCenb2V2AkyA Fskz0NCKrKki7reDMBrs5tOacPLVBb1DcemEVeOjYZwKDJkSFSy.fLCnPmkv 8zYtru2e3lctuPBGB_q1e3yeYJIgVA55EOawVHl1BAg-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: <110921085012.ZM16562@torch.brasslantern.com> From: Oliver Kiddle References: <110911111050.ZM11625@torch.brasslantern.com> <17938.1316605147@thecus.kiddle.eu> <110921085012.ZM16562@torch.brasslantern.com> To: zsh workers Subject: Re: using the description from _arguments foo:description:->state Date: Wed, 21 Sep 2011 19:10:28 +0200 Message-ID: <20002.1316625028@thecus.kiddle.eu> Bart wrote: > On Sep 21, 1:39pm, Oliver Kiddle wrote: > } While we could, there's always the possibility that some function > } somewhere has a -d that's intended to me an argument to be completed. > > That condition is already handled by using e.g. "_arguments -n : -n". True but that doesn't help for backward compatibility with old completion functions. > Before producing my patch I first thought about digging around in $expl, > but $expl is already marked up for use with _format, so that doesn't > really work. Also $expl is only passed *down* from _arguments, not back > up to the caller. Well states are just a lazy way of avoiding separate functions. It'd be nicer to get $expl across to them despite it not strictly being down the call stack. However, I'll admit that having the description alone is better than nothing. > Yes, that's what my patch does. $state_descr is an array parallel to Sorry, it looks like I should have checked and read the beginning of the thread before weighing in. > Yes, that would work in _zle, but other callers of _arguments are already > passing a description which _arguments parses out, only to then throw it > away. Shouldn't we keep that parsing in one place and make it useful? Yes, fair enough. In many cases, the descriptions have been left blank where they get thrown out in this manner but it would be nicer to have them cleanly in one place. So given that you "don't think adding -d buys much" and there is the compatibility issue I mentioned, what would you suggest? A local in _main_complete would fall down in the case of a function using states calling another function that also uses states but which doesn't declare state_descr local. _arguments isn't used much from helpers but _values is. Perhaps _arguments/_values could leave state_descr alone where the description is blank or consists of just a space. That way the documentation could also indicate that functions need only declare state_descr local if they give a description for their states. The implementation would have to take care in the case where $state has more than one element, however. Oliver