From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11709 invoked from network); 25 Feb 2002 09:08:03 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 25 Feb 2002 09:08:03 -0000 Received: (qmail 3073 invoked by alias); 25 Feb 2002 09:07:58 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16708 Received: (qmail 3061 invoked from network); 25 Feb 2002 09:07:58 -0000 From: Sven Wischnowsky MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15481.65207.952945.92340@wischnow.berkom.de> Date: Mon, 25 Feb 2002 10:07:03 +0100 To: zsh-workers@sunsite.dk Subject: Re: new fake style, completion grouping etc In-Reply-To: <20020206093357.40994.qmail@web9305.mail.yahoo.com> References: <15456.1849.401288.393433@wischnow.berkom.de> <20020206093357.40994.qmail@web9305.mail.yahoo.com> X-Mailer: VM 6.95 under 21.5 (patch 3) "asparagus" XEmacs Lucid Oliver Kiddle wrote: > ... > > I'm fairly convinced _guard needs to be using _message's -e so we need > something. If you do use the group name it should perhaps be well > commented in _guard though as it would otherwise confuse someone > someday. Seems I've woken up. The functions handling tags set $curtag to contain the name of the tag currently being completed. As long as all functions are used in the right way, this should be entirely usable inside _guard so we don't need to give it an extra argument. Especially since _guard is only really intended to be used from _arguments or similar functions. Actually, I've made `_message -e' use $curtag if it is invoked with only one argument (the message). This should make use of it even simpler for many cases. The patch also contains a cleanup-hunk for the C-code where I accidentally left some code #if'ed out. This patch does not move the lookup of the fake style into other utility functions. Now that _guard seems to work I'm getting reluctant to do that -- and for the case we were discussing (the cvs-admin-k-case) it wouldn't help anyway because that problem was caused by the fake-code calling _describe. I still don't know how this -[JV]-group- thing can be cleanly solved. The patch also doesn't contain the change to make _description use a differnet style name for -x-descriptions. Bye Sven Index: Completion/Base/Core/_message =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Base/Core/_message,v retrieving revision 1.3 diff -u -r1.3 _message --- Completion/Base/Core/_message 12 Feb 2002 13:37:04 -0000 1.3 +++ Completion/Base/Core/_message 25 Feb 2002 09:04:13 -0000 @@ -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 Index: Completion/Base/Utility/_guard =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_guard,v retrieving revision 1.1 diff -u -r1.1 _guard --- Completion/Base/Utility/_guard 26 Apr 2001 12:13:37 -0000 1.1 +++ Completion/Base/Utility/_guard 25 Feb 2002 09:04:13 -0000 @@ -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" ]] Index: Completion/Unix/Command/_grep =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_grep,v retrieving revision 1.3 diff -u -r1.3 _grep --- Completion/Unix/Command/_grep 6 Aug 2001 16:10:45 -0000 1.3 +++ Completion/Unix/Command/_grep 25 Feb 2002 09:04:13 -0000 @@ -51,7 +51,7 @@ '(--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' ) Index: Completion/Unix/Command/_pbm =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_pbm,v retrieving revision 1.3 diff -u -r1.3 _pbm --- Completion/Unix/Command/_pbm 29 May 2001 17:54:37 -0000 1.3 +++ Completion/Unix/Command/_pbm 25 Feb 2002 09:04:13 -0000 @@ -398,7 +398,7 @@ '-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' ;; Index: Completion/Unix/Command/_pine =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_pine,v retrieving revision 1.5 diff -u -r1.5 _pine --- Completion/Unix/Command/_pine 21 Feb 2002 06:00:58 -0000 1.5 +++ Completion/Unix/Command/_pine 25 Feb 2002 09:04:13 -0000 @@ -34,11 +34,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:_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=)" \ Index: Completion/X/Command/_vnc =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/X/Command/_vnc,v retrieving revision 1.4 diff -u -r1.4 _vnc --- Completion/X/Command/_vnc 19 Dec 2001 15:10:40 -0000 1.4 +++ Completion/X/Command/_vnc 25 Feb 2002 09:04:13 -0000 @@ -13,7 +13,7 @@ '-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 \ Index: Doc/Zsh/compsys.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v retrieving revision 1.145 diff -u -r1.145 compsys.yo --- Doc/Zsh/compsys.yo 18 Feb 2002 14:36:01 -0000 1.145 +++ Doc/Zsh/compsys.yo 25 Feb 2002 09:04:14 -0000 @@ -3673,7 +3673,7 @@ 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 @@ 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 @@ ) 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 @@ 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))( Index: Src/Zle/compcore.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v retrieving revision 1.54 diff -u -r1.54 compcore.c --- Src/Zle/compcore.c 18 Feb 2002 14:30:47 -0000 1.54 +++ Src/Zle/compcore.c 25 Feb 2002 09:04:14 -0000 @@ -1648,10 +1648,6 @@ 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) -- Sven Wischnowsky wischnow@berkom.de