Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Calling completion function from a non-completion ZLE widget
- X-seq: zsh-workers 11646
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Calling completion function from a non-completion ZLE widget
- Date: Tue, 30 May 2000 07:20:18 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
I accidentally ended up with a function bound to an ordinary widget (i.e.
zle -N ...) that called _complete_help. [*] Bad, very bad. Not only did
it complain:
_main_complete:compset:52: can only be called from completion function
_default:compcall:12: can only be called from completion function
_main_complete:266: bad set of key/value pairs for associative array
But now that shell is also in a state where no completion of any kind does
anything other than beep at me and occasionally spit out errors about
bad math expressions, like this:
zstyle:5: bad math expression: operand expected at `:completio...'
Hmm, I suspect _complete_help got aborted in progress by one of the above
errors and left some functions defined. Yup, that's it; probably left
some other garbage state as well. Yow, it even left $compstate in an
inconsistent state! $+compstate is 1, $#compstate is also 1, but trying
`typeset | grep ^compstate` yields nothing.
It'd be best if that sort of thing doesn't happen, but there's no way to
trap on only the sort of error that causes the whole call stack to abort
(as `bad set of ...' seems to have).
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.)
[*] It should have been calling `zle _complete_help', I forgot the `zle'.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author