zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: "D. Ben Knoble" <ben.knoble@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: bug: _files depends on extendedglob
Date: Fri, 29 Mar 2024 18:23:09 +0100	[thread overview]
Message-ID: <CAHYJk3Spy=QUF_Kpy19TAniu8n7TdW2owVh9=zamko359MUtVw@mail.gmail.com> (raw)
In-Reply-To: <CALnO6CByDs7UuFCx_oYKh92Nt+AzTZB=HiQ1FEjkY24ci+v4tQ@mail.gmail.com>

On Fri, Mar 29, 2024 at 4:51 PM D. Ben Knoble <ben.knoble@gmail.com> wrote:
>
> Here's a transcript from a session after I finally pieced together
> what was breaking in
> https://github.com/benknoble/Dotfiles/commit/9c7dd6d1ec8b3caac670f1a2a030769a4c90c06c,
> which contains in its message more details about how I debugged this
> particular failure.
>
> zsh --version
> zsh 5.9 (x86_64-apple-darwin20.6.0)
> # macOS 12.7.2
> zsh -f
> temp=$(mktemp -d)
> fpath+=($temp)
> wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh
> -o $temp/_git
> autoload -Uz compinit && compinit
> _git_doc () { emulate -L zsh
>   _files -W $(git --html-path)/
> }
> git doc <TAB>
> # (eval):1: no matches found: *:globbed-files
> # completion results still produced
> _git_doc () { emulate -L zsh
>   setopt extendedglob
>   _files -W $(git --html-path)/
> }
> git doc <TAB>
> # works like a charm
>
> I'm not sure what the appropriate fix is, though I think some
> combination of localopts and extendedglob might work? I see that some
> parts of _files test for extendedglob, but the part that sets pats
> that leads to the failure (line 78 for me) seems to be affected
> without any test.

The completion system sets up the options it uses on entry, if you
change them you get to keep the pieces. (Why are you setting the
emulation mode in a completer function anyway?) If you for whatever
reason insist on doing this, then you can setopt $_comp_options to
restore the correct option set before calling _files.

-- 
Mikael Magnusson


  reply	other threads:[~2024-03-29 17:23 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 [this message]
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
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='CAHYJk3Spy=QUF_Kpy19TAniu8n7TdW2owVh9=zamko359MUtVw@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=ben.knoble@gmail.com \
    --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).