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

Re: PATCH: _info completion



On Sun, May 12, 2002 at 11:11:44AM +0400, Borsenkow Andrej wrote:
> This is based on info-4.2 (the one I have); if you have earlier versions
> please check if it works. It assumes that 'info -o - node1 ...' works;
> without it completing (nested) menu items is more work than it's worth.

Works fine in info 4.1 too (though I rarely worry too much about
anything other than latest versions).

> 4 lines of parameter substitution is daunting but it tries to parse
> three different line entry formats with on regexp and also account for
> subtle differences in formatting I have encountered. Suggestions how to
> simplify it are gratefully accepted :-)

I'm impressed. I thought about doing this some while ago and decided
that it was just more hassle than it was worth, even with info -o.
I haven't yet tried to understand the substitution yet either.

I've got a few bits of other texinfo completions at home along with
some out-of-date but extensive tcsh completions so I'll dig those
out and get them fully working. For this reason, I suggest you
commit this under the name _texinfo so that we can put all the
texinfo commands in one function (as is our usual convention).
GNU distribute it all as one package named texinfo so it makes
sense to me.

> +local info=${words[1]}
and later:
> ... ${info} --output - ${(Q)words[1,CURRENT-1]} 2>/dev/null ...

This doesn't go too well when options like -f and -d are used
with info. _arguments is removing all the options from the words
array so they don't get passed on here (it does that in states).
I'd suggest setting $info to the full command before calling
_arguments.

I suppose you should also be using _call_program here too.

> +  '(-f --file -d --directory)'{-d,--directory=}'[add directory to infopath]:_files -/' \

You're missing the `directory' description on this line so it is
printing `_files -/' as a heading.

> +  '(: - -h --help)'{-h,--help}'[display usage]' \

Having specified `-' in the exclusion list, -h and --help are
superfluous. Not that they do any harm.

Oliver

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.



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