From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13141 invoked from network); 14 Aug 2006 16:52:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-25) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 14 Aug 2006 16:52:47 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 1478 invoked from network); 14 Aug 2006 16:52:41 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 14 Aug 2006 16:52:41 -0000 Received: (qmail 1613 invoked by alias); 14 Aug 2006 16:52:39 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22608 Received: (qmail 1603 invoked from network); 14 Aug 2006 16:52:38 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 14 Aug 2006 16:52:38 -0000 Received: (qmail 1216 invoked from network); 14 Aug 2006 16:52:38 -0000 Received: from cluster-d.mailcontrol.com (217.69.20.190) by a.mx.sunsite.dk with SMTP; 14 Aug 2006 16:52:36 -0000 Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly03d.srv.mailcontrol.com (MailControl) with ESMTP id k7EGqVmD030945 for ; Mon, 14 Aug 2006 17:52:31 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Mon, 14 Aug 2006 17:52:30 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.4/8.13.4) with ESMTP id k7EGqT9o027092 for ; Mon, 14 Aug 2006 17:52:29 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.13.4/8.13.4/Submit) with ESMTP id k7EGqTvG027089 for ; Mon, 14 Aug 2006 17:52:29 +0100 Message-Id: <200608141652.k7EGqTvG027089@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: PATCH: match-word-context In-reply-to: <060814092247.ZM7608@torch.brasslantern.com> References: <200608141358.k7EDwQMd024163@news01.csr.com> <060814092247.ZM7608@torch.brasslantern.com> Date: Mon, 14 Aug 2006 17:52:29 +0100 From: Peter Stephenson X-OriginalArrivalTime: 14 Aug 2006 16:52:31.0044 (UTC) FILETIME=[084CA840:01C6BFC2] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-07-04-01 (www.mailcontrol.com) on 10.68.0.113 Bart Schaefer wrote: > } +Here are some examples of use of the tt(word-context) style to extend > } +the context. > } + > } +example(zstyle ':zle:*' word-context "[[:space:]]" whitespace "*/*" file > > Will this do the correct thing when the cursor is on whitespace that is > inside a quoted file name? My first thought would be to list the two > patterns in the opposite order. It will, although the other order would be a good deal more logical so I'll change it anyway. Since it's anchored to the start and end [[:space:]] will only match a single whitespace character. Since the test words never have quotes stripped, that can only come from real whitespace between words. On rereading I didn't make it clear that the test at this level is always on shell words; anything else gets confusingly recursive. Index: Doc/Zsh/contrib.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/contrib.yo,v retrieving revision 1.62 diff -u -r1.62 contrib.yo --- Doc/Zsh/contrib.yo 14 Aug 2006 16:14:41 -0000 1.62 +++ Doc/Zsh/contrib.yo 14 Aug 2006 16:42:01 -0000 @@ -487,16 +487,15 @@ the var(X) of tt(foo)var(X)tt(bar), where var(X) can be any character, then the resulting expression is tt(bar)var(X)tt(foo). -Finer grained control can be obtained by setting the style -tt(word-context) to an array of pairs of entries. Each pair of entries -consists of a var(pattern) and a var(subcontext). The word the cursor is on is +Finer grained control can be obtained by setting the style tt(word-context) +to an array of pairs of entries. Each pair of entries consists of a +var(pattern) and a var(subcontext). The shell argument the cursor is on is matched against each var(pattern) in turn until one matches; if it does, the context is extended by a colon and the corresponding var(subcontext). -Note that the test is made against the original word on the line, with -no stripping of quotes. If the cursor is at the end of the line -the test is maded against an empty string; if it is on whitespace -between words the test is made against a single space. Some examples -are given below. +Note that the test is made against the original word on the line, with no +stripping of quotes. If the cursor is at the end of the line the test is +performed against an empty string; if it is on whitespace between words the +test is made against a single space. Some examples are given below. Here are some examples of use of the styles, actually taken from the simplified interface in tt(select-word-style): @@ -516,7 +515,7 @@ Here are some examples of use of the tt(word-context) style to extend the context. -example(zstyle ':zle:*' word-context "[[:space:]]" whitespace "*/*" file +example(zstyle ':zle:*' word-context "*/*" file "[[:space:]]" whitespace zstyle ':zle:transpose-words:whitespace' word-style shell zstyle ':zle:transpose-words:filename' word-style normal zstyle ':zle:transpose-words:filename' word-chars '') -- 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