From: Bart Schaefer <schaefer@brasslantern.com>
To: Felipe Contreras <felipe.contreras@gmail.com>, zsh-workers@zsh.org
Subject: Re: Getting original words after _arguments
Date: Sat, 20 Apr 2013 08:36:34 -0700 [thread overview]
Message-ID: <130420083634.ZM10866@torch.brasslantern.com> (raw)
In-Reply-To: <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 ...
next prev parent reply other threads:[~2013-04-20 15:36 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 [this message]
2013-04-20 20:07 ` Peter Stephenson
2013-04-20 22:03 ` Felipe Contreras
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=130420083634.ZM10866@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=felipe.contreras@gmail.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).