From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3499 invoked by alias); 27 Apr 2011 09:11:34 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29086 Received: (qmail 14478 invoked from network); 27 Apr 2011 09:11:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.161.43 as permitted sender) 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= MIME-Version: 1.0 In-Reply-To: References: Date: Wed, 27 Apr 2011 12:11:28 +0300 Message-ID: Subject: Re: zle messes up 'words' variable? From: Felipe Contreras To: =?UTF-8?B?SsOpcsOpbWllIFJvcXVldA==?= Cc: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2011/4/27 J=C3=A9r=C3=A9mie Roquet : > 2011/4/27 Felipe Contreras : >> I'm trying the following: >> --- >> set_vars () >> { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0cur=3D"foo" >> =C2=A0 =C2=A0 =C2=A0 =C2=A0words=3D"foo" >> =C2=A0 =C2=A0 =C2=A0 =C2=A0cwords=3D"foo" >> } >> >> _foo () >> { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0local cur words cwords >> =C2=A0 =C2=A0 =C2=A0 =C2=A0set_vars >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0echo "cur=3D${cur} words=3D${words} cwords=3D= ${cwords}" >> /tmp/comp_test.txt >> } >> >> compdef _foo foo >> --- >> >> Which results in: >> cur=3Dfoo words=3D cwords=3Dfoo >> >> Strangely enough, if I use the #compdef tag, the code works fine (words= =3D"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=3D"foo" words=3D"foo" cwords=3D"foo" } _foo () { local cur words cwords set_vars echo "cur=3D${cur} words=3D${words} cwords=3D${cwords}" >> /tmp/comp_test.= txt } complete -F _foo foo -- --=20 Felipe Contreras