zsh-workers
 help / color / mirror / code / Atom feed
* Re: Silly questions about _arguments & Co (and probably bugs)
@ 1999-09-09 13:55 Sven Wischnowsky
  1999-09-09 14:05 ` Andrej Borsenkow
  1999-09-09 15:15 ` Andrej Borsenkow
  0 siblings, 2 replies; 18+ messages in thread
From: Sven Wischnowsky @ 1999-09-09 13:55 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> 1. When are the description of arguments actually printed? I tried some basic
> commands like xterm or patch but descriptions do not seem to be printed.

You need to do `compconf description_format="--- %d"' or something
like that.

> 2. Looks, like `-s' is overloaded - it is used both for "single letter options"
> and for "option aliases" (from _long_options). I believe, this is the reason why
> option aliases do not work any more :-) E.g. ntpd configure lists only --enable
> variant - and now no --disable counterparts are recognised.

No, the `-s' for the long-option stuff is *only* interpreted if it
appears *after* the `--', which needs to be there to make `_arguments'
do this automatic-long-option-stuff at all. The `-s' for `use single
letter options' has to come as the *first* argument.

> 3. I cannot make completion for patch work. As simple as `patch --sTAB' just
> beeps.

Dunno, works for me.

> 4. `patch -pTAB' gives me `patch -p0 ' - but `0' is not autoremoved if I enter
> different number (I'd expect it to be).

I don't get a `0' inserted automatically here.

> 5. `patch TAB' does not list most of the long options at all. Actually, it is
> interesting case - if a command has both long and short form - which one should
> be preferred? I'd like to have short option only if no corresponding short one
> exists.

Again, I get all the long options my `patch --help' prints. Hm, this
and the `--s<TAB>' thing above makes me think that maybe you have a
different version of `patch' with a different `--help' output. I'd
need to see that then.

Otherwise: which version do you have? Which patches?

Bye
 Sven


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


^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: Silly questions about _arguments & Co (and probably bugs)
@ 1999-09-13 14:21 Sven Wischnowsky
  0 siblings, 0 replies; 18+ messages in thread
From: Sven Wischnowsky @ 1999-09-13 14:21 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> Z:akr@is27e1u11% Src/zsh -f 2>z     
> is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
> is27e1u11% compconf group_matches=yes message_format='%d' description_format='%d' describe_options=yes   
> is27e1u11% patch -l<TAB>
> option
> -B   -D   -E   -F   -N   -R   -S   -T   -V   -Y   -Z   -b   -d   -z   
> 
> Completion candidates are not enough.
> 
> With `set -x', zsh reports:
> 
> ...
> +_arguments:680> uns=-ignore-whitespacel 
> ...
> 
> Hm. Exclusive long options should not used for `uns'.

Yep.

Bye
 Sven

diff -u oldcompletion/Base/_arguments Completion/Base/_arguments
--- oldcompletion/Base/_arguments	Mon Sep 13 15:46:24 1999
+++ Completion/Base/_arguments	Mon Sep 13 16:21:02 1999
@@ -561,7 +561,7 @@
           uns="${ws[1][2,-1]}"
 
       if [[ -n "$uns" ]]; then
-        uns="${(@j::)${(v)=xors[(I)${ws[1][1]}[$uns]]}#[-+]}"
+        uns="${(@j::)${(M@)${(v)=xors[(I)${ws[1][1]}[$uns]]}:#??}#[-+]}"
 	if  [[ -n "$uns" ]]; then
 	  tmp=(
 	    "opts[${(@)^opts[(I)${ws[1][1]}[$uns]]}]"
@@ -677,11 +677,11 @@
     done
   fi
 
-  [[ -n "$sopts" && -n "$opt" && "$PREFIX" = [-+]${~soptseq}[$sopts] ]] && \
+  [[ -n "$sopts" && -n "$opt" && "$PREFIX" = [-+]${~soptseq}[$sopts] ]] &&
       uns="${PREFIX[2,-1]}"
 
   if [[ -n "$uns" ]]; then
-    uns="${(@j::)${(v)=xors[(I)${ws[1][1]}[$uns]]}#[-+]}"
+    uns="${(@j::)${(M@)${(v)=xors[(I)${ws[1][1]}[$uns]]}:#??}#[-+]}"
     if [[ -n "$uns" ]]; then
       tmp=(
         "opts[${(@)^opts[(I)${pre[1]}[$uns]]}]"

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


^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: Silly questions about _arguments & Co (and probably bugs)
@ 1999-09-13 11:56 Sven Wischnowsky
  1999-09-13 13:57 ` Tanaka Akira
  0 siblings, 1 reply; 18+ messages in thread
From: Sven Wischnowsky @ 1999-09-13 11:56 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> I think `compconf option_prefix=all' is useful.

(Btw, the value of option_prefix isn't used any more -- only whether
it's empty or not.)

> And, I found another problem. `patch -f<TAB>' does not show list of
> completion candidates. However completion itself works well.
> 
> ...
> 
> So, I think this is the problem of `_display'.

Almost. There were two problems: with single-letter options
PREFIX/SUFFIX weren't cleared before `_display' was called (so that
(almost) no option matched) and the return value of `_display' wasn't
used to find out that `_arguments' should create the list itself.

Bye
 Sven

diff -u -r oldcompletion/Base/_arguments Completion/Base/_arguments
--- oldcompletion/Base/_arguments	Mon Sep 13 13:13:10 1999
+++ Completion/Base/_arguments	Mon Sep 13 13:51:43 1999
@@ -822,12 +822,17 @@
     if [[ -n "$sopts" && -n "$PREFIX" &&
       "$PREFIX" = [-+]${~soptseq}[$sopts] ]]; then
       if [[ "$PREFIX" = [-+]${~soptseq1} ]]; then
-        if [[ -n "$compconfig[describe_options]" &&
-              "$compconfig[describe_options]" != *\!${cmd}* ]]; then
-          _display tmp odescr
-        else
-          tmp="( ${(j: :)${(@)${(@M)${=:-${(k)opts} ${(k)dopts} ${(k)odopts}}:#[-+]?(|=)}#?}%=} )"
+        local dpre="$PREFIX" dsuf="$SUFFIX"
+
+	PREFIX=''
+	SUFFIX=''
+        if [[ -z "$compconfig[describe_options]" ||
+              "$compconfig[describe_options]" = *\!${cmd}* ]] ||
+           ! _display tmp odescr; then
+          tmp=( "${dpre[1]}${(@o)^${(@)${(@M)${=:-${(k)opts} ${(k)dopts} ${(k)odopts}}:#[-+]?(|=)}#?}%=}" )
         fi
+	PREFIX="$dpre"
+	SUFFIX="$dsuf"
         compadd "$expl[@]" -Q -M 'r:|[_-]=* r:|=*' -y tmp - \
                 "${PREFIX}${(@k)^opts[(I)${PREFIX[1]}?]#?}" \
 	        "${PREFIX}${(@k)^dopts[(I)${PREFIX[1]}?]#?}" \

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


^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: Silly questions about _arguments & Co (and probably bugs)
@ 1999-09-09 14:27 Sven Wischnowsky
  1999-09-09 22:01 ` Tanaka Akira
  0 siblings, 1 reply; 18+ messages in thread
From: Sven Wischnowsky @ 1999-09-09 14:27 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> > > 2. Looks, like `-s' is overloaded - it is used both for "single
> > letter options"
> > > and for "option aliases" (from _long_options). I believe, this is
> > the reason why
> > > option aliases do not work any more :-) E.g. ntpd configure lists
> > only --enable
> > > variant - and now no --disable counterparts are recognised.
> >
> > No, the `-s' for the long-option stuff is *only* interpreted if it
> > appears *after* the `--', which needs to be there to make `_arguments'
> > do this automatic-long-option-stuff at all. The `-s' for `use single
> > letter options' has to come as the *first* argument.
> 
> O.K., I overlooked it (not that I like it either).

The alternative would be to have an option that says that `cmd --help'
should be called and to have a (yet another) syntax for the long-option-
patterns/descriptions. This would make parsing a bit slower and since
these descriptions are used in a completely different way than the
other descriptions they should be grouped together anyway (I think).

But if enough people complain...

> But, still, aliasing does not
> work any more. Just try
> 
> ./configure --dis-z-m
> 
> It should complete to --disable-zsh-memory - but it does not.

Yep, should be fixed with the patch below.

Bye
 Sven

diff -u oldcompletion/Base/_arguments Completion/Base/_arguments
--- oldcompletion/Base/_arguments	Thu Sep  9 16:12:19 1999
+++ Completion/Base/_arguments	Thu Sep  9 16:22:33 1999
@@ -57,6 +57,8 @@
       # We have to build the long-option cache anew, get the `-i' and
       # `-s' options.
 
+      set -- "${(@)argv[nth+1,-1]}"
+
       iopts=()
       sopts=()
       while [[ "$1" = -[is]* ]]; do
@@ -105,7 +107,7 @@
       # ... and add "same" options
 
       while (( $#sopts )); do
-        lopts=( $lopts ${opts/$sopts[1]/$sopts[2]} )
+        lopts=( $lopts ${lopts/$sopts[1]/$sopts[2]} )
         shift 2 sopts
       done
 

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


^ permalink raw reply	[flat|nested] 18+ messages in thread
* Silly questions about _arguments & Co (and probably bugs)
@ 1999-09-09 13:13 Andrej Borsenkow
  1999-09-09 13:54 ` Tanaka Akira
  0 siblings, 1 reply; 18+ messages in thread
From: Andrej Borsenkow @ 1999-09-09 13:13 UTC (permalink / raw)
  To: ZSH workers mailing list

Forgive me, but I recently had no time to follow all discussions and do not
quite understand the manual description.

1. When are the description of arguments actually printed? I tried some basic
commands like xterm or patch but descriptions do not seem to be printed.

2. Looks, like `-s' is overloaded - it is used both for "single letter options"
and for "option aliases" (from _long_options). I believe, this is the reason why
option aliases do not work any more :-) E.g. ntpd configure lists only --enable
variant - and now no --disable counterparts are recognised.

3. I cannot make completion for patch work. As simple as `patch --sTAB' just
beeps.

4. `patch -pTAB' gives me `patch -p0 ' - but `0' is not autoremoved if I enter
different number (I'd expect it to be).

5. `patch TAB' does not list most of the long options at all. Actually, it is
interesting case - if a command has both long and short form - which one should
be preferred? I'd like to have short option only if no corresponding short one
exists.

TIA

/andrej


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~1999-09-13 14:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-09 13:55 Silly questions about _arguments & Co (and probably bugs) Sven Wischnowsky
1999-09-09 14:05 ` Andrej Borsenkow
1999-09-09 15:15 ` Andrej Borsenkow
1999-09-09 15:44   ` Tanaka Akira
1999-09-09 16:02     ` More _patch problems " Andrej Borsenkow
1999-09-09 16:04   ` CVS and patch Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
1999-09-13 14:21 Silly questions about _arguments & Co (and probably bugs) Sven Wischnowsky
1999-09-13 11:56 Sven Wischnowsky
1999-09-13 13:57 ` Tanaka Akira
1999-09-09 14:27 Sven Wischnowsky
1999-09-09 22:01 ` Tanaka Akira
1999-09-09 13:13 Andrej Borsenkow
1999-09-09 13:54 ` Tanaka Akira
1999-09-09 14:26   ` Andrej Borsenkow
1999-09-09 14:32     ` Tanaka Akira
1999-09-09 14:34       ` Andrej Borsenkow
1999-09-09 14:45         ` Tanaka Akira
1999-09-09 15:02           ` Andrej Borsenkow

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).