Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Getting original words after _arguments
- X-seq: zsh-workers 31301
- From: Felipe Contreras <felipe.contreras@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Getting original words after _arguments
- Date: Sat, 20 Apr 2013 17:03:33 -0500
- Cc: zsh-workers@xxxxxxx
- 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==
- In-reply-to: <130420083634.ZM10866@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAMP44s2UnDQ2TZsWJykVN5c+gNWbQtfQ8hTy_uPk=HdQBiRbfA@mail.gmail.com> <130420083634.ZM10866@torch.brasslantern.com>
On Sat, Apr 20, 2013 at 10:36 AM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author