zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: Zsh workers <zsh-workers@sunsite.dk>
Subject: Re: current CVS test failure
Date: Tue, 13 May 2003 10:54:35 +0100	[thread overview]
Message-ID: <23075.1052819675@csr.com> (raw)
In-Reply-To: "Oliver Kiddle"'s message of "Mon, 12 May 2003 12:08:54 +0200." <2414.1052734134@gmcs3.local>

Oliver Kiddle wrote:
> So your -O is probably the best solution.

With documentation added, it now looks like the following.

I notice the option only affects prefix-needed, not prefix-hidden, which
was always handled by _describe.  That's probably OK as this is a matter
for displaying.

Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.169
diff -u -r1.169 compsys.yo
--- Doc/Zsh/compsys.yo	25 Apr 2003 11:19:09 -0000	1.169
+++ Doc/Zsh/compsys.yo	13 May 2003 09:51:39 -0000
@@ -3665,7 +3665,7 @@
 the functions for the fields if they are called.
 )
 findex(_describe)
-item(tt(_describe) [ tt(-o) | tt(-t) var(tag) ] var(descr) var(name1) [ var(name2) ] var(opts) ... tt(-)tt(-) ...)(
+item(tt(_describe) [ tt(-oO) | tt(-t) var(tag) ] var(descr) var(name1) [ var(name2) ] var(opts) ... tt(-)tt(-) ...)(
 This function associates completions with descriptions.
 Multiple groups separated by tt(-)tt(-) can be supplied, potentially with
 different completion options var(opts).
@@ -3688,7 +3688,10 @@
 tt(prefix-needed) and tt(verbose) styles to find out if the strings should
 be added as completions and if the descriptions should be shown.  Without
 the `tt(-o)' option, only the tt(verbose) style is used to decide how
-descriptions are shown.
+descriptions are shown.  If `tt(-O)' is used instead of `tt(-O)', command
+options are completed as above but tt(_describe) will not handle the
+tt(prefix-needed) style which is assumed to be handled by the calling
+function.
 
 With the tt(-t) option a var(tag) can be specified.  The default is
 `tt(values)' or, if the tt(-o) option is given, `tt(options)'.
Index: Completion/Base/Utility/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_arguments,v
retrieving revision 1.14
diff -u -r1.14 _arguments
--- Completion/Base/Utility/_arguments	23 May 2002 12:20:15 -0000	1.14
+++ Completion/Base/Utility/_arguments	13 May 2003 09:51:39 -0000
@@ -387,7 +387,7 @@
 	    tmp1=( "${(M@)tmp1:#[-+]?(|:*)}" )
 	    tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" )
 
-            _describe -o option \
+            _describe -O option \
                       tmp1 tmp2 -Q -S '' -- \
 		      tmp3 -Q
 
@@ -399,7 +399,7 @@
           single=yes
         else
           next=( "$next[@]" "$odirect[@]" )
-          _describe -o option \
+          _describe -O option \
                     next -Q -M "$matcher" -- \
                     direct -QS '' -M "$matcher" -- \
                     equal -QqS= -M "$matcher"
Index: Completion/Base/Utility/_describe
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_describe,v
retrieving revision 1.15
diff -u -r1.15 _describe
--- Completion/Base/Utility/_describe	30 Apr 2003 13:47:55 -0000	1.15
+++ Completion/Base/Utility/_describe	13 May 2003 09:51:39 -0000
@@ -2,7 +2,7 @@
 
 # This can be used to add options or values with descriptions as matches.
 
-local _opt _expl _tmpm _tmpd _mlen
+local _opt _expl _tmpm _tmpd _mlen _noprefix
 local _type=values _descr _ret=1 _showd _nm _hide _args _grp _sep
 local csl="$compstate[list]" csl2
 local _oargv _argv _new _strs _mats _opts _i _try=0
@@ -12,6 +12,10 @@
 if [[ "$1" = -o ]]; then
   _type=options
   shift
+elif [[ "$1" = -O ]]; then
+  _type=options
+  _noprefix=1
+  shift
 elif [[ "$1" = -t ]]; then
   _type="$2"
   shift 2
@@ -19,6 +23,10 @@
   _type="${1[3,-1]}"
   shift
 fi
+
+[[ "$_type$_noprefix" = options && ! -prefix [-+]* ]] && \
+    zstyle -T ":completion:${curcontext}:options" prefix-needed &&
+        return 1
 
 # Do the tests. `showd' is set if the descriptions should be shown.
 

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


  reply	other threads:[~2003-05-13 11:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-30  6:41 Borzenkov Andrey
2003-04-30  9:29 ` Peter Stephenson
2003-04-30 13:39   ` Oliver Kiddle
2003-04-30 13:52     ` Peter Stephenson
2003-04-30 14:30       ` Oliver Kiddle
2003-05-12 10:08       ` Oliver Kiddle
2003-05-13  9:54         ` Peter Stephenson [this message]
2003-05-13 13:27           ` Oliver Kiddle
2003-05-14  9:33             ` Peter Stephenson
2003-05-28 15:15             ` Oliver Kiddle
2003-04-30 13:56     ` Oliver Kiddle
2003-04-30 14:01       ` Borzenkov Andrey

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=23075.1052819675@csr.com \
    --to=pws@csr.com \
    --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).