From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12327 invoked from network); 30 Apr 2007 17:19:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) 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.8 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 30 Apr 2007 17:19:34 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 27906 invoked from network); 30 Apr 2007 17:19:27 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 30 Apr 2007 17:19:27 -0000 Received: (qmail 27640 invoked by alias); 30 Apr 2007 17:19:20 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23363 Received: (qmail 27631 invoked from network); 30 Apr 2007 17:19:20 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 30 Apr 2007 17:19:20 -0000 Received: (qmail 27165 invoked from network); 30 Apr 2007 17:19:19 -0000 Received: from cluster-c.mailcontrol.com (168.143.177.190) by a.mx.sunsite.dk with SMTP; 30 Apr 2007 17:19:16 -0000 Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly15c.srv.mailcontrol.com (MailControl) with ESMTP id l3UHJBbe032653 for ; Mon, 30 Apr 2007 18:19:12 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Mon, 30 Apr 2007 18:19:12 +0100 Date: Mon, 30 Apr 2007 18:19:11 +0100 From: Peter Stephenson To: Zsh hackers list Subject: Re: Proposal to use patterns in fake-files style Message-Id: <20070430181911.36ad3f58.pws@csr.com> In-Reply-To: <200704301208.l3UC81Ol017197@news01.csr.com> References: <200704301208.l3UC81Ol017197@news01.csr.com> Organization: Cambridge Silicon Radio X-Mailer: Sylpheed version 2.2.10 (GTK+ 2.10.8; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 30 Apr 2007 17:19:12.0078 (UTC) FILETIME=[AB944EE0:01C78B4B] X-Scanned-By: MailControl A-07-07-00 (www.mailcontrol.com) on 10.67.0.125 Peter Stephenson wrote: > Is anybody out there going to be disadvantaged if I turn the directory > part of the fake-files completion style into a pattern? This is the patch in question. Index: Doc/Zsh/compsys.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v retrieving revision 1.198 diff -u -r1.198 compsys.yo --- Doc/Zsh/compsys.yo 27 Feb 2007 20:44:02 -0000 1.198 +++ Doc/Zsh/compsys.yo 30 Apr 2007 13:15:24 -0000 @@ -1340,12 +1340,17 @@ `var(dir)tt(:)var(names...)'. This will add the var(names) (strings separated by spaces) as possible matches when completing in the directory var(dir), even if no -such files really exist. +such files really exist. The dir may be a pattern; pattern characters +or colons in var(dir) should be quote with a backslash to be treated +literally. This can be useful on systems that support special filesystems whose top-level pathnames can not be listed or generated with glob patterns. It can also be used for directories for which one does not have read permission. + +The pattern form can be used to add a certain `magic' entry +to all directories on a particular filing system. ) kindex(fake-parameters, completion style) item(tt(fake-parameters))( Index: Src/Zle/computil.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v retrieving revision 1.101 diff -u -r1.101 computil.c --- Src/Zle/computil.c 21 Jan 2007 22:49:56 -0000 1.101 +++ Src/Zle/computil.c 30 Apr 2007 13:15:26 -0000 @@ -4247,14 +4247,20 @@ char *m, *f, *p, *t, *a, c; int sl = strlen(skipped) + 1; struct stat st1, st2; + Patprog pprog; for (; (f = *fake); fake++) { f = dupstring(f); for (p = t = f; *p; p++) { if (*p == ':') break; - else if (*p == '\\' && p[1]) + else if (*p == '\\' && p[1] == ':') { + /* + * strip quoted colons here; rely + * on tokenization to strip other backslashes + */ p++; + } *t++ = *p; } if (*p) { @@ -4262,9 +4268,12 @@ if (!*p) continue; + tokenize(f); + pprog = patcompile(f, PAT_STATIC, NULL); + untokenize(f); for (node = firstnode(orig); node; incnode(node)) { if ((m = (char *) getdata(node)) && - (!strcmp(f, m) || + ((pprog ? pattry(pprog, m) : !strcmp(f, m)) || (!stat(f, &st1) && !stat((*m ? m : "."), &st2) && st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino))) { -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview