Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: problem with _arguments exclusion lists

--- Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Oliver Kiddle wrote:

> > >   [[ -n "$PREFIX$SUFFIX" ]] 
> In the case you described next: If the word to complete is empty I
> want
> it to both display the message and complete options.  I noticed that
> only when I had implemented (before, we were discussing only two
> cases:
> message *or* options).

But if the word is empty, and the pattern matches, it does offer both
message and options. I think this check should come before the
_message and an empty $PREFIX$SUFFIX should prevent the failed return.
Like this:
[[ -n $PREFIX$SUFFIX && "$PREFIX$SUFFIX" != $~1 ]] && return 1
The completion for vncserver (patch below) could use this so that it
offers display numbers before the initial `:' is typed.

When, in the first message you say `the new behaviour of completing
options if the action returns non-zero', I would have said that the
behaviour was to be not claiming to complete the message when actions
return non-zero so that completing other things, like options isn't

> No, -w (now -W since I swapped them), makes it complete options
> regardless of the return value of the action.  What you're seeing
> here
> is the new default behaviour of trying to complete options if the
> action returns non-zero.

Oh. I thought it was going to not complete single letter options
unless it had -W and -s and always complete long options. So how do I
get _pine to work properly (use of _guard for _pine also in the

pine -cr4 produces an error message

so pine -r<tab> offers other single letter options including -c pine
-c<tab> should offer -conf, -character-set etc but not other single
letter options like -r. It should also offer numbers. I thought the
_arguments -W option was going to allow it to offer single letter
options like -r for any command which allows options between an option
and its argument where they are all in the same word. So -W wouldn't be
used for pine and the -r option wouldn't be offered between -c and its
number argument.

> I was hoping for something short, but still alluding to `matching',
> in
> case we come up with other kinds of tests by which we want to
> `guard'.
> But maybe those could then be integrated into _guard and selected via
> options or something.

It can always be renamed if we think of a better name or change it's


Index: Completion/Base/Utility/.distfiles
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/.distfiles,v
retrieving revision 1.1
diff -u -r1.1 .distfiles
--- Completion/Base/Utility/.distfiles	2001/04/02 12:42:44	1.1
+++ Completion/Base/Utility/.distfiles	2001/04/26 13:52:06
@@ -2,7 +2,7 @@
 _alternative      _call_program     _nothing          _sub_commands
 _arg_compile      _combination      _regex_arguments  _values
-_arguments        _contexts         _retrieve_cache
+_arguments        _contexts         _retrieve_cache   _guard
 _cache_invalid    _describe         _sep_parts
 _call_function    _multi_parts      _store_cache
Index: Completion/Unix/Command/_pine
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_pine,v
retrieving revision 1.1
diff -u -r1.1 _pine
--- Completion/Unix/Command/_pine	2001/04/13 18:42:15	1.1
+++ Completion/Unix/Command/_pine	2001/04/26 13:52:06
@@ -31,11 +31,11 @@
   "($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" \
+  "($opts $send)-c+[specify context to apply to -f arg]:number:_guard '[0-9]#'" \
   "($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" \
+  "($opts $send)-n+[entry in index to begin on]:number:_guard '[0-9]#'" \
   "($opts $send)-o[open first folder read-only]" \
   "(-F -h)-r[restricted - can only send mail to oneself]" \
   "(${opts#-F})-k[force use of function keys]" \
Index: Completion/X/Command/.distfiles
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/.distfiles,v
retrieving revision 1.1
diff -u -r1.1 .distfiles
--- Completion/X/Command/.distfiles	2001/04/02 12:43:42	1.1
+++ Completion/X/Command/.distfiles	2001/04/26 13:52:06
@@ -1,5 +1,5 @@
 _gv        _netscape  _xauth     _xfig      _xrdb      _xterm     _xwit
-_nedit     _x_utils   _xdvi      _xmodmap   _xset      _xv
+_nedit     _vnc       _x_utils   _xdvi      _xmodmap   _xset      _xv
Index: Completion/X/Command/_vnc
RCS file: _vnc
diff -N _vnc
--- /dev/null	Mon Dec 11 17:26:27 2000
+++ _vnc	Thu Apr 26 06:52:06 2001
@@ -0,0 +1,32 @@
+#compdef vncserver vncviewer
+local displays args
+displays=( ~/.vnc/$HOST:?.pid(N:r:t:s/$HOST//) )
+displays=( \\${^displays} ) 
+case $service in
+  vncserver)
+    # currently lacking Xvnc arguments
+    _arguments \
+      - start \
+	'-name:desktop name:_x_name' \
+	'-geometry:geometry:(1600x1200 1280x1024 1152x864 1024x768 800x600 640x480)' \
+	'-depth:pixel depth:(8 16 24 32)' \
+	'-pixelformat:pixel format' \
+	'1::display number:_guard ":[0-9]#"' \
+      - kill \
+	"-kill:display number:($displays)" \
+      - help \
+	'-help'
+  ;;
+  vncviewer) 
+    # should allow list for -encodings
+    _xt_arguments -shared -viewonly -fullscreen -bgr233 -owncmap -truecolour \
+      '-encodings:encodings:(copyrect hextile corre rre raw)' \
+      '-depth:depth' \
+      '-passwd:file:_files' \
+      '(1)-listen:display number' \
+      '(-listen)1::display:_x_display'
+  ;;

Messages sorted by: Reverse Date, Date, Thread, Author