From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 32196 invoked from network); 7 Jul 2020 06:58:33 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 7 Jul 2020 06:58:33 -0000 Received: (qmail 27424 invoked by alias); 7 Jul 2020 06:58:21 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: Sender: zsh-workers@zsh.org X-Seq: 46198 Received: (qmail 13751 invoked by uid 1010); 7 Jul 2020 06:58:21 -0000 X-Qmail-Scanner-Diagnostics: from mail-wr1-f48.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25863. spamassassin: 3.4.4. Clear:RC:0(209.85.221.48):SA:0(-1.8/5.0):. Processed in 2.306643 secs); 07 Jul 2020 06:58:21 -0000 X-Envelope-From: guidocella91@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.221.48 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=CwyfAS+EQc8lbXsvWtQbitNFevEEuCKI7JbsXo9NaHI=; b=C1Q5dyrb3g+8jw9n3gFhf2d8paRmlp5BWux2zwxgy/+6n2aql4xgXdJPITzEgx0pWs 4HJtHun+c2thbFC9fssvsDSCoYsjaAjO30KmpGcqod3M0sab5PC8mrFkcfPnC2AchBvf O0g+Zq3PxdkMCoAzr34Udp4N5en5PzosrPAUDpSJh831R/CgoLWsslGt7VnXEnWEun8/ W5+o/1F20qNor+deYH4UZkSlUAzAC+ZrFSQ5mA+gR8VT7/EZbf0/gZdi0VFCIuf5qKOB Jc0G+I70Ae+F7Akzzxfw4nBUBgGdym1SkFGfyZqs6045amyqpMn7ii9qETzi6gmgN3Ot XbFQ== X-Gm-Message-State: AOAM532Uid2P0rjLXbyv2hjlPJfC0kWVqVCHUGm3oIT69bxEIb7Tpg6S rUrWdan5raCUQ9tQzLgXJRLYfcy0 X-Google-Smtp-Source: ABdhPJznJtXiyYnBlLtGYunsBQig3rbwbEysC5InvdpnVIYnJCzzXZHBkOQSjSx+Pdn6Ofixcdu83Q== X-Received: by 2002:a5d:6ac7:: with SMTP id u7mr25521706wrw.25.1594105063918; Mon, 06 Jul 2020 23:57:43 -0700 (PDT) Date: Tue, 7 Jul 2020 08:57:41 +0200 From: Guido Cella To: Bart Schaefer Cc: "zsh-workers@zsh.org" Subject: Re: [Bug] Doubled completions with suffix aliases and grouping Message-ID: <20200707065741.orpjgyhwnxum6i4g@aegis.localdomain> Mail-Followup-To: Bart Schaefer , "zsh-workers@zsh.org" References: <20200705174642.b2frcpxiuscbj27r@aegis.localdomain> <20200705192433.mdqsbcrhhasqvotf@aegis.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Jul 06, 2020 at 09:51:06PM -0700, Bart Schaefer wrote: > On Sun, Jul 5, 2020 at 12:24 PM Guido Cella 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 ./ 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.