From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27848 invoked from network); 10 Dec 2006 00:10:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.7 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 10 Dec 2006 00:10:22 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 52321 invoked from network); 10 Dec 2006 00:10:16 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 10 Dec 2006 00:10:16 -0000 Received: (qmail 20579 invoked by alias); 10 Dec 2006 00:09:55 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11073 Received: (qmail 20567 invoked from network); 10 Dec 2006 00:09:54 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 10 Dec 2006 00:09:54 -0000 Received: (qmail 50017 invoked from network); 10 Dec 2006 00:09:54 -0000 Received: from customer-domains.icp-qv1-irony7.iinet.net.au (203.59.1.128) by a.mx.sunsite.dk with SMTP; 10 Dec 2006 00:09:51 -0000 Received: from 210-84-4-106.dyn.iinet.net.au (HELO mail.endbracket.net) ([210.84.4.106]) by customer-domains.icp-qv1-irony7.iinet.net.au with ESMTP; 10 Dec 2006 08:09:45 +0800 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAK7eekXSVARq/2dsb2JhbAA X-IronPort-AV: i="4.09,517,1157299200"; d="scan'208"; a="457336394:sNHT15103124" Received: from [192.168.1.7] (dove.endbracket.net [192.168.1.7]) by mail.endbracket.net (Postfix) with ESMTP id C289436A52 for ; Sun, 10 Dec 2006 11:09:43 +1100 (EST) Message-ID: <457B5073.90206@mikelward.com> Date: Sun, 10 Dec 2006 11:10:27 +1100 From: Mikel Ward User-Agent: Thunderbird 2.0a1 (Windows/20060724) MIME-Version: 1.0 To: zsh-users@sunsite.dk Subject: Re: error using custom widget: widgets can only be called when ZLE is active [solved] References: <457B444E.2020207@mikelward.com> In-Reply-To: <457B444E.2020207@mikelward.com> X-Enigmail-Version: 0.94.1.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi The error message lead me to believe the error was in the first line of the function (i.e. zsh backward-word), but by deduction I found out the actual problem was trying to run zle in a subshell. Manipulating the kill ring array directly instead of calling "zle yank-pop" seems to work. expand-word-path () { zle backward-word zle set-mark-command zle forward-word zle copy-region-as-kill word=$killring[0] killring[0]=() realpath=$(realpath $word 2>/dev/null) if test -n "$realpath" then zle backward-kill-word zle -U "$realpath" fi } The only thing now is invoking it on an empty word multiple times does weird things. Probably some edge cases I have to look at, such as when $word is empty.