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

Re: Calling completion function from a non-completion ZLE widget



Bart Schaefer wrote:

> ...
> 
> The best we can do seems to be a bit of defensive programming up front.
> What's a reliable way to determine that the completion system is active?
> (Testing a parameter won't do it, the user could always set another of
> the same name.)

Hm, no parameter? Even if ${(t)compstate} yields `association-local-special'?

We can use the conditions, e.g.:

  if [[ -prefix * ]] 2> /dev/null; then
    # completion active
  fi

Or should we change compadd to return `2' in $? when completion is not 
active? Or `1' there, but `2' if no matches are given, so that we
could do

  compadd 2> /dev/null
  if [[ $? -ne 1 ]]; then
    ...
  fi

? Dunno.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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