From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12156 invoked by alias); 2 Sep 2016 04:32:45 -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: X-Seq: 39154 Received: (qmail 26575 invoked from network); 2 Sep 2016 04:32:45 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.28):SA:0(0.0/5.0):. Processed in 0.555531 secs); 02 Sep 2016 04:32:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=JBLiFrLSlmeOPRwR6iZ6807Likg=; b=FMhIHU mvYLs85aNyAeB5/KGnMhXZ+42MFY/7DoL43RSMRSofy1hUItAq8wFOcgD6tlveY/ sckNGIG4F7d0Z/Ru89SB5SoV0q5AC7LtOwKtKRfyJitmXGJ24bQOJFoINwI07rts 6WRb90RFYNKJ1DRpRDEg/pz1OIaOZmFX4r/bE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=JBLiFrLSlmeOPRwR6iZ6807Likg=; b=f6wWC ynLZ6u5ZfJ6UkdecrhQf2NG/Gup7qXG4lwRLu5HXn1rTvoO/BKbC4dI1GiYrKdy+ Y2KWJ/NJJUOFLr5Jsx5yjsi2qviASt0hvSpyBpoThB+9FenB7takg3N+JlaJvjaO Ga+x/foPxZ4kB7XfPu2oj+Gxk8HX6VMWdGDeGI= X-Sasl-enc: C677EibbpSI4GFTC8Y+smMRd+a6eFfusCME3XtsXIUmD 1472790751 Date: Fri, 2 Sep 2016 04:32:02 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: _files: -/ causes caller's _alternative to be disregarded Message-ID: <20160902043202.GA25458@fujitsu.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.5.23 (2014-03-12) I ran into a problem, and found something that was wrong and fixed it and that made the problem go away, but I don't fully understand why the patch does in fact fix the problem. Here's a minimal example: [[[ % _g() { _files -/ "$@" } % _f() { _alternative 'x:x:_g' 'y:y:_hosts' } % compdef _f f % zstyle \* list-dirs-first true % f (shows just files, doesn't show hosts) ]]] Tracing, _files takes this codepath: . 37 elif [[ $type = */* ]]; then 38 glob="*(-/)" ⋮ 66 elif zstyle -t ":completion:${curcontext}:" list-dirs-first; then 67 pats=( " *(-/):directories:directory ${${glob:-*}//:/\\:}(#q^-/):globbed-files" '*:all-files' ) ^^^^^^^^^^^^^^^^^^^^ . and «*(-/)(#q^-/)» is not a valid pattern. Adding another #q fixes the symptom: [[[ diff --git Completion/Unix/Type/_files Completion/Unix/Type/_files index 6987824..2b0c558 100644 --- Completion/Unix/Type/_files +++ Completion/Unix/Type/_files @@ -35,7 +35,7 @@ if (( $tmp[(I)-g*] )); then [[ "$glob" = (#b)(*\()([^\|\~]##\)) && $match[2] != \#q* ]] && glob="${match[1]}#q${match[2]}" elif [[ $type = */* ]]; then - glob="*(-/)" + glob="*(#q-/)" fi tmp=$opts[(I)-F] if (( tmp )); then ]]] What I'm not clear about is why the invalid pattern for the "globbed-files" tag caused the "y:y:_hosts" alternative to be skipped. Cheers, Daniel P.S. The non-minimal example was «git push » not offering remotes.