Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Getting original words after _arguments
- X-seq: zsh-workers 31293
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Felipe Contreras <felipe.contreras@xxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: Getting original words after _arguments
- Date: Sat, 20 Apr 2013 08:36:34 -0700
- In-reply-to: <CAMP44s2UnDQ2TZsWJykVN5c+gNWbQtfQ8hTy_uPk=HdQBiRbfA@mail.gmail.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>
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 ...
Messages sorted by:
Reverse Date,
Date,
Thread,
Author