From: Felipe Contreras <felipe.contreras@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-workers@zsh.org
Subject: Re: Getting original words after _arguments
Date: Sat, 20 Apr 2013 17:03:33 -0500 [thread overview]
Message-ID: <CAMP44s0i+e0yNQ9AABQzF6Diqbgt1EQXj7gR-PMAOb+a+FQ_DA@mail.gmail.com> (raw)
In-Reply-To: <130420083634.ZM10866@torch.brasslantern.com>
On Sat, Apr 20, 2013 at 10:36 AM, Bart Schaefer
<schaefer@brasslantern.com> 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
next prev parent reply other threads:[~2013-04-20 22:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-19 8:21 Felipe Contreras
2013-04-20 15:36 ` Bart Schaefer
2013-04-20 20:07 ` Peter Stephenson
2013-04-20 22:03 ` Felipe Contreras [this message]
2013-04-21 18:55 ` Bart Schaefer
2013-04-21 20:42 ` Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMP44s0i+e0yNQ9AABQzF6Diqbgt1EQXj7gR-PMAOb+a+FQ_DA@mail.gmail.com \
--to=felipe.contreras@gmail.com \
--cc=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).