From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9286 invoked by alias); 20 Apr 2013 22:03:52 -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: 31301 Received: (qmail 12335 invoked from network); 20 Apr 2013 22:03:40 -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.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.217.175 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=gdSVa5+kAn8XFCUTXCa6YAzJnP7sUUCz0S8KpVlujyQ=; b=u/WSs4YEa/RCSBv/FWFLNCqUrT/8GbGswtwT+pz/ihLg/PtzrKWP3w6iqxUnviq8+8 JksPookmm5HzZffDrh4s9fifKjzrvP+kMBwFdOjeORPxooOSAYTkITnRhMcdsJV4ODK4 pYTwr9qT5VED3UX11WGFoLo7N0kgw40dA12pvYxenziGFGt1WHr7g7CSIwcQTBbnGNc4 yIthsI//6/pYBorvuz3ASmQdBBJA92Pn+BDHNl/cAx/q1nrKsIIjjqN5XFYAKSOLlSze 5qTmcpkXEB3T2dJ/AqCROL3QoS/OD+DeowE0taFWvDQoQ9pZxXouQD/AMIKGTVeMjj0W 22aw== MIME-Version: 1.0 X-Received: by 10.112.146.133 with SMTP id tc5mr10420104lbb.88.1366495413839; Sat, 20 Apr 2013 15:03:33 -0700 (PDT) In-Reply-To: <130420083634.ZM10866@torch.brasslantern.com> References: <130420083634.ZM10866@torch.brasslantern.com> Date: Sat, 20 Apr 2013 17:03:33 -0500 Message-ID: Subject: Re: Getting original words after _arguments From: Felipe Contreras To: Bart Schaefer Cc: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 On Sat, Apr 20, 2013 at 10:36 AM, Bart Schaefer wrote: > 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. I know, I'm not going to usw zsh completion after that point. > Is there some reason you can't just work on orig_words in the rest of > your function? It's not my code, it's git.git's bash completion, which uses 'word'. > } 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 ... Maybe not. -- Felipe Contreras