From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11763 invoked by alias); 16 Dec 2009 12:00:04 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 27523 Received: (qmail 16164 invoked from network); 16 Dec 2009 11:59:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.2.5 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Wed, 16 Dec 2009 11:59:00 +0000 From: Peter Stephenson To: zsh-workers@zsh.org Cc: =?UTF-8?B?SsO2cmc=?= Sommer Subject: run-help as a widget Message-ID: <20091216115900.45764c25@news01> In-Reply-To: References: Organization: CSR X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.8; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 16 Dec 2009 11:59:00.0569 (UTC) FILETIME=[279A6C90:01CA7E47] X-Scanned-By: MailControl A-09-22-10 (www.mailcontrol.com) on 10.71.1.134 On Mon, 7 Dec 2009 01:57:10 +0100 J=C3=B6rg Sommer wrote: > I know, this solution is a dirty hack, but it's quick. The better way is > to fix zsh to call run-help with the whole commandline where the alias > gets expanded and this commandline gets passed to the second run-help > call. I've been using this for a while, it's perhaps time something along these lines got included in Functions/Zle. I was a bit surprised to find I hadn't. With this it would be worth upgrading run-help and helpers to check if there's already a full command line there, and to advance past precommand modifiers. I thought I'd done some of this, too, but maybe not... I might simply have been thinking of expansion of aliases. By the way, note this quotes all buffer words: ls foo; rm -rf ~h is safe even if it may not do quite what you actually want, which is quite hard to guess. (But I didn't try it quite like that anyway...) # run-help-widget # # This is a widget to replace the builtin widget run-help. # It passes the entire command line to run-help. This is often # more useful. # # Typical usage: # zle -N run-help run-help-widget local -a line if is-at-least 4.3.10; then line=3D(${(q-)${(z)BUFFER}}) else line=3D(${(qq)${(z)BUFFER}}) fi zle push-line BUFFER=3D"run-help ${line}" zle accept-line --=20 Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, = UK Member of the CSR plc group of companies. CSR plc registered in England and= Wales, registered number 4187346, registered office Churchill House, Cambr= idge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom