From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10673 invoked from network); 9 Dec 2006 23:33:27 -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; 9 Dec 2006 23:33:27 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 9761 invoked from network); 9 Dec 2006 23:33:20 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 9 Dec 2006 23:33:20 -0000 Received: (qmail 17077 invoked by alias); 9 Dec 2006 23:33:07 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11072 Received: (qmail 15170 invoked from network); 9 Dec 2006 23:18:05 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 9 Dec 2006 23:18:05 -0000 Received: (qmail 89439 invoked from network); 9 Dec 2006 23:18:04 -0000 Received: from customer-domains.icp-qv1-irony8.iinet.net.au (203.59.1.133) by a.mx.sunsite.dk with SMTP; 9 Dec 2006 23:18:00 -0000 Received: from 210-84-4-106.dyn.iinet.net.au (HELO mail.endbracket.net) ([210.84.4.106]) by customer-domains.icp-qv1-irony8.iinet.net.au with ESMTP; 10 Dec 2006 07:17:56 +0800 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CALrSekXSVARq/2dsb2JhbAA X-IronPort-AV: i="4.09,517,1157299200"; d="scan'208"; a="597946936:sNHT34827396" Received: from [192.168.1.7] (dove.endbracket.net [192.168.1.7]) by mail.endbracket.net (Postfix) with ESMTP id A312736A52 for ; Sun, 10 Dec 2006 10:17:54 +1100 (EST) Message-ID: <457B444E.2020207@mikelward.com> Date: Sun, 10 Dec 2006 10:18:38 +1100 From: Mikel Ward Reply-To: mikel@mikelward.com, zsh-users@sunsite.dk User-Agent: Thunderbird 2.0a1 (Windows/20060724) MIME-Version: 1.0 To: zsh-users@sunsite.dk Subject: error using custom widget: widgets can only be called when ZLE is active X-Enigmail-Version: 0.94.1.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi I'm trying to make a keyboard shortcut in Z Shell to expand the previous word on the command line its canonical path ("realpath") if it's a file. For example, I have a directory in /etc/apache2/mods-enabled that contains symlinks to files in /etc/apache2/mods-available. I want to be able to do: > cd /etc/apache2/mods-enabled > ls -l proxy.load and have the command change to: > ls -l /etc/apache2/mods-available/proxy.load >>From what I gather, I can do this using a zle custom widget. I chose to call the function implementing it expand-word-path and bind this to ^X /. For some reason, it doesn't work. In zsh 4.3.2 on Debian Linux I get an error that ZLE is inactive, as you can see below. ---------- > expand-word-path() { zle backward-word zle set-mark-command zle forward-word zle copy-region-as-kill file=$(zle yank-pop) zle -U `realpath $file` } > zle -N expand-word-path > bindkey "^X/" expand-word-path > ls /etc/apache2/mods-enabled/rewrite.load<^X/> zle:1: widgets can only be called when ZLE is active realpath: need at least one filename Usage: realpath [-s|--strip] [-z|--zero] filename ... realpath -h|--help realpath -v|--version expand-word-path:zle:7: not enough arguments for -U ---------- The manual says: zle widget [ -n num ] [ -N ] args ... Invoke the specified widget. This can only be done when ZLE is active; normally this will be within a user-defined widget. This suggests to me that ZLE should be active in the context I'm using it, but clearly it's not. I've tried searching for other custom widgets, but surprisingly there's not any out there. Can anyone suggest what I'm doing wrong or point me to some other custom widgets that do work? Thanks Mike