From 904b939cbd81a542303da2c58288b95b153106f5 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Thu, 15 Apr 1999 18:17:36 +0000 Subject: zsh-3.1.5-pws-10 --- Doc/Zsh/compwid.yo | 27 ++++++++++++++++------- Doc/Zsh/expn.yo | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- Doc/Zsh/guide.yo | 4 ++-- 3 files changed, 84 insertions(+), 12 deletions(-) (limited to 'Doc') diff --git a/Doc/Zsh/compwid.yo b/Doc/Zsh/compwid.yo index 2cb12e2c2..4208317fb 100644 --- a/Doc/Zsh/compwid.yo +++ b/Doc/Zsh/compwid.yo @@ -162,7 +162,7 @@ xitem(tt(compadd) [ tt(-qQfnUam) ] [ tt(-F) var(array) ]) xitem([ tt(-P) var(prefix) ] [ tt(-S) var(suffix) ]) xitem([ tt(-p) var(hidden-prefix) ] [ tt(-s) var(hidden-suffix) ]) xitem([ tt(-i) var(ignored-prefix) ] [ tt(-W) var(file-prefix) ]) -xitem([ tt(-J) var(name) ] [ tt(-V) var(name) ]) +xitem([ tt(-J) var(name) ] [ tt(-V) var(name) ] [ tt(-X) var(explanation) ]) xitem([ tt(-r) var(remove-chars) ] [ tt(-R) var(remove-func) ]) item([ tt(-M) var(match-spec) ] [ tt(--) ] [ var(words) ... ])( @@ -182,14 +182,17 @@ item(tt(-S) var(suffix))( Like tt(-P) but gives a string that has to be inserted after the match. ) item(tt(-p) var(hidden-prefix))( -This gives a string that should be -... +This gives a string that should be inserted in the line before the +match but that should not appear in the list of matches. ) item(tt(-s) var(hidden-suffix))( -... +Like `tt(-p)', but gives a string to insert after the match. ) item(tt(-i) var(ignored-prefix))( -... +This gives a string to insert into the command line just before any +string given with the `tt(-P)' option. Without `tt(-P)' the string is +inserted before the string given with `tt(-p)' or directly before the +match. ) item(tt(-J) var(name))( As for tt(compctl) and tt(complist) this gives the name of the group @@ -198,6 +201,10 @@ of matches the words should be stored in. item(tt(-V) var(name))( Like tt(-J) but naming a unsorted group. ) +item(tt(-X) var(explanation))( +The var(explanation) string will be printed with the list of matches, +as for tt(compctl -X). +) item(tt(-q))( This flag has the same meaning as for tt(compctl) and tt(complist), too. It makes the suffix given with tt(-S) be automatically removed if @@ -382,15 +389,19 @@ given, it is true if the number of words is equal to or greater than var(min) and equal to or less than var(max) ) item(tt(-after) var(string))( -true if the cursor is after a word that is equal to var(string) +true if the cursor is after a word that is equal to var(string); this +removes all words up to and including the matched word from the +positional parameters ) item(tt(-mafter) var(pattern))( like tt(-after) but using pattern matching ) item(tt(-between) var(string1) var(string2))( true if the cursor is after a word that is equal to var(string1), if -there is also a word that is equal to va(string2), this is true only -if the cursor is before it +there is also a word that is equal to var(string2), this is true only +if the cursor is before it; as a side effect, all words before +var(string1) and after var(string2) (both inclusive) are removed from +the positional parameters ) item(tt(-mbetween) var(pattern1) var(pattern2))( like tt(-between) but using pattern matching diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo index ccf245367..fa56bc0af 100644 --- a/Doc/Zsh/expn.yo +++ b/Doc/Zsh/expn.yo @@ -869,7 +869,7 @@ can be specified by separating two characters by a `tt(-)'. A `tt(-)' or `tt(])' may be matched by including it as the first character in the list. There are also several named classes of characters, in the form -`tt([:)var(name)(tt:])' with the following meanings: `tt([:alnum:])' +`tt([:)var(name)tt(:])' with the following meanings: `tt([:alnum:])' alphanumeric, `tt([:alpha:])' alphabetic, `tt([:blank:])' space or tab, `tt([:cntrl:])' control character, `tt([:digit:])' decimal @@ -988,12 +988,18 @@ item(I)( Case sensitive: locally negates the effect of tt(i) or tt(l) from that point on. ) +item(tt(a)var(num))( +Approximate matching: var(num) errors are allowed in the string matched by +the pattern. The rules for this are described in the next subsection. +) enditem() For example, the test string tt(fooxx) can be matched by the pattern tt(LPAR()#i)tt(RPAR()FOOXX), but not by tt(LPAR()#l)tt(RPAR()FOOXX), tt(LPAR()#i)tt(RPAR()FOO)tt(LPAR()#I)tt(RPAR()XX) or -tt(LPAR()LPAR()#i)tt(RPAR()FOOX)tt(RPAR()X). +tt(LPAR()LPAR()#i)tt(RPAR()FOOX)tt(RPAR()X). The string +tt(LPAR()#ia2)tt(RPAR()readme) specifies case-insensitive matching of +tt(readme) with up to two errors. When using the ksh syntax for grouping both tt(KSH_GLOB) and tt(EXTENDED_GLOB) must be set and the left parenthesis should be @@ -1004,6 +1010,61 @@ examining whole paths case-insensitively every directory must be searched for all files which match, so that a pattern of the form tt(LPAR()#i)tt(RPAR()/foo/bar/...) is potentially slow. +subsect(Approximate Matching) +When matching approximately, the shell keeps a count of the errors found, +which cannot exceed the number specified in the +tt(LPAR()#a)var(num)tt(RPAR()) flags. Four types of error are recognised: + +startitem() +item(1.)( +Different characters, as in tt(fooxbar) and tt(fooybar). +) +item(2.)( +Transposition of characters, as in tt(banana) and tt(abnana). +) +item(3.)( +A character missing in the target string, as with the pattern tt(road) and +target string tt(rod). +) +item(4.)( +An extra character appearing in the target string, as with tt(stove) +and tt(strove). +) +enditem() + +Thus, the pattern tt(LPAR()#a3)tt(RPAR()abcd) matches tt(dcba), with the +errors occurring by using the first rule twice and the second once, +grouping the string as tt([d][cb][a]) and tt([a][bc][d]). + +Non-literal parts of the pattern must match exactly, including characters +in character ranges: hence tt(LPAR()#a1)tt(RPAR()???) matches strings of +length four, by applying rule 4 to an empty part of the pattern, but not +strings of length three, since all the tt(?) must match. Other characters +which must match exactly are initial dots in filenames (unless the +tt(GLOB_DOTS) option is set), and all slashes in file names, so that +tt(a/bc) is two errors from tt(ab/c) (the slash cannot be transposed with +another character). Similarly, errors are counted separately for +non-contiguous strings in the pattern, so that tt(LPAR()ab|cd)tt(RPAR()ef) +is two errors from tt(aebf). + +When using exclusion via the tt(~) operator, approximate matching is +treated entirely separately for the excluded part and must be activated +separately. Thus, tt(LPAR()#a1)tt(RPAR()README~READ_ME) matches +tt(READ.ME) but not tt(READ_ME), as the trailing tt(READ_ME) is matched +without approximation. However, +tt(LPAR()#a1)tt(RPAR()README~LPAR()#a1)tt(RPAR()READ_ME) +does not match any pattern of the form tt(READ)var(?)tt(ME) as all +such forms are now excluded. + +Apart from exclusions, there is only one overall error count; however, the +maximum errors allowed may be altered locally, and this can be delimited by +grouping. For example, +tt(LPAR()#a1)tt(RPAR()cat)tt(LPAR()LPAR()#a0)tt(RPAR()dog)tt(RPAR()fox) +allows one error in total, which may not occur in the tt(dog) section, and +the pattern +tt(LPAR()#a1)tt(RPAR()cat)tt(LPAR()#a0)tt(RPAR()dog)tt(LPAR()#a1)tt(RPAR()fox) +is equivalent. + subsect(Recursive Globbing) A pathname component of the form `tt(LPAR())var(foo)tt(/RPAR()#)' matches a path consisting of zero or more directories diff --git a/Doc/Zsh/guide.yo b/Doc/Zsh/guide.yo index e0005e339..96e12fc58 100644 --- a/Doc/Zsh/guide.yo +++ b/Doc/Zsh/guide.yo @@ -144,8 +144,8 @@ then be processed with bf(dvips) and optionally bf(gs) (Ghostscript) to produce a nicely formatted printed guide. ) item(The HTML guide)( -Mark Borges, tt(