Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zle messes up 'words' variable?
- X-seq: zsh-workers 29101
- From: Felipe Contreras <felipe.contreras@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: zle messes up 'words' variable?
- Date: Thu, 28 Apr 2011 23:19:25 +0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=wCQLra/EVX4kPqCsQSA3sq6tuVVYmWwXboYoQXp5MtU=; b=toOiWldwWVuM9L7dnTsFDb8DNeXhU4Y65m8oHVO/4K/9TcZ4PaoJrqOqk6fbRxfoOH wx8/Zm9WFUy4nWHomD43PkZJAuqeXsuFQVzRcKPMAc6rJxi4hmw8if3rKW3At0t6lfuM xkwzfubHdanSAbuJIsqDAet75npLmUDJP0/dk=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=EuWy1ZsQe6nWc7tAB8zAhlf6MYWTy1wila+Lxflnx+jnomw98X4xqmQl/gVC8UjZCE erK4Ssw6rT/ixWkZYQWN0r0CutCJ1SLWMvEEwiikqWbO3zopI9Jm4EtSCRXEE3n0h014 KgLVbQemikTIyGNYEw0lT2qkuwLSqtQtnGBsk=
- In-reply-to: <BANLkTik3BGrNd389-cDELWwdqR_LZ-qgOA@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: <BANLkTik3BGrNd389-cDELWwdqR_LZ-qgOA@mail.gmail.com>
On Wed, Apr 27, 2011 at 11:26 AM, Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
> I'm trying the following:
> ---
> set_vars ()
> {
> cur="foo"
> words="foo"
> cwords="foo"
> }
>
> _foo ()
> {
> local cur words cwords
> set_vars
>
> echo "cur=${cur} words=${words} cwords=${cwords}" >> /tmp/comp_test.txt
> }
>
> compdef _foo foo
> ---
>
> Which results in:
> cur=foo words= cwords=foo
>
> Strangely enough, if I use the #compdef tag, the code works fine (words="foo").
>
> Any ideas?
I saw the following reply online but I wasn't CC'ed:
> Hrm. #compdef is equivalent to "compdef -na ..." and causes the function to
> be autoloaded at the time it's referenced. I don't know of any other reason
> the -na options would change the behavior. Does the code work fine on
> repeated attempts or only the first time?
Actually, I cannot get it to work any more with #compdef tag. I don't
know what I'm doing wrong. But compdef -na doesn't work either.
> What may be happening is that "sticky emulation" is in effect, so that when
> the function is autoloaded in bash compatibility mode, "words" becomes
> non-special. If so, I'm not familiar enough with bashcompinit to say whether
> that's intentional or an accidental side-effect.
This has nothing to do with bashcompinit, the issue is with plain compinit.
BTW. This messes up with a very important function in bash completion:
_get_comp_words_by_ref()
Cheers.
--
Felipe Contreras
Messages sorted by:
Reverse Date,
Date,
Thread,
Author