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

Re: what should compctl's look like?



>I agree with this.  Essentially compctl is a 'language within a language'.
>It would be nice to see this 'language' developed to be something less
>cryptic.  What what should it look like?

Aha, Richard once again hits the nail right on the head.  That is
exactly the question that I have been considering with respect to
compctls.

>Maybe someone could do some experiments with flex/lex and
>yacc/bison to see what might work.

I think we should avoid having a completely separate language.  We
already have an expressive general-purpose language -- the shell
command language itself.  I envisage an interface along these lines:

zcompctl '
  : some commands
  # (much like trap really)
  if [[ $WORD[2] == *z* ]]; then
    zcompctl -R *.(tgz|taz|tar.(gz|z|Z))
  else
    zcompctl -R *.tar
  fi
' tar

That is, the commands given in that first argument are executed as zsh
commands, and can register possible completions with an option to the
zcompctl command.  (Can anyone think of a better name for the
command?)  Access to the command line can be through an interface
intended for ZLE extension (another project I have some plans for).

The only problem with using the shell language is that, due to $IFS and
so on, it would be difficult to optimise the simplest cases, as we must
do for efficiency.  And interpreting shell commands for even moderately
complex compctls, currently done with the -x option to compctl, would
be inefficient.  Does anyone have any better ideas?

-zefram



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