From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24164 invoked from network); 21 Aug 2004 06:00:59 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 21 Aug 2004 06:00:59 -0000 Received: (qmail 48071 invoked from network); 21 Aug 2004 06:00:53 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 21 Aug 2004 06:00:53 -0000 Received: (qmail 26840 invoked by alias); 21 Aug 2004 06:00:10 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7899 Received: (qmail 26823 invoked from network); 21 Aug 2004 06:00:10 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 21 Aug 2004 06:00:10 -0000 Received: (qmail 46163 invoked from network); 21 Aug 2004 05:58:11 -0000 Received: from unknown (HELO moonbase.zanshin.com) (167.160.213.139) by a.mx.sunsite.dk with SMTP; 21 Aug 2004 05:58:09 -0000 Received: from toltec.zanshin.com (toltec.zanshin.com [64.84.47.166]) by moonbase.zanshin.com (8.12.11/8.12.11) with ESMTP id i7L5w7Wb002532 for ; Fri, 20 Aug 2004 22:58:07 -0700 Date: Fri, 20 Aug 2004 22:58:07 -0700 (PDT) From: Bart Schaefer Reply-To: zsh-users@sunsite.dk To: zsh-users@sunsite.dk Subject: Re: Tip of the day: previous command output In-Reply-To: Message-ID: References: <20040819085812.GL22962@localhost> <20040819164250.GA21575@spiegl.de> <20040820121202.GA31466@spiegl.de> <20040820145032.GH13530@ay.vinc17.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-1.5 required=6.0 tests=BAYES_01 autolearn=no version=2.63 X-Spam-Hits: -1.5 On Fri, 20 Aug 2004, Bart Schaefer wrote: > I won't try to test this, but something like this should do it: OK, I lied. I tested it. It didn't do what I expected, though it did what I told it to do. Here's a version that actually does what was asked: _expand_word_and_keep() { function compadd() { local -A args zparseopts -E -A args J: if [[ $args[-J] == all-expansions ]] then builtin compadd -A kept "$@" kept=(${(Q)${(z)kept}}) fi builtin compadd "$@" } local result _main_complete _expand result=$? unfunction compadd return result } With 4.2.1, you can replace the five "local ... return" lines with { _main_complete _expand } always { unfunction compadd } Left as an excercise: Get the name of the "keep" variable from a zstyle, so you can stash expansions in different places depending on context.