Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zle messes up 'words' variable?
- X-seq: zsh-workers 29086
- From: Felipe Contreras <felipe.contreras@xxxxxxxxx>
- To: Jérémie Roquet <arkanosis@xxxxxxxxx>
- Subject: Re: zle messes up 'words' variable?
- Date: Wed, 27 Apr 2011 12:11:28 +0300
- Cc: zsh-workers@xxxxxxx
- 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:cc:content-type :content-transfer-encoding; bh=B86NSFKezMTaKmJx2qrAVVfx20PEPsSTZwH956x2VGM=; b=iTo9aJSXWko2KEwH81XHGsv4ZBWTyv0oxrIp+3Lu3B6MN7DxT+ql/57yzaNyS4pzMD Dlei8TfjBLERu0EZlTAqwbBynodTZbtDCW2KikgAvq5HBBk9K4YUaa/zbO8hCJXF0LG8 C+4Pqq1PHSBM/noORnNw/q6TvWWy+ahHH6/eo=
- 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 :cc:content-type:content-transfer-encoding; b=ISh5HHzw7bu2DNAnXeZsgYFWTmjVzge4vnHtMaP1r29CQiT1XFr84pCOXVGtVZzbWL qLfDlQ0qnafj7asFaywMmfDVhhe0ZzAvLaWFygECBXJ303N77+uVmLzRjy0oh6RCvSk8 KGTK8dIw7IX6xXtucr+7XXB8MmB9GVJWsVvFM=
- In-reply-to: <BANLkTik=Jvvp+af1Zg3487VFQ_7HZyRJ_Q@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> <BANLkTik=Jvvp+af1Zg3487VFQ_7HZyRJ_Q@mail.gmail.com>
2011/4/27 Jérémie Roquet <arkanosis@xxxxxxxxx>:
> 2011/4/27 Felipe Contreras <felipe.contreras@xxxxxxxxx>:
>> 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?
>
> $words is a special array used for completion. See `man zshcompsys'
> for more about it.
Yeah, I know that, but I'm overriding it, which works fine with
#compdef, but not with compdef. How do you explain that?
Besides, the problem is with bash completion emulation where 'words'
is not supposed to be special, so zsh is messing things up.
--
#!bash
autoload -U +X bashcompinit && bashcompinit
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
}
complete -F _foo foo
--
--
Felipe Contreras
Messages sorted by:
Reverse Date,
Date,
Thread,
Author