summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2002-02-25 09:09:31 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2002-02-25 09:09:31 +0000
commit8dcd8e54c54baddfb075d92c03f53117c7e1e6b1 (patch)
tree1ad07ef9693ff55eaed00a05c60b630877ecdaf0
parent5b34b8ddbaa9305a04864256411c21a5e0a6bd7b (diff)
downloadzsh-8dcd8e54c54baddfb075d92c03f53117c7e1e6b1.tar.gz
zsh-8dcd8e54c54baddfb075d92c03f53117c7e1e6b1.tar.xz
zsh-8dcd8e54c54baddfb075d92c03f53117c7e1e6b1.zip
make _guard use `_mesage -e'; make `_message -e' use $curtag as a default; change uses of _guard (16708)
-rw-r--r--ChangeLog9
-rw-r--r--Completion/Base/Core/_message10
-rw-r--r--Completion/Base/Utility/_guard13
-rw-r--r--Completion/Unix/Command/_grep2
-rw-r--r--Completion/Unix/Command/_pbm2
-rw-r--r--Completion/Unix/Command/_pine4
-rw-r--r--Completion/X/Command/_vnc2
-rw-r--r--Doc/Zsh/compsys.yo20
-rw-r--r--Src/Zle/compcore.c4
9 files changed, 34 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index c39124c60..758b034eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2002-02-25  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 16708: Completion/Base/Core/_message,
+	Completion/Base/Utility/_guard, Completion/Unix/Command/_grep,
+	Completion/Unix/Command/_pbm, Completion/Unix/Command/_pine,
+	Completion/X/Command/_vnc, Doc/Zsh/compsys.yo,
+	Src/Zle/compcore.c: make _guard use `_mesage -e'; make
+	`_message -e' use $curtag as a default; change uses of _guard
+
 2002-02-22  Wayne Davison  <wayned@users.sourceforge.net>
 
 	* 16703: Src/hist.c: In putoldhistentryontop(), ensure that we can't
diff --git a/Completion/Base/Core/_message b/Completion/Base/Core/_message
index 979dfa097..2ad778082 100644
--- a/Completion/Base/Core/_message
+++ b/Completion/Base/Core/_message
@@ -3,11 +3,17 @@
 local format raw gopt
 
 if [[ "$1" = -e ]]; then
-  local expl ret=1
+  local expl ret=1 tag
 
   _comp_mesg=yes
 
-  _tags "$2" && while _next_label "$2" expl "$3"; do
+  if (( $# > 2 )); then
+    tag="$2"
+    shift
+  else
+    tag="$curtag"
+  fi
+  _tags "$tag" && while _next_label "$tag" expl "$2"; do
     compadd ${expl:/-X/-x}
     ret=0
   done
diff --git a/Completion/Base/Utility/_guard b/Completion/Base/Utility/_guard
index 4c07fe1b9..ff62981ce 100644
--- a/Completion/Base/Utility/_guard
+++ b/Completion/Base/Utility/_guard
@@ -1,17 +1,12 @@
 #autoload
 
-local mesg pat garbage
+local garbage
 
-mesg=()
-zparseopts -K -D -a garbage M: J: V: 1 2 n F: X:=mesg 
+zparseopts -K -D -a garbage M: J: V: 1 2 n F: X:
 
 [[ "$PREFIX$SUFFIX" != $~1 ]] && return 1
 
-if [[ $# -gt 1 || $#mesg -eq 0 ]]; then
-  shift
-  _message "$*"
-else
-  _message -r "$mesg[2]"
-fi
+shift
+_message -e "$*"
 
 [[ -n "$PREFIX$SUFFIX" ]]
diff --git a/Completion/Unix/Command/_grep b/Completion/Unix/Command/_grep
index 3b3e01ef3..db0d6301e 100644
--- a/Completion/Unix/Command/_grep
+++ b/Completion/Unix/Command/_grep
@@ -51,7 +51,7 @@ arguments=( $arguments[@]
   '(--null -Z --no-filename -h)'{--null,-Z}'[print 0 byte after FILE name]'
   '--help[display help]'
   '--mmap[memory map input]'
-  '(-e --regexp -f --file)1:pattern:_guard "^--*"'
+  '(-e --regexp -f --file)1: :_guard "^--*" pattern'
   '*:files:_files'
 )
 
diff --git a/Completion/Unix/Command/_pbm b/Completion/Unix/Command/_pbm
index 66951f040..388249f9d 100644
--- a/Completion/Unix/Command/_pbm
+++ b/Completion/Unix/Command/_pbm
@@ -398,7 +398,7 @@ pnmpad)
     '-l-[specify left border width]:left border width:' \
     '-r-[specify right border width]:right border width:' \
     '-t-[specify top border width]:top border width:' \
-    '-b-[specify bottom border width]:bottom border width:_guard "[0-9]#"' \
+    '-b-[specify bottom border width]: :_guard "[0-9]#" "bottom border width"' \
     ':file: _pbm'
   ;;
 
diff --git a/Completion/Unix/Command/_pine b/Completion/Unix/Command/_pine
index 736fdc223..9ee0b44c9 100644
--- a/Completion/Unix/Command/_pine
+++ b/Completion/Unix/Command/_pine
@@ -34,11 +34,11 @@ _arguments -C -s \
   "($opts $idx -url)-attach_and_delete[go to composer, attach file, delete when finished]:file:_files" \
   "($opts $idx $send)-url[open the given URL]:url:->url" \
   "($opts $send)-f+[specify mailbox to load]:mailbox: _mailboxes" \
-  "($opts $send)-c+[specify context to apply to -f arg]:number:_guard '[0-9]#'" \
+  "($opts $send)-c+[specify context to apply to -f arg]: :_guard '[0-9]#' number" \
   "($opts $send)-sort[specify sort order of folder]:sort order:(${(j: :)sortorder})" \
   "($opts $send)-i[go directly to index, bypassing main menu]" \
   "($opts $send)-I+[specify initial keystrokes to be executed]:keystrokes" \
-  "($opts $send)-n+[entry in index to begin on]:number:_guard '[0-9]#'" \
+  "($opts $send)-n+[entry in index to begin on]: :_guard '[0-9]#' number" \
   "($opts $send)-o[open first folder read-only]" \
   "(-F -h -v)-r[restricted - can only send mail to oneself]" \
   "(-h -v)-d[set debug level]:debug:(0 1 2 3 4 5 6 7 8 9 flush timestamp imap= numfiles= verbose=)" \
diff --git a/Completion/X/Command/_vnc b/Completion/X/Command/_vnc
index ce324a81d..ed39bdb2f 100644
--- a/Completion/X/Command/_vnc
+++ b/Completion/X/Command/_vnc
@@ -13,7 +13,7 @@ case $service in
 	'-geometry:geometry:(1600x1200 1280x1024 1152x864 1024x768 800x600 640x480)' \
 	'-depth:pixel depth:(8 16 24 32)' \
 	'-pixelformat:pixel format' \
-	'1::display number:_guard "(|:[0-9]#)"' \
+	'1:: :_guard "(|:[0-9]#)" "display number"' \
       - kill \
 	"-kill:display number:($displays)" \
       - help \
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 73ada9ba2..d6b464002 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -3673,7 +3673,7 @@ command has to be called and hence it shouldn't be used if one can't
 be sure that the command understands the `tt(-)tt(-help)' option.
 )
 findex(_guard)
-item(tt(_guard) [ var(options) ] var(pattern) [ var(descr) ])(
+item(tt(_guard) [ var(options) ] var(pattern descr))(
 This function is intended to be used in an action of functions like
 tt(_arguments).  It returns immediately with a non-zero return value if
 the string to be completed does not match the var(pattern).  If the
@@ -3683,18 +3683,11 @@ zero if the word to complete is not empty and non-zero otherwise.
 The var(pattern) may be preceded by those options understood by
 tt(compadd) that are passed down from tt(_description), namely tt(-M),
 tt(-J), tt(-V), tt(-1), tt(-2), tt(-n), tt(-F) and tt(-X).  All of these
-options, except tt(-X), will be ignored.  If the tt(-X) option appears,
-the description following it will be used as the string to display if
-the var(pattern) matches, unless the option var(descr) is given to
-tt(_guard) itself, which will then take precedence.
+options will be ignored.
 
 As an example, consider a command taking the options tt(-n) and
 tt(-none), where tt(-n) has to be followed by a numeric value in the
-same word.  By using either of:
-
-example(_argument '-n-:numeric value:_guard "[0-9]#"' '-none')
-
-or
+same word.  By using:
 
 example(_argument '-n-: :_guard "[0-9]#" "numeric value"' '-none')
 
@@ -3706,7 +3699,7 @@ followed by another character, only options are completed.
 )
 findex(_message)
 xitem(tt(_message) [ tt(-r12) ] [ tt(-VJ) var(group) ] var(descr))
-item(tt(_message -e) var(tag descr))(
+item(tt(_message -e) [ var(tag) ] var(descr))(
 The var(descr) is used like the third
 argument to the tt(_description) function. However, the resulting
 string will always be shown whether or not matches were
@@ -3727,7 +3720,10 @@ hence determine the group the message string is added to.
 
 In the second form, the var(descr) is added like a description added
 by tt(_description) under the given var(tag), but the var(descr) will
-always be shown even if no matches are added for the var(tag).
+always be shown even if no matches are added for the var(tag).  If the
+var(tag) is omitted, it is taken from the tt(curtag) parameter which
+is set by the functions dealing with tags so it should contain the
+right one in almost all cases.
 )
 findex(_multi_parts)
 item(tt(_multi_parts) var(sep) var(array))(
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 21ea681bb..1c3c31921 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -1648,10 +1648,6 @@ addmatches(Cadata dat, char **argv)
     if (!*argv && !dat->dummies && !(dat->aflags & CAF_ALL))
 	return 1;
 
-#if 0
-    if (dat->dummies)
-        dat->aflags = (dat->aflags | CAF_NOSORT | CAF_UNIQCON) & ~CAF_UNIQALL;
-#endif
     for (bp = brbeg; bp; bp = bp->next)
 	bp->curpos = ((dat->aflags & CAF_QUOTE) ? bp->pos : bp->qpos);
     for (bp = brend; bp; bp = bp->next)