Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: completion



In article <199908191044.MAA17903@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
  Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> writes:

>   - I didn't change `_complete_opts' and `_cvs'. But I think the first 
>     one should 1) be renamed (to `_short_options'?) because the
>     `complete' is implicit in all other function names and 2) it
>     should be changed to get its descriptions in the same format as
>     `_arguments' and `_long_options' (and should use `_message' and
>     `_description').

I agree that `complete_opts' is bad name.

But many commands accept both short and long options, there should be
a completer that handle both.

I feel `_arguments' is very good as basis of that.  Is it easy to
extend `_arguments' to handle short options?

# If it is available, I'll throw `complete_opts' away.

> Ok. I don't know if you like this grouping/description stuff, all
> comments are welcome.

Is there a way to disable options completion until a user insert `-'
explicitly?  I like the behaviour since some commands have many
options and they may bury completions for non-option arguments.

And, I found some problems.

Z(2):akr@is27e1u11% Src/zsh -f
is27e1u11% fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
is27e1u11% _tst () { _arguments '-l+:left border:' '-format:paper size:(letter A4)' '*-copy:output file:_files::resolution:(300 600)' ':postscript file:_files -g *.(ps|eps)' '*:page number:' }
is27e1u11% tst -l<TAB>

->

is27e1u11% tst -l+ 
is27e1u11% pnmpad -l<TAB>

->

is27e1u11% pnmpad -l- 


`+' and `-' should not be completed, I think.

is27e1u11% pnmscale -height <TAB>

->

is27e1u11% pnmscale -height  

In this case, " " is completed. Is this intended behaviour?

is27e1u11% compconfig[message_format]='%d'
is27e1u11% compconfig[description_format]='%d'
is27e1u11% pnmcomp <TAB>

->

is27e1u11% pnmcomp      
option
overlay file
-alpha          Config/         Misc/           config.cache    configure.in 
-invert         Doc/            README          config.guess*   install-sh*
-xoff           Etc/            Src/            config.h        mkinstalldirs*
-yoff           Functions/      StartupFiles/   config.h.in     stamp-h 
CVS/            INSTALL         Util/           config.log      stamp-h.in 
ChangeLog       META-FAQ        acconfig.h      config.status*  
ChangeLog.3.0   Makefile        aclocal.m4      config.sub*     
Completion/     Makefile.in     aczsh.m4        configure*      

Although I don't know completion group behaviour well, I feel this
very strange because options and files are mixed.

Also, I found some typos.

Index: Completion/Core/_message
===================================================================
RCS file: /projects/zsh/zsh/Completion/Core/_message,v
retrieving revision 1.1.1.1
diff -u -F^( -r1.1.1.1 _message
--- _message	1999/08/19 11:18:29	1.1.1.1
+++ _message	1999/08/19 13:49:30
@@ -3,7 +3,7 @@
 local format
 
 format="$compconfig[message_format]"
-[[ -z "$format" ]] && "$compconfig[description_format]"
+[[ -z "$format" ]] && format="$compconfig[description_format]"
 
 if [[ -n "$format" ]]; then
   if [[ $compstate[nmatches] -eq 0 ]]; then
Index: Completion/Pbmplus/_pbmtoepsi
===================================================================
RCS file: /projects/zsh/zsh/Completion/Pbmplus/_pbmtoepsi,v
retrieving revision 1.1.1.1
diff -u -F^( -r1.1.1.1 _pbmtoepsi
--- _pbmtoepsi	1999/08/19 11:18:45	1.1.1.1
+++ _pbmtoepsi	1999/08/19 13:49:30
@@ -1,3 +1,3 @@
 #compdef pbmtoepsi
 
-_arguments '--bbonly' ':file: _pbmfile'
+_arguments '-bbonly' ':file: _pbm_file'
Index: Completion/Pbmplus/_pktopbm
===================================================================
RCS file: /projects/zsh/zsh/Completion/Pbmplus/_pktopbm,v
retrieving revision 1.1.1.1
diff -u -F^( -r1.1.1.1 _pktopbm
--- _pktopbm	1999/08/19 11:18:46	1.1.1.1
+++ _pktopbm	1999/08/19 13:49:30
@@ -1,4 +1,4 @@
 #compdef pktopbm
 
-_arguments ':pk file:_file -g *.(#i)pk' '-c:character number:' \
+_arguments ':pk file:_files -g *.(#i)pk' '-c:character number:' \
            '*:file: _pbm_file'
Index: Completion/Pbmplus/_yuvtoppm
===================================================================
RCS file: /projects/zsh/zsh/Completion/Pbmplus/_yuvtoppm,v
retrieving revision 1.1.1.1
diff -u -F^( -r1.1.1.1 _yuvtoppm
--- _yuvtoppm	1999/08/19 11:18:47	1.1.1.1
+++ _yuvtoppm	1999/08/19 13:49:30
@@ -1,3 +1,3 @@
 #compdef yuvtoppm
 
-_arguments ':width:' ':height:' 'image bytes:'
+_arguments ':width:' ':height:' ':image bytes:'
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /projects/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.1.1.16
diff -u -F^( -r1.1.1.16 compsys.yo
--- compsys.yo	1999/08/19 11:18:51	1.1.1.16
+++ compsys.yo	1999/08/19 13:49:30
@@ -924,6 +924,7 @@ (with the `tt(-J)' option), but if the o
 separate argument after the option, a plus sign should be used
 instead. Finally, if the option may be given more than once, a star
 (`tt(*)') should be added in front of the var(opt-spec).
+)
 enditem()
 
 In each of the cases above, the var(action) says how the possible

# I made a patch for patch-2.5.3 that add options to make it cvs-diff aware.
# http://www.ldl.jaist.ac.jp/~akr/junk/patch-2.5.3-cvsaware-19990815.patch
-- 
Tanaka Akira



Messages sorted by: Reverse Date, Date, Thread, Author