From: Oliver Kiddle <opk@u.genie.co.uk>
To: zsh-workers@sunsite.dk
Subject: Re: problem with _arguments exclusion lists
Date: Thu, 26 Apr 2001 14:55:32 +0100 [thread overview]
Message-ID: <3AE828D4.A2EC6AEE@u.genie.co.uk> (raw)
--- Sven Wischnowsky <wischnow@informatik.hu-berlin.de> 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
blocked.
> 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
patch):
valid
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
behaviour.
Oliver
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 @@
.distfiles
_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 @@
DISTFILES_SRC='
.distfiles
_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'
+ ;;
+esac
+
next reply other threads:[~2001-04-26 13:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-26 13:55 Oliver Kiddle [this message]
2001-04-26 14:35 ` Sven Wischnowsky
2001-05-04 16:20 ` Oliver Kiddle
2001-05-07 11:10 ` Sven Wischnowsky
2001-05-08 11:45 ` Oliver Kiddle
-- strict thread matches above, loose matches on Subject: below --
2001-04-12 14:32 Oliver Kiddle
2001-04-17 9:50 ` Sven Wischnowsky
2001-04-17 10:44 ` Oliver Kiddle
2001-04-17 11:28 ` Sven Wischnowsky
2001-04-17 13:55 ` Oliver Kiddle
2001-04-17 14:10 ` Sven Wischnowsky
2001-04-19 14:01 ` Oliver Kiddle
2001-04-20 8:31 ` Sven Wischnowsky
2001-04-23 8:59 ` Oliver Kiddle
2001-04-24 10:00 ` Sven Wischnowsky
2001-04-26 11:00 ` Oliver Kiddle
2001-04-26 12:10 ` Sven Wischnowsky
2001-04-25 7:10 ` Sven Wischnowsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3AE828D4.A2EC6AEE@u.genie.co.uk \
--to=opk@u.genie.co.uk \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).