about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Core/_files15
-rw-r--r--Completion/Core/_tags3
-rw-r--r--Doc/Zsh/compsys.yo15
4 files changed, 24 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index b496c2111..4f04a5de8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2000-04-12  Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
 
+	* 10695: Completion/Core/_files, Completion/Core/_tags,
+ 	Doc/Zsh/compsys.yo: allow brace expansion on patterns for
+ 	file-patterns and tag-order
+	
 	* 10692: Src/builtin.c: missing initialisation for next field in
  	assignments for substitutions for fc builtin
 
diff --git a/Completion/Core/_files b/Completion/Core/_files
index fad833d76..777d09f44 100644
--- a/Completion/Core/_files
+++ b/Completion/Core/_files
@@ -6,7 +6,11 @@ zparseopts -a opts \
     '/=tmp' 'f=tmp' 'g+:-=tmp' q n 1 2 P: S: r: R: W: X+: M+: F: J+: V+:
 
 type="${(@j::M)${(@)tmp#-}#?}"
-(( $tmp[(I)-g*] )) && glob="${(j:,:)${(@M)tmp:#-g*}#-g}"
+if (( $tmp[(I)-g*] )); then
+  glob="${${${${(@M)tmp:#-g*}#-g}##[[:blank:]]#}%%[[:blank:]]#}"
+  [[ "$glob" = *[^\\][[:blank:]]* ]] &&
+      glob="{${glob//(#b)([^\\])[[:blank:]]##/${match[1]},}}"
+fi
 ign=$opts[(I)-F]
 if (( ign )); then
   ign=( $=opts[ign+1] )
@@ -22,7 +26,7 @@ fi
 if zstyle -a ":completion:${curcontext}:" file-patterns tmp; then
   [[ "$type" = */* ]] && glob="$glob,*(-/)"
   pats=()
-  for i in ${tmp//\\%p/ ${${glob:-\*}//:/\\:} }; do
+  for i in ${tmp//\\%p/${${glob:-\*}//:/\\:} }; do
     if [[ $i = *[^\\]:* ]]; then
       pats=( "$pats[@]" " $i " )
     else
@@ -45,9 +49,9 @@ else
 fi
 
 for def in "$pats[@]"; do
-  def="${def##[[:blank:]]#}"
-  while [[ "$def" = *[^\\][[:blank:]]* ]]; do
-    sdef="${${(M)def#*[^\\][[:blank:]]}%%[[:blank:]]#}"
+  eval "def=( ${${def:s/\\:/\\\\\\\\\\\\:}//(#b)([][()|*?^#~<>])/\\${match[1]}} )"
+  for sdef in "$def[@]"; do
+
     tag="${${sdef#*[^\\]:}%%:*}"
     pat="${${${sdef%%:${tag}*}//\\\\:/:}//,/ }"
 
@@ -70,7 +74,6 @@ for def in "$pats[@]"; do
         fi
       done
     done
-    def="${${def#${sdef}}##[[:blank:]]#}"
   done
   (( ret )) || return 0
 done
diff --git a/Completion/Core/_tags b/Completion/Core/_tags
index 496f5b7e0..205fdb367 100644
--- a/Completion/Core/_tags
+++ b/Completion/Core/_tags
@@ -64,7 +64,8 @@ if (( $# )); then
              fi
              ;;
       \!*)   comptry "${(@)argv:#(${(j:|:)~${=~tag[2,-1]}})}";;
-      ?*)    comptry -m "$tag";;
+      ?*)    eval "tag=( ${${tag:s/\\:/\\\\\\\\\\\\:}//(#b)([][()|*?^#~<>])/\\${match[1]}} )" 
+             comptry -m "${${(@)tag// /\\ }}";;
       esac
     done
 
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 55d2c292d..75dc14346 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -947,13 +947,15 @@ If the tt(file-patterns) style is set, the default tags are not
 used. Instead, the value of the style says which tags and which
 patterns are to be offered. The strings in the value contain
 specifications of the form
-`var(patterns)tt(:)var(tag)'; each string may contain any number of
-such specifications. The var(patterns) give one or more glob 
-patterns separated by commas that are to be used to generate
+`var(pattern)tt(:)var(tag)'; each string may contain any number of
+such specifications. The var(pattern) gives a glob 
+pattern that is to be used to generate
 filenames. If it contains the sequence `tt(%p)', that is replaced by
 the pattern(s) given by the calling function.
 Colons in the pattern have to be preceded by a backslash to
-make them distinguishable from the colon before the var(tag). The
+make them distinguishable from the colon before the var(tag). If more
+than one pattern is needed, the patterns can be given inside braces,
+separated by commas. The
 var(tag)s of all strings in the value will be offered by tt(_files)
 (again, one after another) and used when looking up other styles. For
 strings containing more than one specification, the filenames for all
@@ -1707,8 +1709,9 @@ for a description of these special parameters).
 )
 enditem()
 
-In each of the cases above, the tag may also be a pattern. In this
-case all of the offered tags matching this pattern will be used except 
+In each of the cases above, the tag may also be a pattern or more than 
+one pattern inside braces and separated by commas. In this
+case all of the offered tags matching the pattern(s) will be used except 
 for those that are given explicitly in the same string. There are
 probably two main uses of this. One is the case where one wants to try
 one of the tags more than once, setting other styles differently for