From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 536 invoked by alias); 18 Jun 2011 19:52:29 -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: 29487 Received: (qmail 20550 invoked from network); 18 Jun 2011 19:52:26 -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: pass (ns1.primenet.com.au: SPF record at ntlworld.com designates 81.103.221.49 as permitted sender) Date: Sat, 18 Jun 2011 20:52:18 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: _multi_parts and -q Message-ID: <20110618205218.093eb2f8@pws-pc.ntlworld.com> In-Reply-To: <20110617215008.GA3154@lorien.comfychair.org> References: <20110617215008.GA3154@lorien.comfychair.org> X-Mailer: Claws Mail 3.7.9 (GTK+ 2.24.4; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.1 cv=R50lirqlHffDPPkwUlkuVa99MrvKdVWo//yz83qex8g= c=1 sm=0 a=uObrxnre4hsA:10 a=kj9zAlcOel0A:10 a=PgGVwa0UAAAA:8 a=NLZqzBF-AAAA:8 a=vxu9FSHMP87xo4n0hFwA:9 a=xL7OClJiGV2Y9aPutPcA:7 a=CjuIK1q_8ugA:10 a=TDGUi1Mx4R4A:10 a=_dQi-Dcv4p4A:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 On Fri, 17 Jun 2011 14:50:08 -0700 Danek Duvall wrote: > I was hoping that this > > _wanted dataset expl "$expl_type" _multi_parts "$@" -q / datasetlist > > would add slashes as auto-removable suffixes, but it doesn't appear to. > That is, if I type a slash immediately after a slash, it gets swallowed, > but the slash doesn't disappear after hitting space or return. Is this an > issue with _multi_parts, or something I'm doing wrong? I tried putting in > -S/ explicitly, but that didn't seem to make a difference. _multi_parts is completely impenetrable, with no fewer than *18* calls to compadd, but there is some evidence it is handling the -q and -S options (the zparseopts at the start) and using the resulting $sopts in some places, which is what the documentation says it does, although reading the documentation didn't entirely fill me with confidence that I understood everything that was going on. Anyway I think the following is working as I expect: _wanted dataset expl "$expl_type" _multi_parts -S/ -q / datasetlist; in that: - if I complete something ambiguous I don't get the suffix - if I complete something unambiguous I do - the suffix is removable with the usual features: -- it's highlighted if you're using Mikael's autoremove highlighting feature -- if I type a "/" it replaces the autoremovable "/" -- if I type a " " the "/" goes and the " " stays -- if I type a letter the "/" stays and the letter appears immediately after. That's pretty much all I'm expecting. Note that I use menu completion, which shouldn't make a difference at this level but might do. I was testing with this entirely spurious function: _tst() { local expl_type="stuff" local -a datasetlist datasetlist=(foo bar rod stuff) local pref [[ $PREFIX = */* ]] && pref=${PREFIX%/*} [[ -n $pref ]] && datasetlist=($pref/${^datasetlist}) _wanted dataset expl "$expl_type" _multi_parts -S/ -q / datasetlist; } simply to get strings to compile. I don't think that should matter. -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/