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

Re: [PATCH] tcsh-completion re-using git-completion.bash

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Nov 17, 2012, 10:56 UTC
Message-ID
<20121117105605.GB12052@goldbirke>
In-Reply-To
<CAMP44s3pi0iDOho_qYZEutebDNDveWWv6wEAs-C1bs1A_yL+Sg@mail.gmail.com>
On Fri, Nov 16, 2012 at 10:46:16PM +0100, Felipe Contreras wrote:
Show 21 quoted lines
> On Fri, Nov 16, 2012 at 10:22 PM, SZEDER Gábor <szeder@ira.uka.de> wrote:
> > On Fri, Nov 16, 2012 at 10:03:41PM +0100, Felipe Contreras wrote:
> 
> >> > As I understand the main issues with using the completion script with
> >> > zsh are the various little incompatibilities between the two shells
> >> > and bugs in zsh's emulation of Bash's completion-related builtins.
> >> > Running the completion script under Bash and using its results in zsh
> >> > would solve these issues at the root.  And would allow as to remove
> >> > some if [[ -n ${ZSH_VERSION-} ]] code.
> >>
> >> We can remove that code already, because we now have code that is
> >> superior than zsh's bash completion emulation:
> >>
> >> http://article.gmane.org/gmane.comp.version-control.git/208173
> >
> > Which depends on the completion script having a wrapper function
> > around compgen filling COMPREPLY.
> 
> No, it does not. Previous incarnations didn't have this dependency:
> 
> http://article.gmane.org/gmane.comp.version-control.git/196720
Good.
Show 14 quoted lines
> > However, COMPREPLY will be soon
> > filled by hand-rolled code to prevent expansion issues with compgen,
> > and there will be no such wrapper.
> 
> I'm still waiting to see a resemblance of that code, but my bet would
> be that there will be a way to fill both COMPREPLY, and call zsh's
> compadd. But it's hard to figure that out without any code. Which is
> why I'm thinking on doing it myself.
> 
> But even in that case, if push comes to shoves, this zsh wrapper can
> ultimately read COMPREPLY and figure things backwards, as even more
> previous versions did:
> 
> http://article.gmane.org/gmane.comp.version-control.git/189310

Even better. I was just going to propose that zsh's completion could just read the contents of COMPREPLY at the end of _git() and _gitk(), because this way no zsh-induced helper functions and changes would be needed to the completion script at all.

However, running the completion script with Bash would also prevent possible issues caused by incompatibilities between the two shells mentioned below.

Show 10 quoted lines
> >> This is the equivalent of what Marc is doing, except that zsh has no
> >> problems running bash's code. Note there's a difference with zsh's
> >> emulation bash (or rather bourne shell, or k shell), and zsh's
> >> emulation of bash's _completion_. The former is fine, the later is
> >> not.
> >
> > There are a couple of constructs supported by Bash but not by zsh,
> > which we usually try to avoid.
> 
> Yes, and is that a big deal?

Not that big, but I wanted to point out that it's not "fine" either. Just a slight maintenance burden, because we have to pay attention not to use such constructs.

Previous: Felipe ContrerasNext: Felipe Contreras
Message 24 of 39 in “Fwd: [PATCH] Add tcsh-completion support to contrib by using git-completion.bash”
  1. Marc KhouzamNov 12, 2012
  2. SZEDER GáborNov 13, 2012
  3. Marc KhouzamNov 13, 2012
  4. SZEDER GáborNov 13, 2012
  5. completion: remove 'help' duplicate from porcelain commandsSZEDER Gábor, Nov 14, 2012
  6. Marc KhouzamNov 14, 2012
  7. tcsh-completion re-using git-completion.bashMarc Khouzam, Nov 15, 2012
  8. Felipe ContrerasNov 16, 2012
  9. Marc KhouzamNov 16, 2012
  10. Felipe ContrerasNov 16, 2012
  11. Marc KhouzamNov 16, 2012
  12. tcsh-completion re-using git-completion.bashMarc Khouzam, Nov 16, 2012
  13. Felipe ContrerasNov 16, 2012
  14. tcsh-completion re-using git-completion.bashMarc Khouzam, Nov 16, 2012
  15. Junio C HamanoNov 16, 2012
  16. Felipe ContrerasNov 16, 2012
  17. Felipe ContrerasNov 16, 2012
  18. Marc KhouzamNov 16, 2012
  19. Felipe ContrerasNov 16, 2012
  20. SZEDER GáborNov 16, 2012
  21. Felipe ContrerasNov 16, 2012
  22. SZEDER GáborNov 16, 2012
  23. Felipe ContrerasNov 16, 2012
  24. SZEDER GáborNov 17, 2012
  25. Felipe ContrerasNov 17, 2012
  26. SZEDER GáborNov 17, 2012
  27. Junio C HamanoNov 16, 2012
  28. Felipe ContrerasNov 16, 2012
  29. Marc KhouzamNov 17, 2012
  30. Felipe ContrerasNov 17, 2012
  31. Marc KhouzamNov 20, 2012
  32. Felipe ContrerasNov 20, 2012
  33. Marc KhouzamNov 20, 2012
  34. Junio C HamanoNov 20, 2012
  35. Felipe ContrerasNov 13, 2012
  36. SZEDER GáborNov 14, 2012
  37. Felipe ContrerasNov 15, 2012
  38. Marc KhouzamNov 14, 2012
  39. SZEDER GáborNov 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.