From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14357 invoked from network); 15 Jun 2006 15:39:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 Jun 2006 15:39:09 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 88469 invoked from network); 15 Jun 2006 15:39:01 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 Jun 2006 15:39:01 -0000 Received: (qmail 27107 invoked by alias); 15 Jun 2006 15:38:53 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10374 Received: (qmail 27098 invoked from network); 15 Jun 2006 15:38:52 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 15 Jun 2006 15:38:52 -0000 Received: (qmail 87439 invoked from network); 15 Jun 2006 15:38:52 -0000 Received: from batman.mns.ru (80.70.224.14) by a.mx.sunsite.dk with SMTP; 15 Jun 2006 15:38:51 -0000 Received: from lan-228-198.users.mns.ru ([80.70.228.198]) by batman.mns.ru with esmtp; Thu, 15 Jun 2006 19:38:37 +0400 id 0000A6D1.44917EFD.00005115 From: Konstantin Sobolev Reply-To: kos@supportwizard.com Organization: SupportWizard To: Peter Stephenson Subject: Re: java class names completion widget Date: Thu, 15 Jun 2006 19:38:36 +0400 User-Agent: KMail/1.9.3 Cc: zsh-users@sunsite.dk References: <200606052240.27880.kos@supportwizard.com> <200606071047.k57AljuP028426@news01.csr.com> In-Reply-To: <200606071047.k57AljuP028426@news01.csr.com> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200606151938.36646.kos@supportwizard.com> Hi Peter On Wednesday 07 June 2006 14:47, Peter Stephenson wrote: > (I'm going to assume you're already using the new completion system, > which seems to be the case.) yes > You can actually do the case matching element within zsh without any new > code; the difficult bit is the combination of completion and finding > files, but that's difficult to hook in to completion regardless of > whether the expansion is done inside or outside the shell. Here's how > you do the basic completion (given the problems this probably isn't what > you want, so I'll look at another method later). The following adds the > smash case completion to the context after javac: > > zstyle ':completion:*:javac:*' matcher 'r:|[A-Z]=* r:|=*' [skip] Yeah, I've already played with this stuff. As you point out below, it doesn't search thru the nested folders, which is a very desired behaviour. [skip] > So instead let's hijack the _expand completer and provide a front end. > The trouble with making this the normal contextual completer in place of > _java is that you'll lose all the features of that and need to merge > together what you want. Hence what I suggest you do is use a separate > completion when you want the special behaviour. Then you'll have to > remember to type a different key sequence for this, say C-x j. > > Here's the full code; put it in a file (say _expand_java_path) in your > function path: > > #compdef -k complete-word ^xj > local MATCH MBEGIN MEND > # Turn the start of the string on the line into **/ followed > # by the original prefix with upper case letters followed > # by [^[:upper:]]# which matches any number of consecutive > # non-upper-case characters. This relies on the fact that > # the completion system uses the EXTENDED_GLOB option. > PREFIX="**/${PREFIX//(#m)[[:upper:]]/${MATCH}[^[:upper:]]#}" > # Replace the end of the string similarly, adding *.java to > # the pattern > SUFFIX="${SUFFIX//(#m)[[:upper:]]/${MATCH}[^[:upper:]]#}*.java" > # Now we've got a zsh recursive matching pattern; for example > # SHMa > # has turned into > # **/S[^[:upper:]]#H[^[:upper:]]#M[^[:upper:]]#a*.java > # Let the normal _expand completer get to work. > _expand "$@" > > (Four lines of active code for the whole thing!) > > Those are the basics; there are many, many possible bells and whistles > since all the features of the completion system are available for > offering you matches, and actually the _expand completer does a bit to > much work for us; we just want the globbing effect. > > In particular, the behaviour with ambiguous expansions could be better > configured. _expand turns on menu completion when inserting. Currently > it will cycle through possible expansions, then all expansions, then the > original pattern (though it's not the original, it's the hacked version > from _expand_java_path so isn't much use). You can use the tag-order > style to help. Cool, this is what I've expected to get :) It works, but how can I force it to use menu completion instead of cycling? Playing with zstyle ':completion:*' menu select gives a bit weird effect: (with descriptions turned on) kos@kos ~/work/jrs $ S<^xj> kos@kos ~/work/jrs $ src/org/kos/jrs/ShowCommand.java ---- expansions src/org/kos/jrs/ShowCommand.java tests/org/kos/jrs/SubscriptionManagerMock.java src/org/kos/jrs/SoftHashMap.java tests/org/kos/jrs/SubscriptionManagerTest.java src/org/kos/jrs/SubscriptionManagerImpl.java whack/trunk/source/java/org/jivesoftware/whack/container/ServerContainer.java src/org/kos/jrs/SubscriptionManager.java whack/trunk/source/java/org/jivesoftware/whack/SocketReadThread.java src/org/kos/jrs/swap/SwapFileWritingContainer.java whack/trunk/source/java/org/jivesoftware/whack/util/StringUtils.java src/org/kos/jrs/swap/SwappableObjectContainer.java whack/trunk/source/java/org/xmpp/packet/StreamError.java src/org/kos/jrs/swap/SwappingMap.java ---- all expansions ---- original src/org/kos/jrs/ShowCommand.java src/org/kos/jrs/SoftHashMap.java src/org/kos/jrs/SubscriptionManagerImpl.java src/org/kos/jrs/SubscriptionManager.java sr ... **/S[^[:upper:]]#*.java kos@kos ~/work/jrs $ src/org/kos/jrs/ShowCommand.java As I understand it tries to show the menu but by some reason fallbacks to cycling. Thanks a lot :) -- /KoS * Is this the party to who I am typing to?