Re: [RFC/PATCH] completion: avoid "words" as variable name for zsh portability
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Apr 27, 2011, 09:11 UTC
- Message-ID
- <20110427091140.GB14849@elie>
- In-Reply-To
- <BANLkTinA5hfddqpGwOBjk+2oFDpwqORrSg@mail.gmail.com>
Felipe Contreras wrote:
> On Wed, Apr 27, 2011 at 9:40 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
>> Sorry, I got carried away (I am happy to see someone has made some >> headway in investigating this old bug). How about this? > > What's wrong with my patch?
As mentioned at http://thread.gmane.org/gmane.comp.version-control.git/172142/focus=172157 it breaks the tab completion in the common case that the user uses the standard bash completion library (usually provided at /etc/bash_completion) and git uses its _get_comp_words_by_ref function. You can test like so:
% bash $ . /etc/bash_completion $ . contrib/completion/git-completion.bash $ git fetch origin <TAB>
I also made a small cosmetic change which is less important (sorry, I should have mentioned it before): the patch I sent spells out comp_words instead of writing cwords to avoid a false analogy between the array of all completion words (cwords) and the current word index (cword).
>> There is still a "for unknown reasons" in the above explanation. > > I'm asking zsh guys: > http://www.zsh.org/mla/workers/2011/msg00515.html
Thanks. It looks like to get the semantics I expect from "local" in zsh, one needs to use "typeset -h" (which bash does not support, unfortunately). Probably it is best to steer clear of zsh's special variables anyway.