From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17573 invoked by alias); 21 Apr 2012 22:06:20 -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: 30437 Received: (qmail 21969 invoked from network); 21 Apr 2012 22:06:15 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: neutral (ns1.primenet.com.au: 74.125.82.43 is neither permitted nor denied by SPF record at ntlworld.com) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-proxyuser-ip:date:from:to:subject:message-id:in-reply-to :references:x-mailer:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=/WH8E35uP/en1m8B8eVJVq8pFL8VuJUXumypFIXVzvU=; b=nu+S5J/AlHjj6x7XuqBiHO9Qwm9ZKgEYxPbAdwf6Dvh8Fs/bumGEb5nLXs+Xol8Ly6 rT5N/OOH4KkA3B7LlN34r/gfHVlSeZi803h/CWfwCj9b8otBM0CULmvcABYAMVrJoOtm F2AB1SNysDTEqrT2l2Rk7Fmfe1/ICVG9zBHNl6MVA1AnUKOCOmjhShIp1+EKlqiCQjde 2i8kNWSpNmgMR3sEqNn0nc5c2hEX4SlBgtbI2CcDdMfwW6OP5aC4unVblJZJypJ8QYqQ p7rZKb7sNANQfzr/oKaRp21cqv1M4nNY8LgQLAs+8M3SpO8/9dO7VOJ/qWYMsG0uZL0w gu4w== X-ProxyUser-IP: 86.6.29.42 Date: Sat, 21 Apr 2012 23:06:05 +0100 From: Peter Stephenson To: "Zsh Hackers' List" Subject: Re: PATCH: parameter substitution for exclusion by array Message-ID: <20120421230605.565f4ad1@pws-pc.ntlworld.com> In-Reply-To: <120421144817.ZM10783@torch.brasslantern.com> References: <20120420202051.367d012e@pws-pc.ntlworld.com> <20120421220543.29adea5a@pws-pc.ntlworld.com> <120421144817.ZM10783@torch.brasslantern.com> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnh/kZX8ydykvyX+fBxs8zKFlbMcFRjclUhnHPL2KsCjJlaLLKzt08Sd9+RIIBwGVjT0qQ2 On Sat, 21 Apr 2012 14:48:17 -0700 Bart Schaefer wrote: > On Apr 21, 10:05pm, Peter Stephenson wrote: > } > } > Index: Completion/Zsh/Command/_typeset > } > args=(${^fpath}/*(:t)) > } > } I wonder if it would be OK to fix this to > } > } args=(${^fpath}/*(-.:t)) > } > } or is that going to give problems with network paths? > > As we're already globbing in the directory, the only difference between > *(-.:t) and *(.:t) is for directories that contain a bunch of symlinks; > any symlink to the directory itself must already have been followed. So > I don't think network paths are a huge concern. The point is there wasn't even a "." there before, so we're going from a pure readdir() loop (plus a bit of string handling with no implications for system interaction) to performing a stat() on each file. What really triggered my noticing this was we allow completion of subdirectories of $fpath as autoloadable functions, which is a bit bizarre. Hmm... we could make this more efficient with some trickery: remove functions already marked for autoload first, then regenerate the path to the remaining (presumably, though not necessarily much smaller) set of matches first, then only test the types of those. However, I'm not sure there's an efficient way of getting from the pruned $args back to the full paths, or equivalently an efficient way of removing full paths where only the last component matches a function name... or whether it's worth even attempting. -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/