From: Guido Cella <guidocella91@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [Bug] Doubled completions with suffix aliases and grouping
Date: Tue, 7 Jul 2020 08:57:41 +0200 [thread overview]
Message-ID: <20200707065741.orpjgyhwnxum6i4g@aegis.localdomain> (raw)
In-Reply-To: <CAH+w=7ZFUwYrguy6L5_N3NTGSiYPChgsFwmpFpmJ18-10+LX+A@mail.gmail.com>
On Mon, Jul 06, 2020 at 09:51:06PM -0700, Bart Schaefer wrote:
> On Sun, Jul 5, 2020 at 12:24 PM Guido Cella <guidocella91@gmail.com> wrote:
> >
> > I think that the bug is adding files that aren't executable to the
> > "executable file" grouping.
>
> Aye, well, that's not exactly a bug either. The position taken when
> developing the completion code was that it's always better to offer
> something that the user might possibly mean rather than to offer
> nothing; i.e., err on the side of too much information rather than too
> little. Because _command_names uses _alternative, the two branches
> (executables and suffix-aliases) don't "know" that the other might
> produce overlapping matches, so each generates its result
> independently, and when executables finds nothing, it falls back to
> all files.
>
> There are two elements of your specific example that could potentially
> be considered bugs. The first is that there's no file-patterns zstyle
> for the "executables" tag; the closest you can get is to set one for
> the :completion:complete:-command-:: context. The second is that this
> doesn't work:
>
> zstyle :completion::complete:-command-::executables ignored-patterns '*(^*)'
>
> Instead you have to do this:
>
> zstyle :completion::complete:-command-::executables ignored-patterns '*(#q^*)'
>
> However, I think you'll find if you do that latter, you'll get what you want.
I agree that it's better to complete all files rather than to offer
nothing, my problem is that it completes all files again even when
suffix aliases do offer matches.
zstyle :completion::complete:-command-::executables ignored-patterns '*(#q^*)'
is worse since it stops completing directories (and real executables)
when there's matching suffix alias. :/
mkdir {1..9}
touch foo.txt
./<Tab>
Only foo.txt is completed.
Anyway, by navigating the completion code I could guess fixing this
would require changing the code too much because executables and suffix
aliases are completed from different places. I only enabled grouping so
I could set list-dirs-first and have suffix aliases for everything, so
it's annoying to get double completions, even of many files, each time I
browse a leaf directory.
next prev parent reply other threads:[~2020-07-07 6:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-05 17:46 Guido Cella
2020-07-05 18:09 ` Bart Schaefer
2020-07-05 19:24 ` Guido Cella
2020-07-07 4:51 ` Bart Schaefer
2020-07-07 6:57 ` Guido Cella [this message]
2020-07-07 17:20 ` Bart Schaefer
2020-07-07 17:59 ` Guido Cella
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=20200707065741.orpjgyhwnxum6i4g@aegis.localdomain \
--to=guidocella91@gmail.com \
--cc=schaefer@brasslantern.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).