From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26929 invoked from network); 25 Jan 2009 16:41:06 -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; 25 Jan 2009 16:41:06 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 1904 invoked from network); 25 Jan 2009 16:40:58 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 25 Jan 2009 16:40:58 -0000 Received: (qmail 8581 invoked by alias); 25 Jan 2009 16:40:54 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26433 Received: (qmail 8569 invoked from network); 25 Jan 2009 16:40:53 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 25 Jan 2009 16:40:53 -0000 Received: from QMTA07.westchester.pa.mail.comcast.net (qmta07.westchester.pa.mail.comcast.net [76.96.62.64]) by bifrost.dotsrc.org (Postfix) with ESMTP id D05C880271F0 for ; Sun, 25 Jan 2009 17:40:38 +0100 (CET) Received: from OMTA14.westchester.pa.mail.comcast.net ([76.96.62.60]) by QMTA07.westchester.pa.mail.comcast.net with comcast id 7pZG1b0021HzFnQ57sgd64; Sun, 25 Jan 2009 16:40:37 +0000 Received: from smtp.klanderman.net ([98.217.254.247]) by OMTA14.westchester.pa.mail.comcast.net with comcast id 7sgd1b0085M2Np63asgdeL; Sun, 25 Jan 2009 16:40:37 +0000 Received: from lwm.klanderman.net (unknown [192.168.100.50]) by smtp.klanderman.net (Postfix) with ESMTP id 2E72BB30147 for ; Sun, 25 Jan 2009 11:40:36 -0500 (EST) Received: by lwm.klanderman.net (Postfix, from userid 500) id 14BCA9FC5EF; Sun, 25 Jan 2009 11:40:36 -0500 (EST) From: Greg Klanderman To: zsh-workers@sunsite.dk Subject: Re: completing automounts with fake-files setting hangs zsh Reply-To: gak@klanderman.net Date: Sun, 25 Jan 2009 11:40:35 -0500 In-Reply-To: <090125042005.ZM25079@torch.brasslantern.com> (Bart Schaefer's message of "Sun, 25 Jan 2009 04:20:05 -0800") Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (linux) References: <18811.39531.84244.341828@gargle.gargle.HOWL> <090125042005.ZM25079@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: ClamAV 0.92.1/8901/Sun Jan 25 11:10:36 2009 on bifrost X-Virus-Status: Clean >>>>> Bart Schaefer writes: > So if you are able to push some of that filtering into the functions > by use of hooks like "zstyle -e", you can optimize much better than > the generic internal filters are able. I don't think that's going to be a workable solution; if I or one of my users ever have the misfortune to hit after an automount point with not enough text to narrow the match list, then their shell is just done. I've waited up to half an hour - it doesn't come back. Here's what I have done for over 10 years in compctl, based on the compctl-examples file: function _comp_autonet () { ... } # parse etc/auto.net and return all completions function _comp_autohome () { ... } # parse etc/auto.home and return all completions compctl -T -x 's[/net/] C[0,^/net/[^/]#/*]' -K _comp_autonet -S/ -tn \ - 's[/home/] C[0,^/home/[^/]#/*]' -K _comp_autohome -S/ -tn So compctl could deal with the full set of completions without pre-filtering against the user text. Under the new completion system, I have something like: zstyle ':completion:*' fake-files \ '/net:foo bar baz ..' \ '/home:user1 user2 user3 ..' The completion system is smart enough that this doesn't cause any problem with several hundred fake files defined per automount point, until I actually try to complete on those fake files. In fact it's even fine if the set of completions is reasonably small, so it appears to be filtering against the user input before stat'ing all the completions. It's only when there are a large number of matches that it gets completely wedged stat'ing them all. I traced the code from the _path_files function into the compfiles builtin in the zsh/computil module but then I'm getting pretty lost. It seems that the compctl mechanism worked because it treated the completions simply as strings rather than files, and set the -S/ suffix argument so they would behave as directory completions. If I append a '/' to each file in the fake-files style setting, then everything is fast, but it appends a space after the completion is inserted (after the '/'). So maybe the right thing is to modify the compfiles builtin to treat fake files ending in '/' as directories without stat'ing them? I'll poke at that some more if you agree it's reasonable.. thanks, Greg