git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] bash-completion: don't add quoted space for ZSH (fix regression)

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 16, 2012, 22:47 UTC
Message-ID
<7vsjjfuuwk.fsf@alter.siamese.dyndns.org>
In-Reply-To
<vpqhazv3m17.fsf@bauges.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 11 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> but is that the right thing to do if suffix came from "$4"?
>>
>> As far as I can see, "$4" is used to append "." in very limited cases, and
>> nobody explicitly passes SP as "$4" when calling this, so it may be easier
>> to read if you moved this before that "if we have 3 or more args, use the
>> fourth one as the suffix" block, i.e. something like this?
>
> Why not, but in case someone explicitely passes " " as $4 in the future,
> it's likely to be better to strip it for the same reason we strip it here.

I doubt that would be sufficent or appropriate. If some caller _WANTS_ to add a SP, shouldn't we be devising a way to tell zsh to add it without quoting, instead of silently stripping?

Show 10 quoted lines
> I don't care much either way in this case.
>
>> +	# Because we use '-o nospace' under bash, we need to compensate
>> +	# for it by appending SP after completed word ourselves.
>> +	local suffix="${BASH_VERSION+ }"
>
> Not sure why you reworded the comment, but I don't think it's a good
> idea to remove the "ZSH would quote the trailing space added with -S"
> that I had added, because this is really the reason we do a special case
> here. Your version is misleading, because we use -o nospace for ZSH too.

Ok, use of "-o nospace" in Zsh is what I missed. I thought the issue was about the nospace emulation.

So does that mean we would be forcing zsh users to add SP themselves? I wonder if we can do better than that.

Previous: Matthieu MoyNext: Matthieu Moy
Message 9 of 21 in “Zsh completion regression”
  1. Stefan HallerJan 12, 2012
  2. Matthieu MoyJan 12, 2012
  3. SZEDER GáborJan 14, 2012
  4. Matthieu MoyJan 14, 2012
  5. SZEDER GáborJan 14, 2012
  6. bash-completion: don't add quoted space for ZSH (fix regression)Matthieu Moy, Jan 14, 2012
  7. Junio C HamanoJan 15, 2012
  8. Matthieu MoyJan 16, 2012
  9. Junio C HamanoJan 16, 2012
  10. Matthieu MoyJan 17, 2012
  11. Junio C HamanoJan 17, 2012
  12. Felipe ContrerasJan 17, 2012
  13. Felipe ContrerasJan 17, 2012
  14. Junio C HamanoJan 17, 2012
  15. Felipe ContrerasJan 17, 2012
  16. Junio C HamanoJan 17, 2012
  17. Matthieu MoyJan 18, 2012
  18. Felipe ContrerasJan 25, 2012
  19. Junio C HamanoJan 25, 2012
  20. Stefan HallerJan 14, 2012
  21. Stefan HallerJan 14, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.