zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: _arguments (was: Re: option and case insensitive matcher-list.)
Date: Tue, 16 May 2000 13:11:38 +0200 (MET DST)	[thread overview]
Message-ID: <200005161111.NAA27123@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Tanaka Akira's message of 16 May 2000 08:05:27 +0900


Tanaka Akira wrote:

> Z(4):akr@serein% Src/zsh -f
> serein% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst
> serein% _tst () { _arguments '-o+:o: _message x' -O }
> serein% zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}'
> serein% tst -o<TAB>
> ->
> serein% tst -O 
> 
> Is this intentional?  I like that `x' is displayed in this case,
> though.

Of course, you'll get the `x' only if the format style is set...

But yes, the behaviour is a bit weird.


In another message:

> This patch modifies _diff_options to use =-.
> 
> Apart from that, I found another use of optional argument in _a2ps:
> 
>            "--pretty-print*::style:(${_a2ps_cache_values[1]})" \
>            ...
> 
> But this is a description for automatic option detection.  Is there a
> way to specify that it should use `=-'?

Umpf. No, currently not and I can't think of a good syntax. Does
anyone have suggestion? (Of course we could just put it before the
`--' with a normal spec, but I'd like to find a way to specify such
things for the auto-detection descriptions...)


Bye
 Sven

Index: Completion/Base/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_arguments,v
retrieving revision 1.17
diff -u -r1.17 _arguments
--- Completion/Base/_arguments	2000/05/12 14:36:46	1.17
+++ Completion/Base/_arguments	2000/05/16 11:09:55
@@ -163,7 +163,7 @@
 zstyle -s ":completion:${curcontext}:options" auto-description autod
 
 if (( $# )) && comparguments "$multi[@]" "$autod" "$@"; then
-  local action noargs aret expl local
+  local action noargs aret expl local tried
   local next direct odirect equal single match matched ws tmp1 tmp2 tmp3
   local opts subc tc prefix suffix descrs actions subcs
   local origpre="$PREFIX" origipre="$IPREFIX"
@@ -244,6 +244,7 @@
 
 	      _message "$descr"
 	      mesg=yes
+	      tried=yes
 
             elif [[ "$action" = \(\(*\)\) ]]; then
 
@@ -252,6 +253,7 @@
               eval ws\=\( "${action[3,-3]}" \)
 
               _describe -t "$subc" "$descr" ws -M "$match" "$subopts[@]"
+	      tried=yes
 
             elif [[ "$action" = \(*\) ]]; then
 
@@ -259,6 +261,7 @@
 
               _all_labels "$subc" expl "$descr" \
                   compadd "$subopts[@]" - ${=action[2,-2]}
+	      tried=yes
             elif [[ "$action" = \{*\} ]]; then
 
               # A string in braces is evaluated.
@@ -266,6 +269,7 @@
               while _next_label "$subc" expl "$descr"; do
                 eval "$action[2,-2]"
               done
+	      tried=yes
             elif [[ "$action" = \ * ]]; then
 
               # If the action starts with a space, we just call it.
@@ -274,6 +278,7 @@
               while _next_label "$subc" expl "$descr"; do
                 "$action[@]"
               done
+	      tried=yes
             else
 
               # Otherwise we call it with the description-arguments.
@@ -282,6 +287,7 @@
               while _next_label "$subc" expl "$descr"; do
                 "$action[1]" "$subopts[@]" "$expl[@]" "${(@)action[2,-1]}"
 	      done
+	      tried=yes
             fi
           fi
         fi
@@ -294,7 +300,7 @@
           { [[ -n "$ismulti" ]] ||
             ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
             [[ "$origpre" = [-+]* ||
-               ( -z "$aret$mesg" && nm -eq compstate[nmatches] ) ]] } ; then
+               ( -z "$aret$mesg" && -z "$tried" ) ]] } ; then
 	local prevpre="$PREFIX" previpre="$IPREFIX"
 
 	hasopts=yes
@@ -351,6 +357,7 @@
 	PREFIX="$prevpre"
 	IPREFIX="$previpre"
       fi
+      [[ -n "$tried" ]] && break
     done
     if [[ -n "$opts" && -z "$aret$matched$mesg" &&
           nm -eq compstate[nmatches] ]]; then

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-05-16 11:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-16 11:11 Sven Wischnowsky [this message]
2000-05-16 15:08 ` Andrej Borsenkow

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=200005161111.NAA27123@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.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).