git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, "SZEDER Gábor" <szeder@ira.uka.de>
Subject: Re: [PATCH v3 (for maint)] git-completion: fix zsh support
Date: Mon, 9 May 2011 21:04:21 -0500	[thread overview]
Message-ID: <20110510020421.GA25814@elie> (raw)
In-Reply-To: <BANLkTikkhryMa69DSx4EAYjw+aar4icKcQ@mail.gmail.com>

Hi,

Sorry I missed this message before.

Felipe Contreras wrote:
> On Tue, May 10, 2011 at 12:13 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:

>>        zsh's bash completion emulation layer does not sufficiently
>>        insulate us from that reality.  In particular, the variable
>>        keeps the "special" attribute (even after a declaration "local
>>        words"), so assignments within a function are undone whenever
>>        the function returns.
>
> That explains less.

I believe you.  Could you give a hint of what it misses, so that it
can be fixed?

What I was trying to say is that (in the previous paragraph) it turns
out 'words' is a special variable used by zsh completion and (in the
quoted text)

 - we would prefer to use that variable for something else

 - zsh's bashcompinit library can and should help us to do so

 - it would do so by using typeset -h to hide the variable, an
   important effect of which is to clear the attribute called
   "special"

 - even declaring "local words" does not clear that attribute

 - the pertinent effect here is that (in the words of the zshcompwid
   manpage) as long as parameters like words remain special, "except
   for compstate, the parameters are reset on each function exit
   (including nested function calls from within the completion widget)
   to the values they had when the function was entered".

>>        In particular, until 3bee6a473 (completion: don't declare
>>        'local words' to make zsh happy, 2011-04-28), the "words" array
>>        would be cleared in _git by declaring "local words" and its new
>>        value would never be propagated from _get_comp_words_by_ref so
>>        it remained empty and the completion script could not tell that
>>        there were existing subcommand names on the command line (so
>>        "git log m<TAB>" would complete subcommand names).
>
> I don't see the point in explaining in excruciating detail all the
> series of steps in which an unset variable causes problems; the
> variable doesn't get set, thus one can assume there are problems.

Am I daft?  I guess so.  I really do have sympathy for the person who
runs into this code, and wanting to check while making some change
with unrelated purpose that it is still fixed, fires up zsh and runs

	git a<TAB>

.  Does it complete?  Yep, check, moving on.  Oops.

There's some flamebait in the rest of your responses, so I'm snipping
the rest of my explanations.  If you have sincere questions about my
feedback in the future, I'd be glad to answer them.

  parent reply	other threads:[~2011-05-10  2:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-09 20:45 [PATCH v3 (for maint)] git-completion: fix zsh support Felipe Contreras
2011-05-09 21:13 ` Jonathan Nieder
2011-05-09 22:08   ` Felipe Contreras
2011-05-09 22:14     ` [PATCH v4 " Felipe Contreras
2011-05-09 22:53       ` Jonathan Nieder
2011-05-09 23:13         ` Felipe Contreras
2011-05-09 23:28           ` Jonathan Nieder
2011-05-09 23:58             ` Felipe Contreras
2011-05-09 23:25         ` Junio C Hamano
2011-05-09 23:35           ` Jonathan Nieder
2011-05-10  2:55       ` [PATCH v5 0/2] " Jonathan Nieder
2011-05-10  2:59         ` [PATCH 1/2] completion: suppress zsh's special 'words' variable Jonathan Nieder
2011-05-10  3:17           ` Jonathan Nieder
2011-05-10 11:43             ` Felipe Contreras
2011-05-10 11:29           ` Felipe Contreras
2011-05-10  3:00         ` [PATCH 2/2] completion: move private shopt shim for zsh to __git_ namespace Jonathan Nieder
2011-05-10 10:48         ` [PATCH v5 0/2] git-completion: fix zsh support Felipe Contreras
2011-05-10  2:04     ` Jonathan Nieder [this message]
2011-05-10 10:44       ` [PATCH v3 (for maint)] " 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=20110510020421.GA25814@elie \
    --to=jrnieder@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=szeder@ira.uka.de \
    /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.
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).