zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Subject: Re: tag-order problem?
Date: Mon, 28 May 2001 12:30:36 +0200 (MET DST)	[thread overview]
Message-ID: <200105281030.MAA06745@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: <hvo66elsu85.fsf@flux.etl.go.jp>

Tanaka Akira wrote:

> In article <200105280826.KAA00483@beta.informatik.hu-berlin.de>,
>   Sven Wischnowsky <wischnow@informatik.hu-berlin.de> writes:
> 
> > I know this isn't nice, but I didn't see a good solution and still don't
> > see one.  This is `caused' by the default value for tag-order which
> > makes arguments and value be preferred over options (as mentioned in the
> > docs for the tag-order style).
> 
> Hm.  zsh-4.0.1-pre-3 works as I expected.
> 
> Z(2):akr@flux% zsh-4.0.1-pre-3 -f
> flux% bindkey -e; autoload -U compinit; compinit -D
> flux% zstyle '*' group-name ''
> flux% zstyle '*:messages' format '%d'
> flux% zstyle '*:descriptions' format '%d'
> flux% zstyle ':completion:*' 'tag-order' '*:-non-cvs' '*'
> flux% zstyle ':completion:*-non-cvs' 'ignored-patterns' '(*/|)CVS'
> flux% compdef _tst tst
> flux% _tst () { _arguments -s '-a-:x:' '-b' }
> flux% tst -a<TAB>
> x
> 
> 
> zsh-4.0.1-pre-4 works as zsh-4.0.1-pre-5.  So I suspect the problem is
> introduced by some patch between pre-3 and pre-4.  Maybe `-W' related
> thing?

Hm, yes.  Still the behaviour seems sensible, somehow.

Anyway. Anyone interested could try the patch below, which gives what
you expect in this case. The question is whether this breaks any of the
examples we had for inventing the -w and -W options. I don't think I'll
have the time to test those today.

Bye
  Sven

Index: Completion/Base/Utility/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_arguments,v
retrieving revision 1.5
diff -u -r1.5 _arguments
--- Completion/Base/Utility/_arguments	2001/04/26 14:40:11	1.5
+++ Completion/Base/Utility/_arguments	2001/05/28 10:29:51
@@ -233,7 +233,7 @@
 	descr="$descrs[anum]"
 	subc="$subcs[anum++]"
 
-        if [[ -n "$matched" ]] || _requested "$subc"; then
+        if [[ -z "$tried" ]] && { [[ -n "$matched" ]] || _requested "$subc" }; then
 
           curcontext="${oldcontext%:*}:$subc"
 
@@ -328,7 +328,8 @@
         fi
       done
       if [[ -z "$hasopts" &&
-            ( -z "$matched" || -n "$alwopt" ) &&
+            -z "$matched" &&
+            ( -z "$tried" || -n "$alwopt" ) &&
             ( -z "$aret" || "$PREFIX" = "$origpre" ) ]] &&
           _requested options &&
           { ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
@@ -389,7 +390,8 @@
       [[ -n "$tried" && "${${alwopt:+$origpre}:-$PREFIX}" != [-+]* ]] && break
     done
     if [[ -n "$opts" && -z "$aret" &&
-          ( -z "$matched$mesg" || -n "$alwopt" ) &&
+          -z "$matched" &&
+          ( -z "$tried" || -n "$alwopt" ) &&
           nm -eq compstate[nmatches] ]]; then
 
       PREFIX="$origpre"

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


  reply	other threads:[~2001-05-28 10:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-26 16:24 Tanaka Akira
2001-05-28  8:26 ` Sven Wischnowsky
2001-05-28  9:23   ` Tanaka Akira
2001-05-28 10:30     ` Sven Wischnowsky [this message]
2001-05-31 12:35       ` PATCH: " Sven Wischnowsky
2001-05-31 14:15         ` Disowning a stopped job Bart Schaefer
2001-05-31 15:28           ` Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
2001-05-22 20:45 Bart Schaefer
2001-05-29  9:28 ` Sven Wischnowsky
2001-05-29 15:12   ` Bart Schaefer
2001-05-30  7:26     ` Sven Wischnowsky
2001-05-30 13:42     ` 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=200105281030.MAA06745@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --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).