On Saturday 07 October 2006 13:31, Vincent Lefevre wrote: > On 2006-10-07 10:30:11 +0400, Andrey Borzenkov wrote: > > According to man info, it should be 'info -f mprf.info'; that is > > also how I wrote completion :) Do you have reference to more up to > > date info documentation? > > No, but giving a filename (relative to INFOPATH, absolute or starting > with ./) works without the -f option. I think this represent the top > node of an info file, hence the behavior. Would be nice if it were documented (of course not something someone dealing with Zsh has the rights to complaint about :) How does it work for you? BTW as I understand _arguments sets up explanation also for -> cases; any chance to access them? Passing empty message (:::->foo) is an error; but accidentally supplying different messages in _arguments and later in direct completion calls (like ::menu items:->items and later on _describe 'menu item') makes it believe there are two set of matches attached due to line length.
Index: Completion/Unix/Command/_texinfo
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_texinfo,v
retrieving revision 1.5
diff -u -p -r1.5 _texinfo
--- Completion/Unix/Command/_texinfo 21 Jan 2004 13:53:29 -0000 1.5
+++ Completion/Unix/Command/_texinfo 7 Oct 2006 12:03:42 -0000
@@ -21,7 +21,7 @@ case $service in
'--subnodes[recursively output menu items]' \
'--vi-keys[use Vi-like key bindings]' \
'(: -)--version[display version information]' \
- '(--apropos -h --help -O --output --version)*::menu items:->item' && ret=0
+ '(--apropos -h --help -O --output --version)*::menu item:->item' && ret=0
info=( $info {(kv)opt_args[(I)(-d|--directory|-f|--file)]} )
;;
@@ -146,11 +146,25 @@ esac
case $state in
item )
- local -a items
+ local -a items tags expl infopath
+ (( $#INFOPATH )) && infopath=( -W ${s/:/INFOPATH} )
- items=(${${(M)${${(f)"$(${info} --output - ${words[1,CURRENT-1]} 2>/dev/null)"}[1,(r)[[:space:]]#--- The Detailed Node Listing ---[[:space:]]#]}:#\* *~\* Menu:*}:/(#b)\*[[:space:]]##([^:]##):(#B)( \(?##\)[^.]#.|(:|))[[:space:]]#(#b)(*)[[:space:]]#/$match[1]${match[2]:+:}$match[2]})
+ tags=(items)
+ if [[ $CURRENT -eq 1 ]]; then
+ tags+=files
+ fi
+
+ _tags $tags
+ while _tags; do
+ if _requested files expl 'info file'; then
+ _files "$expl[@]" $infopath -g '*.info' && ret=0
+ fi
+ if _requested items; then
+ items=(${${(M)${${(f)"$(${info} --output - ${words[1,CURRENT-1]} 2>/dev/null)"}[1,(r)[[:space:]]#--- The Detailed Node Listing ---[[:space:]]#]}:#\* *~\* Menu:*}:/(#b)\*[[:space:]]##([^:]##):(#B)( \(?##\)[^.]#.|(:|))[[:space:]]#(#b)(*)[[:space:]]#/$match[1]${match[2]:+:}$match[2]})
- _describe -t items "menu items" items && ret=0
+ _describe -t items "menu item" items && ret=0
+ fi
+ done
;;
esac
Attachment:
pgpJ6u0tPs8PA.pgp
Description: PGP signature