zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: PATCH: match-word-context
Date: Mon, 14 Aug 2006 17:52:29 +0100	[thread overview]
Message-ID: <200608141652.k7EGqTvG027089@news01.csr.com> (raw)
In-Reply-To: <060814092247.ZM7608@torch.brasslantern.com>

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 <pws@csr.com>                  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


      reply	other threads:[~2006-08-14 16:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-14 13:58 Peter Stephenson
2006-08-14 16:22 ` Bart Schaefer
2006-08-14 16:52   ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200608141652.k7EGqTvG027089@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).