From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15889 invoked by alias); 20 Apr 2013 15:36:54 -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: 31293 Received: (qmail 3870 invoked from network); 20 Apr 2013 15:36:53 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <130420083634.ZM10866@torch.brasslantern.com> Date: Sat, 20 Apr 2013 08:36:34 -0700 In-reply-to: Comments: In reply to Felipe Contreras "Getting original words after _arguments" (Apr 19, 3:21am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Felipe Contreras , zsh-workers@zsh.org Subject: Re: Getting original words after _arguments MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Apr 19, 3:21am, Felipe Contreras wrote: } } orig_words=( ${words[@]} ) } _arguments -C '--stuff' && _ret=0 } words=( ${orig_words[@]} ) } } I need to have access to the original array of words, before the } _arguments stuff is run, and so far the only I can achieve that is by } manually storing the old ones, and then restoring them. Hmm. The variable named "words" is special to the completion system, and if _arguments modifies it that probably means that later stuff is going to depend on the state in which $words was left. You may confuse things by stuffing $orig_words back into words. Is there some reason you can't just work on orig_words in the rest of your function? } Is there an easier way? Surely the contents of the command line must } be stored somewhere. If you literally want the contents of the command line, a completion widget is still a widget, so you can examine $BUFFER et al. I'm not sure this is "easier" than copying the original state ...