zsh-workers
 help / color / mirror / code / Atom feed
* 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; 16+ 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] 16+ messages in thread

* Re: Silly questions about _arguments & Co (and probably bugs)
  1999-09-09 14:27 Silly questions about _arguments & Co (and probably bugs) Sven Wischnowsky
@ 1999-09-09 22:01 ` Tanaka Akira
  0 siblings, 0 replies; 16+ messages in thread
From: Tanaka Akira @ 1999-09-09 22:01 UTC (permalink / raw)
  To: zsh-workers

In article <199909091427.QAA03152@beta.informatik.hu-berlin.de>,
  Sven Wischnowsky <wischnow@informatik.hu-berlin.de> writes:

> 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

Hm.

...
+_arguments:60> set -- *strip=NUM*:number:{compadd "$expl[@]" -S0 -r "1-9" - ""} *get=NUM*:get files from RCS etc: *=LINES*:lines: *=PATCHFILE*:patch file:_files *=FILE*:file:_files *=NAME*:name: *=WORD*:quoting style:(literal shell shell-always c escape) *=STYLE*:version control style:(simple numbered existing) *=SUFFIX*:backup file suffix:(.bak) *=DIR*:chdir to:_files -/
...
+_arguments:116> set -- *=FILE*:file:_files *=(DIR|PATH)*:directory:_files -/ *:unknown:
...

So, _arguments forget '*strip=...' ...

Index: Completion/Base/_arguments
===================================================================
RCS file: /projects/zsh/zsh/Completion/Base/_arguments,v
retrieving revision 1.1.1.30
diff -u -F^( -r1.1.1.30 _arguments
--- _arguments	1999/09/09 14:33:42	1.1.1.30
+++ _arguments	1999/09/09 21:54:29
@@ -113,7 +113,7 @@
 
       # Then we walk through the descriptions plus a few builtin ones.
 
-      set -- "${(@)argv[nth+1,-1]}" '*=FILE*:file:_files' \
+      set -- "$@" '*=FILE*:file:_files' \
              '*=(DIR|PATH)*:directory:_files -/' '*:unknown:'
 
       while (( $# )); do
-- 
Tanaka Akira


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

* Re: Silly questions about _arguments & Co (and probably bugs)
@ 1999-09-13 14:21 Sven Wischnowsky
  0 siblings, 0 replies; 16+ 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] 16+ 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, 0 replies; 16+ messages in thread
From: Tanaka Akira @ 1999-09-13 13:57 UTC (permalink / raw)
  To: zsh-workers

In article <199909131156.NAA21019@beta.informatik.hu-berlin.de>,
  Sven Wischnowsky <wischnow@informatik.hu-berlin.de> writes:

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

I found another problem.

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'.
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 16+ 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; 16+ 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] 16+ messages in thread

* Re: Silly questions about _arguments & Co (and probably bugs)
  1999-09-09 15:15 ` Andrej Borsenkow
@ 1999-09-09 15:44   ` Tanaka Akira
  0 siblings, 0 replies; 16+ messages in thread
From: Tanaka Akira @ 1999-09-09 15:44 UTC (permalink / raw)
  To: zsh-workers

In article <000301befad6$1d396a80$21c9ca95@mow.siemens.ru>,
  "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru> writes:

> BTW I find the --use-index-line really useful. I have constant problems with
> cvs-generated patches - either index line is ignored (non-POSIX) or new files
> are not created (POSIX). Anybody knows, how to fix it in pure patch?

Remove the following lines in pch.c.

        if (! posixly_correct && (name[OLD] || name[NEW]) && name[INDEX])
          {
            free (name[INDEX]);
            name[INDEX] = 0;
          }

In article <000401befad6$ad291a50$21c9ca95@mow.siemens.ru>,
  "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru> writes:

> Running under dtterm with 24x80 size and doing
> 
> patch TAB
> 
> creates a select listing longer than screen size. At least, if I do it in a
> directory with ~ 15 files.

I think `compconf option_prefix=all' is useful.

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

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 -f<TAB>
option

is27e1u11% set -x
is27e1u11% patch -f<TAB>
...
+_display:31> compadd -D _arr -  --backup-if-mismatch --backup --basename-prefix --batch --binary --context --directory --dry-run --ed --force --forward --fuzz --get --help --ifdef --ignore-whitespace --input --no-backup-if-mismatch --normal --output --patch-root --posix --prefix --quiet --quoting-style --reject-file --remove-empty-files --reverse --set-time --set-utc --strip --suffix --unified --use-index-line --verbose --version-control --version -B -D -E -F -N -R -S -T -V -Y -Z -b -d -g -i -l -n -p -s -t -u -v -z
+_display:33> [[ o != ( ]]
+_display:33> eval odescr=( "$_arr[@]" )
+_display:33> odescr=( ) 
+_display:35> ((  0  ))
+_display:79> eval tmp=''
+_display:79> tmp= 
+_display:80> return 1
+_arguments:826> compadd -J option -X option -Q -M r:|[_-]=* r:|=* -y tmp - -fR -fS -fT -fZ -fb -fl -fn -fs -ft -fu -fv -fE -fN -fB -fd -fD -fV -fg -fF -fi -fz -fY -fp
...
+_main_complete:101> return ret

option

So, I think this is the problem of `_display'.
-- 
Tanaka Akira


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

* 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
  1999-09-09 15:44   ` Tanaka Akira
  1 sibling, 1 reply; 16+ messages in thread
From: Andrej Borsenkow @ 1999-09-09 15:15 UTC (permalink / raw)
  To: zsh-workers

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

This works now. Most probably, it was the 7750 that did the trick.

BTW I find the --use-index-line really useful. I have constant problems with
cvs-generated patches - either index line is ignored (non-POSIX) or new files
are not created (POSIX). Anybody knows, how to fix it in pure patch?

cheers

/andrej


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

* RE: Silly questions about _arguments & Co (and probably bugs)
  1999-09-09 14:45         ` Tanaka Akira
@ 1999-09-09 15:02           ` Andrej Borsenkow
  0 siblings, 0 replies; 16+ messages in thread
From: Andrej Borsenkow @ 1999-09-09 15:02 UTC (permalink / raw)
  To: Tanaka Akira; +Cc: ZSH workers mailing list

>
> (1) Did you really apply patch-2.5.4-akr-19990902.patch?
>

Ah ... I understood it so, that I need this option to apply your patch.

Yes I applied it, and installed patch and still have the same problem. E.g.

bor@itsrm2:/tools/src/patch-2.5.4%> patch --TAB
--backup-if-mismatch      --help                    --quoting-style
--binary                  --no-backup-if-mismatch   --verbose
--dry-run                 --posix

As you see, most of options are not printed. This is with your patch for patch
:-)

Seems, that sources are getting out of sync somehow. Here is my version of
_patch (without the last -p correction):

bor@itsrm2:/tools/src/patch-2.5.4%> which _patch
_patch () {
        _arguments -s '(--strip)-p+:number:(0)' '(--fuzz)-F+:lines:'
'(--context)-c' '(--ed)-e' '(--force)-f' '(--batch)-t' '(--ignore-whitespace)-l'
'(--normal)-n' '(--forward)-N' '(--reverse)-R' '(--silent --quiet)-s'
'(--skip)-S' '(--unified)-u' '(--version)-v' -{E,Z,T} '-i+:patch file:_files'
'(--output)-o+:output file:_files' '(--reject-file)-r+:reject file:_files'
'(--ifdef)-D+:name:' '(--version-control)-V+:version control style:(simple
numbered existing)' '(--prefix)-B+:backup path prefix:' '(--suffix)-b:backup
extension:' '-Y+:backup basename prefix:_files' '-z+:backup file suffix:(.bak)'
'-g+:NUM:' '(--directory)-d+:chdir to:_files -/' ':original file:_files' ':patch
file:_files' -- '*=NUM*:number:(0)' '*=LINES*:lines:' '*=PATCHFILE*:patch
file:_files' '*=FILE*:file:_files' '*=NAME*:name:' '*=WORD*:quoting
style:(literal shell shell-always c escape)' '*=STYLE*:version control
style:(simple numbered existing)' '*=SUFFIX*:backup file suffix:(.bak)'
'*=DIR*:chdir to:_files -/'
}

And just to be sure

bor@itsrm2:/tools/src/patch-2.5.4%> sum /tools/share/zsh/functions/_arguments
21710 49 /tools/share/zsh/functions/_arguments
bor@itsrm2:/tools/src/zsh-3.1.6-pws-3%> ll /tools/share/zsh/functions/_arguments
-rw-r--r--   1 root     other      24783 Sep  9 16:18
/tools/share/zsh/functions/_arguments




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

* Re: Silly questions about _arguments & Co (and probably bugs)
  1999-09-09 14:34       ` Andrej Borsenkow
@ 1999-09-09 14:45         ` Tanaka Akira
  1999-09-09 15:02           ` Andrej Borsenkow
  0 siblings, 1 reply; 16+ messages in thread
From: Tanaka Akira @ 1999-09-09 14:45 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: ZSH workers mailing list

In article <000101befad0$7e386800$21c9ca95@mow.siemens.ru>,
  "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru> writes:

> bor@itsrm2:/tools/src/patch-2.5.4%> patch --use-index-line 
> patch: unrecognized option `--use-index-line'
> patch: Try `patch --help' for more information.

Hm.

(1) Did you really apply patch-2.5.4-akr-19990902.patch?

# The access_log say no one get it today.

(2) (Assuming my access_log is broken, ) Did you install patch command
    or path contains `.' in first?

> bor@itsrm2:/tools/src/patch-2.5.4%> patch --version       

Since I didn't change version information, so it is not problem.
-- 
Tanaka Akira


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

* RE: Silly questions about _arguments & Co (and probably bugs)
  1999-09-09 14:32     ` Tanaka Akira
@ 1999-09-09 14:34       ` Andrej Borsenkow
  1999-09-09 14:45         ` Tanaka Akira
  0 siblings, 1 reply; 16+ messages in thread
From: Andrej Borsenkow @ 1999-09-09 14:34 UTC (permalink / raw)
  To: Tanaka Akira, ZSH workers mailing list

> 
> Use `--use-index-line' instead of `--use-index-lines'.
> 

Ahem ...

bor@itsrm2:/tools/src/patch-2.5.4%> patch --use-index-line 
patch: unrecognized option `--use-index-line'
patch: Try `patch --help' for more information.
bor@itsrm2:/tools/src/patch-2.5.4%> patch --version       
patch 2.5.4
Copyright 1984-1988 Larry Wall
Copyright 1989-1999 Free Software Foundation, Inc.

This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

written by Larry Wall and Paul Eggert


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

* Re: Silly questions about _arguments & Co (and probably bugs)
  1999-09-09 14:26   ` Andrej Borsenkow
@ 1999-09-09 14:32     ` Tanaka Akira
  1999-09-09 14:34       ` Andrej Borsenkow
  0 siblings, 1 reply; 16+ messages in thread
From: Tanaka Akira @ 1999-09-09 14:32 UTC (permalink / raw)
  To: ZSH workers mailing list

In article <000001befacf$4abbf9c0$21c9ca95@mow.siemens.ru>,
  "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru> writes:

> bor@itsrm2:/tools/src/patch-2.5.4%> patch --use-index-lines
> patch: unrecognized option `--use-index-lines'
> patch: Try `patch --help' for more information.

Use `--use-index-line' instead of `--use-index-lines'.

> In any case, is it the official patch that will be included into main branch?

Although I sent (bit prior version of) the patch to bug-gnu-utils at
8/14, there is no response until now.
-- 
Tanaka Akira


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

* RE: Silly questions about _arguments & Co (and probably bugs)
  1999-09-09 13:54 ` Tanaka Akira
@ 1999-09-09 14:26   ` Andrej Borsenkow
  1999-09-09 14:32     ` Tanaka Akira
  0 siblings, 1 reply; 16+ messages in thread
From: Andrej Borsenkow @ 1999-09-09 14:26 UTC (permalink / raw)
  To: Tanaka Akira, ZSH workers mailing list

> 
> # This patch also contains other functionality. If you have trouble to
> # apply my patches, please try it and use --use-index-line.
> 

??? 

bor@itsrm2:/tools/src/patch-2.5.4%> patch --use-index-lines
patch: unrecognized option `--use-index-lines'
patch: Try `patch --help' for more information.

In any case, is it the official patch that will be included into main branch?

/andrej


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

* 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
  1 sibling, 0 replies; 16+ messages in thread
From: Andrej Borsenkow @ 1999-09-09 14:05 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers

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


>
> Otherwise: which version do you have? Which patches?
>

3.1.6-pws-3 with patches up to 7740 (including 2576,2578 from zsh-users).
patch-2.5.3. Help output looks like:


bor@itsrm2:/tools/src/zsh-3.1.6-pws-3%> patch --help
Usage: patch [OPTION]... [ORIGFILE [PATCHFILE]]

Input options:

  -p NUM  --strip=NUM  Strip NUM leading components from file names.
  -F LINES  --fuzz LINES  Set the fuzz factor to LINES for inexact matching.
  -l  --ignore-whitespace  Ignore white space changes between patch and input.

  -c  --context  Interpret the patch as a context difference.
  -e  --ed  Interpret the patch as an ed script.
  -n  --normal  Interpret the patch as a normal difference.
  -u  --unified  Interpret the patch as a unified difference.

  -N  --forward  Ignore patches that appear to be reversed or already applied.
  -R  --reverse  Assume patches were created with old and new files swapped.

  -i PATCHFILE  --input=PATCHFILE  Read patch from PATCHFILE instead of stdin.

Output options:

  -o FILE  --output=FILE  Output patched files to FILE.
  -r FILE  --reject-file=FILE  Output rejects to FILE.

  -D NAME  --ifdef=NAME  Make merged if-then-else output using NAME.
  -E  --remove-empty-files  Remove output files that are empty after patching.

  -Z  --set-utc  Set times of patched files, assuming diff uses UTC (GMT).
  -T  --set-time  Likewise, assuming local time.

  --quoting-style=WORD   output file names using quoting style WORD.
    Valid WORDs are: literal, shell, shell-always, c, escape.
    Default is taken from QUOTING_STYLE env variable, or 'shell' if unset.

Backup and version control options:

  -b  --backup  Back up the original contents of each file.
  --backup-if-mismatch  Back up if the patch does not match exactly.
  --no-backup-if-mismatch  Back up mismatches only if otherwise requested.

  -V STYLE  --version-control=STYLE  Use STYLE version control.
        STYLE is either 'simple', 'numbered', or 'existing'.
  -B PREFIX  --prefix=PREFIX  Prepend PREFIX to backup file names.
  -Y PREFIX  --basename-prefix=PREFIX  Prepend PREFIX to backup file basenames.
  -z SUFFIX  --suffix=SUFFIX  Append SUFFIX to backup file names.

  -g NUM  --get=NUM  Get files from RCS etc. if positive; ask if negative.

Miscellaneous options:

  -t  --batch  Ask no questions; skip bad-Prereq patches; assume reversed.
  -f  --force  Like -t, but ignore bad-Prereq patches, and assume unreversed.
  -s  --quiet  --silent  Work silently unless an error occurs.
  --verbose  Output extra information about the work being done.
  --dry-run  Do not actually change any files; just print what would happen.
  --posix  Conform to the POSIX standard.

  -d DIR  --directory=DIR  Change the working directory to DIR first.
  --binary  Read and write data in binary mode (no effect on this platform).

  -v  --version  Output version info.
  --help  Output this help.

Report bugs to <bug-gnu-utils@gnu.org>.

/andrej


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

* 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; 16+ 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] 16+ messages in thread

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

In article <001101befac5$29ae4260$21c9ca95@mow.siemens.ru>,
  "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru> writes:

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

Use following.

% compconf group_matches=yes message_format='%d' description_format='%d' describe_options=yes

If it is too verbose, also use following.

% compconf option_prefix=all

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

Probably this is because the help text of patch command is not suited
for _arguments.

the help text of patch-2.5.4 contains:

  -p NUM  --strip=NUM  Strip NUM leading components from file names.
  -F LINES  --fuzz LINES  Set the fuzz factor to LINES for inexact matching.

Although I suppose that it is possible to handle `--strip=NUM', but
`--fuzz LINES' are very difficult.

So, I modified the help text.

http://www.ldl.jaist.ac.jp/~akr/junk/patch-2.5.4-akr-19990902.patch

# This patch also contains other functionality. If you have trouble to
# apply my patches, please try it and use --use-index-line.

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

I see.

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

This is caused by the help text handling failure. Currently _arguments
doesn't handle preferences of options, I think.

Index: Completion/User/_patch
===================================================================
RCS file: /projects/zsh/zsh/Completion/User/_patch,v
retrieving revision 1.1.1.4
diff -u -F^( -r1.1.1.4 _patch
--- _patch	1999/09/07 12:55:07	1.1.1.4
+++ _patch	1999/09/09 13:48:27
@@ -1,7 +1,9 @@
 #compdef patch
 
+local comp_p='compadd "$expl[@]" -S0 -r "1-9" - ""'
+
 _arguments -s \
-  '(--strip)-p+:number:(0)' \
+  '(--strip)-p+:number:'"{$comp_p}" \
   '(--fuzz)-F+:lines:' \
   '(--context)-c' \
   '(--ed)-e' \
@@ -30,7 +32,8 @@
   ':original file:_files' \
   ':patch file:_files' \
   -- \
-  '*=NUM*:number:(0)' \
+  '*strip=NUM*:number:'"{$comp_p}"  \
+  '*get=NUM*:get files from RCS etc:' \
   '*=LINES*:lines:' \
   '*=PATCHFILE*:patch file:_files' \
   '*=FILE*:file:_files' \
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 16+ 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; 16+ 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] 16+ messages in thread

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

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-09 14:27 Silly questions about _arguments & Co (and probably bugs) Sven Wischnowsky
1999-09-09 22:01 ` Tanaka Akira
  -- strict thread matches above, loose matches on Subject: below --
1999-09-13 14:21 Sven Wischnowsky
1999-09-13 11:56 Sven Wischnowsky
1999-09-13 13:57 ` Tanaka Akira
1999-09-09 13:55 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 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).