From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3843 invoked from network); 30 May 2000 07:20:38 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 30 May 2000 07:20:38 -0000 Received: (qmail 3904 invoked by alias); 30 May 2000 07:20:26 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11646 Received: (qmail 3889 invoked from network); 30 May 2000 07:20:24 -0000 From: "Bart Schaefer" Message-Id: <1000530072019.ZM22395@candle.brasslantern.com> Date: Tue, 30 May 2000 07:20:18 +0000 X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.auc.dk Subject: Calling completion function from a non-completion ZLE widget MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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