zsh-workers
 help / color / mirror / code / Atom feed
From: "D. Ben Knoble" <ben.knoble@gmail.com>
To: Oliver Kiddle <opk@zsh.org>
Cc: zsh-workers@zsh.org
Subject: Re: bug: _files depends on extendedglob
Date: Sat, 30 Mar 2024 11:27:57 -0400	[thread overview]
Message-ID: <CALnO6CArWVs4Bx-OniUWwxjRP=MwsgeTgOsyyAGzmWhUG_Qovg@mail.gmail.com> (raw)
In-Reply-To: <48504-1711741389.669599@M82Z.uugW.8LDU>

On Fri, Mar 29, 2024 at 3:43 PM Oliver Kiddle <opk@zsh.org> wrote:
>
> Ben Knoble wrote:
> >
> > In the linked commit from the original mail I explain the emulation
> > mode: it is because the contributed Git completion script sets the
> > emulation mode to ksh in order to leave most of the work to the bash
> > completion scripts. I therefore (assume I) have to revert to zsh mode
> > for _files to behave sensibly: not doing so produced a strange IIRC.
>
> git doc is not an official git command so I'm not sure whether what
> you're doing falls within the scope of what that contributed completion
> supports but if it does then forcing ksh emulation on your function is
> arguably a bug in that git completion.

Correct; I'm adding completion for a custom command (implemented by a
script called git-doc). I think the author would argue it's by design,
though it does make extension harder (unless you like writing bash
completion scripts). Author's post from 2013 indicated some
performance issues with the Zsh-provided script
(https://felipec.wordpress.com/2013/07/31/how-i-fixed-git-zsh-completion/);
have those been resolved? [The post itself seems a bit inflammatory,
so please don't read its tone into my words.]

> I'd be very interested if you could elucidate on why you choose to use
> that completion instead of the git completion that comes with zsh. It
> is perhaps faster due to reduced functionality but in wrapping the bash
> completion it has a much more limited interface that prevents it taking
> advantage of many of zsh's more powerful features. Zsh's completion does
> support handling additional commands in the same manner with, e.g. a
> _git-doc function. There can be benefits to upstream projects carrying
> completion functions but I usually avoid anything that wraps a bash
> function.

See https://github.com/benknoble/Dotfiles/commit/9c7dd6d1ec8b3caac670f1a2a030769a4c90c06c
and https://github.com/Homebrew/legacy-homebrew/issues/16992: the zsh
contrib script from Git is installed in a location such that it
supersedes the default script. At this point it's what I'm used to,
and I haven't spent time trying the other yet. It works well enough
for me at the moment. (Perhaps it's less a choice and more a "default"
that works, where by "default" I mean "that's what my package manager
did and I don't have the time to fight with it at the moment.)

> > > reason insist on doing this, then you can setopt $_comp_options to
> >
> > That’s probably a much better workaround than what I had, thanks.
> > I’ve confirmed that it works. Is this documented anywhere that I can
> > rely on?
>
> That's relying on internal implementation details of the completion
> system so you can't really rely on it.

Bart indicated it was undocumented but deserved to be.

-- 
D. Ben Knoble


  reply	other threads:[~2024-03-30 15:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-29 15:50 D. Ben Knoble
2024-03-29 17:23 ` Mikael Magnusson
2024-03-29 17:44   ` Ben Knoble
2024-03-29 19:40     ` Bart Schaefer
2024-03-29 19:43     ` Oliver Kiddle
2024-03-30 15:27       ` D. Ben Knoble [this message]
2024-03-30 15:46         ` Bart Schaefer

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='CALnO6CArWVs4Bx-OniUWwxjRP=MwsgeTgOsyyAGzmWhUG_Qovg@mail.gmail.com' \
    --to=ben.knoble@gmail.com \
    --cc=opk@zsh.org \
    --cc=zsh-workers@zsh.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).