From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16881 invoked from network); 19 Mar 2009 16:18:24 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 19 Mar 2009 16:18:24 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 68074 invoked from network); 19 Mar 2009 16:18:20 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 19 Mar 2009 16:18:20 -0000 Received: (qmail 26036 invoked by alias); 19 Mar 2009 16:18:16 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26757 Received: (qmail 26023 invoked from network); 19 Mar 2009 16:18:15 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 19 Mar 2009 16:18:15 -0000 Received: from mail-ew0-f179.google.com (mail-ew0-f179.google.com [209.85.219.179]) by bifrost.dotsrc.org (Postfix) with ESMTP id 4BB008056E25 for ; Thu, 19 Mar 2009 17:18:11 +0100 (CET) Received: by ewy27 with SMTP id 27so426950ewy.45 for ; Thu, 19 Mar 2009 09:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=+fC85MubjK31Zx6+9tjLIvEKIHXJBOn25/h7a+jARJw=; b=ULWiUr9RvhRO2dDbrTRRzkFdEDbKL3b5oS8JRhmXBgorqeBRmMQxur6CGtwhDgBTLX 00xA6ViBZKZYyhoYP9p110TpiGwysLDEMVx6AAl+xUYiYYS9Vp0/abdpC1gvTJkT+NH1 gitWsgs+/cR9KXuocLmzKptn562eHY9pCEXQM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=tS0arZzDuhUbhURxf8aDCeJGh+xhI0YV/CeFkt/8uD0IT6BjnV9w7raYbKjJ5B4BVc u6CBhpuk2VboD028Vzvusj4DRxoWLYH/xxfidgWXs5JAIkhgtobOb+oe/S37xBHL2Hyt XbbpBHZjVxPK0wpOHsc8CP1mvDaPqI82SVf18= MIME-Version: 1.0 Received: by 10.210.92.11 with SMTP id p11mr1359283ebb.2.1237479489951; Thu, 19 Mar 2009 09:18:09 -0700 (PDT) In-Reply-To: <200903191609.n2JG95hf031989@news01.csr.com> References: <20090313105555.GA19025@piper.oerlikon.madduck.net> <20090315062253.GB14010@scru.org> <20090316181852.27e9420d@news01> <237967ef0903190828k4b9f7edbyc85405b630c50d5d@mail.gmail.com> <200903191609.n2JG95hf031989@news01.csr.com> Date: Thu, 19 Mar 2009 17:18:09 +0100 Message-ID: <237967ef0903190918x64adec38y11c0d4e6143a238f@mail.gmail.com> Subject: Re: Bug#519535: history expansion: modifier completion missing From: Mikael Magnusson To: zsh-workers@sunsite.dk Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.92.1/9140/Thu Mar 19 16:16:32 2009 on bifrost X-Virus-Status: Clean 2009/3/19 Peter Stephenson : > Mikael Magnusson wrote: >> Is it supposed to work here? $PWD: (it doesn't for me). > > No, wihin parameters the completion system doesn't handle any case > except parameter names and values properly. It doesn't know there's > anything special to do there. Parsing it would be horrible. (It will, > of course, expand a complete expression as an entirely separate matter.) > >> It does >> complete if you write $PWD(:, but also in ${PWD(:, but >> accepting one of the latter produces a syntax error: >> % echo ${PWD(:A)} >> zsh: bad substitution >> (regardless of which modifier you use) > > That's because it is a syntax error. Same answer: the completion system > doesn't know that's special, handling all these special cases is > horrific. It ought to be possible for someone with that sort of time on > their hands to extend check_param() in compcore.c to add new parameter > contexts, but it seems a funny thing to do with your life. (Actually, > in the case of brace parameters that ought to be easy, it already knows > you're in a brace parameter and it already knows the brace isn't > complete, so it could do the same as it does for completing the > parameter but set a different context to show it's in the trailing > matter. But that still leaves the non-brace case.) > > (Of course, the right way to do this is to have the shell parsed by > examining a grammar which is also used for generating the cases for > completing shell syntax. Our infinite team of monkeys should have this > done by the next ice age.) Heh, i think i'll just go with typing the extra ( when i need the hints then. >> Also, i get this: >> $PWD(:s- >> _history_modifiers:34: bad math expression: operand expected at `^-' >> _history_modifiers:34: bad math expression: operand expected at `^-' >> _history_modifiers:34: bad math expression: operand expected at `^-' >> _history_modifiers:34: bad math expression: operand expected at `^-' >> _history_modifiers:34: bad math expression: operand expected at `^-' >> _history_modifiers:34: bad math expression: operand expected at `^-' >> (same with / or other separator (but it says `^/' then, of course)) > > I obviously didn't try this bit. It's supposed to give you hints. Note > this doesn't currently work for !-history itself---out of fear, I used a > very simple test in _normal that only works with a trailing ":". > >> As an aside, after i write $PWD(: to get the s, how do i "accept" >> the completion to make tab complete the - instead of cycling to the >> next completer? The only way i found is typing something and deleting >> it... When completing directories i usually just type a /. > > Just type the string that's got to come next; it always does, or the s > is useless: there's no point typing anything you need to delete, just > use what you don't need to delete. Actually, why don't you just type > "s-"? The "completion" is really only there as a mnemonic of what can > go at that point, it doesn't save you any typing even in the optimal > case. Well, i sometimes am in the same situation with other completions where the next string is something you would want to complete. I can't come up with any examples at the moment though... I agree it is a bit silly in this specific case. -- Mikael Magnusson