about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/Base/_default4
-rw-r--r--Completion/Core/_description13
-rw-r--r--Completion/Core/_path_files9
-rw-r--r--Doc/Zsh/compsys.yo8
-rw-r--r--Doc/Zsh/compwid.yo4
-rw-r--r--Src/Zle/complete.c16
6 files changed, 41 insertions, 13 deletions
diff --git a/Completion/Base/_default b/Completion/Base/_default
index 920f3a959..8329a0358 100644
--- a/Completion/Base/_default
+++ b/Completion/Base/_default
@@ -1,7 +1,5 @@
 #compdef -default-
 
-local expl
-
 # You can first try the `compctl's by uncommenting the `compcall' line
 # below.
 # This is without first (-T) and default (-D) completion. If you want
@@ -22,4 +20,4 @@ _files && return 0
 # file name expansion after the =.  In that case, it's natural to
 # allow completion to handle file names after any equals sign.
 
-[[ -o magicequalsubst ]] && compset -P 1 '*=' && _files "$expl[@]"
+[[ -o magicequalsubst ]] && compset -P 1 '*=' && _files
diff --git a/Completion/Core/_description b/Completion/Core/_description
index b1959d018..c6a7b8807 100644
--- a/Completion/Core/_description
+++ b/Completion/Core/_description
@@ -1,9 +1,10 @@
 #autoload
 
-local name gropt format gname hidden hide
+local name gropt format gname hidden hide match
 
 gropt=(-J)
 hide=()
+match=()
 
 if [[ "$1" = -([12]|)[VJ] ]]; then
   gropt=("$1")
@@ -26,21 +27,23 @@ if [[ "$hidden" = (all|yes|true|1|on) ]]; then
 fi
 zstyle -s ":completion${curcontext}:$1" group-name gname &&
     [[ -z "$gname" ]] && gname="$1"
+zstyle -s ":completion${curcontext}:$1" matcher match &&
+    match=(-M "${(q)match}")
 
 shift 2
 [[ -n "$format" ]] && zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
 
 if [[ -n "$gname" ]]; then
   if [[ -n "$format" ]]; then
-    eval "${name}=($hide $gropt ${(q)gname} -X \"${format}\")"
+    eval "${name}=($hide $match $gropt ${(q)gname} -X \"${format}\")"
   else
-    eval "${name}=($hide $gropt ${(q)gname})"
+    eval "${name}=($hide $match $gropt ${(q)gname})"
   fi
 else
   if [[ -n "$format" ]]; then
-    eval "${name}=($hide $gropt -default- -X \"${format}\")"
+    eval "${name}=($hide $match $gropt -default- -X \"${format}\")"
   else
-    eval "${name}=($hide $gropt -default-)"
+    eval "${name}=($hide $match $gropt -default-)"
   fi
 fi
 
diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files
index 39e02fb58..9da2fdd81 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -86,6 +86,15 @@ if (( ! ( $#group + $#expl ) )); then
   else
     _description files expl file
   fi
+  tmp1=$expl[(I)-M]
+  if (( tmp1 )); then
+    match="$match $expl[1+tmp1]"
+    if (( $#matcher )); then
+      matcher[2]="$matcher[2] $expl[1+tmp1]"
+    else
+      matcher=(-M "$expl[1+tmp1]")
+    fi
+  fi
 fi
 
 [[ -n "$tmp1" && $#addsfx -ne 0 ]] && addsfx[1]=-qS
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index e7615d74b..329a07d88 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -939,6 +939,14 @@ hostname, the path to the default web pages for the server and the
 directory name used by a user placing web pages within their home
 area.
 )
+item(tt(matcher))(
+This style is tested for tags used when generating matches. Its value
+is used as an additional match specification to use when adding the
+matches as described in
+ifzman(the section `Matching Control' in zmanref(zshcompwid))\
+ifnzman(noderef(Matching Control))\
+.
+)
 item(tt(max-errors))(
 This is used by the tt(_approximate) and tt(_correct) completer functions
 to determine the maximum number of errors to accept. The completer will try
diff --git a/Doc/Zsh/compwid.yo b/Doc/Zsh/compwid.yo
index 4e31c743e..b9abf4126 100644
--- a/Doc/Zsh/compwid.yo
+++ b/Doc/Zsh/compwid.yo
@@ -562,7 +562,9 @@ into the command line.
 )
 item(tt(-M) var(match-spec))(
 This gives local match specifications as described below in
-noderef(Matching Control).
+noderef(Matching Control). This option may be given more than once. In 
+this case all var(match-spec)s given are contaneted with speces
+between them to form the specification string to use.
 Note that they will only be used if the tt(-U) option is not given.
 )
 item(tt(-n))(
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index bf3102972..afcec261a 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -435,7 +435,7 @@ static int
 bin_compadd(char *name, char **argv, char *ops, int func)
 {
     struct cadata dat;
-    char *p, **sp, *e, *m = NULL;
+    char *p, **sp, *e, *m = NULL, *mstr = NULL;
     int dm;
     Cmatcher match = NULL;
 
@@ -590,13 +590,21 @@ bin_compadd(char *name, char **argv, char *ops, int func)
 		    zerrnam(name, e, NULL, *p);
 		    return 1;
 		}
-		if (dm && (match = parse_cmatcher(name, m)) == pcm_err) {
-		    match = NULL;
-		    return 1;
+		if (dm) {
+		    if (mstr)
+			mstr = tricat(mstr, " ", m);
+		    else
+			mstr = ztrdup(m);
 		}
 	    }
 	}
     }
+    if (mstr && (match = parse_cmatcher(name, mstr)) == pcm_err) {
+	zsfree(mstr);
+	return 1;
+    }
+    zsfree(mstr);
+
  ca_args:
 
     if (!*argv && !dat.group &&