From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16463 invoked by alias); 22 Sep 2011 04:04:27 -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: 29797 Received: (qmail 17588 invoked from network); 22 Sep 2011 04:04:24 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110921210401.ZM17166@torch.brasslantern.com> Date: Wed, 21 Sep 2011 21:04:01 -0700 In-reply-to: <20002.1316625028@thecus.kiddle.eu> Comments: In reply to Oliver Kiddle "Re: using the description from _arguments foo:description:->state" (Sep 21, 7:10pm) References: <110911111050.ZM11625@torch.brasslantern.com> <17938.1316605147@thecus.kiddle.eu> <110921085012.ZM16562@torch.brasslantern.com> <20002.1316625028@thecus.kiddle.eu> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh workers Subject: Re: using the description from _arguments foo:description:->state MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Sep 21, 7:10pm, Oliver Kiddle wrote: } } 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. That'd be a bug in one or the other of those functions, would it not? Declaring state_descr in _main_complete is just to keep it from leaking out to the top level, not to make it possible for functions that need it to avoid declaring it. There's a huge list of other variables that already "fall down" in this way; one more isn't going to kill us. (I don't *like* the necessity of that huge list, but there it is.) } Perhaps _arguments/_values could leave state_descr alone where } the description is blank or consists of just a space. Unfortunately both _arguments and _values need to erase the existing value of the state-related variables before they know whether there are any states or descriptions to assign. The right way to do this probably would have been to pass the names of the variables to set rather than rely entirely on scoping, but [unless someone wants to undertake a major drudgework project to update the whole Completion tree] it's too late to deal with that now. E.g., _arguments has (after my not - committed patch): context=() state=() state_descr=() These could all become (( $+context )) && context=() (( $+state )) && state=() (( $+state_descr )) && state_descr=() and similarly for the place that useful values are assigned to each of them (there's only one such place), but that still doesn't help for a recursive call to _arguments or for a call to _values from _arguments.