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=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9054 invoked from network); 26 Jan 2022 15:30:28 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 26 Jan 2022 15:30:28 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1643211028; b=rcNZdae8Ioml/FWOqxGcAsKwSP1cgpmcxeUnQyVJBumxakn8LmKCk4+QDPGj45JxyEzDACAALm 88yoN0nzIf2VmIQKgi6AwpbhYs4aS9VWHl0W4BBcAToWGFyp3Jtc08x8bxsbXixOPPkjaVCmkl ult6c+mFTUxgHQjak29peR7iKVv8gmRMegC82PYk+XbRMZFpWhLVDhQ9cy2F6hJBKFrG1UVpFE gs/jXiIuSySbnfz6RG/a/5uqjMuFya0gb2J6g7DCNYXKS9eT9eqSWahIs2ZlvyCwYrbFtghgF0 6bVmCnDEJ+drTFDAPjtF/ldbXZPjkxl07/S6z76zTHrA4A==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (wout2-smtp.messagingengine.com) smtp.remote-ip=64.147.123.25; dkim=pass header.d=daniel.shahaf.name header.s=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1643211028; bh=kzS+dT7TjnHMK5l6pzGXb7Bcn94frjYhszg/2zdY9r0=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version: Message-ID:Subject:Cc:To:From:Date:DKIM-Signature:DKIM-Signature: DKIM-Signature; b=RFJibqr2AvSrxms+vRDhMQNLOPbgKy+Z9O0oCKNinXC/uOl/6v7iXlsWBcRCqzBtEbufc8nnZp HncOMjy7iM/9xl/Y3SOtDmLoZzNTQ9Gz2P0Kzx9Zs1uHOiAmbbMHkkxDmfi5jJux+HIBzIlnwA 2UmWOmaJoKuAcHb/aZpBhuTRoSEHTOjlKU0ThtWp6/Zm8bwvcPJLzx7O9p6b77uL2F0rDOaXM8 UFZMzq3i2iqywgaic98ayf2ZukxesH8cmH7u9t6scpQRqHOJz+3dV6Cto4tT9ZSxAruIBSRXxB ebzxJ2lhJprBz46f5Et6rAfzuVgG7UbkLX55Y6Qb5nEZwQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=a5PYps7wj2W4hyL6NLQgLsaKEY4rzWMXvPAH9HYHFi4=; b=rgHFLuHfbiQ4zYBQ8/TrT2wq5j CVxGnP4cu7qcAiCG5UK/XYxPH9iJ/CtBqqMAStxDL/DvTsjr1fT8ovx6YhWq0cy1rnmXOX4V0k8yT OX73pheo+xHvvkRKfTNiuBvV3T1PXsmsE9TzlSi3Q8vvmkyuhHoWrUuwxV1Z38m8nT+EDjbMtyryf 73Wa8sl2A/z9C6+TOIyYvIHfbfkhDwI8lLXal0kcItDeHVrMQ3k7BzFxQLpWnBNmD+jvnn0DKh50z 2tZ/nOsh12RUOJ8+Mug/QaWhXe1qzAfDov7XxSKvbijNrkSZ8Mt/W45CqpGsi9kVQ9S2CnrQOw8+U jXC2huSQ==; Received: from authenticated user by zero.zsh.org with local id 1nCkFf-0005Kl-4m; Wed, 26 Jan 2022 15:30:27 +0000 Authentication-Results: zsh.org; iprev=pass (wout2-smtp.messagingengine.com) smtp.remote-ip=64.147.123.25; dkim=pass header.d=daniel.shahaf.name header.s=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:59867) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1nCkFO-000511-6M; Wed, 26 Jan 2022 15:30:10 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 569113202056; Wed, 26 Jan 2022 10:30:08 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 26 Jan 2022 10:30:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to; s=fm2; bh=a 5PYps7wj2W4hyL6NLQgLsaKEY4rzWMXvPAH9HYHFi4=; b=WC271B2mSphcS8YRl wWBH2Fa1bLkEa+Z/hS1cfIeL0CBsRSglkcs2iz+SbBFSjX2XA2X8NQVSly9fu2Zx 9Zbe7lYwDc5wVvSbaOyq9thiBx3MHOF5O+BZqp+3CyugWR8fZVeH+WUVLkqCQc6T f1j05cJYnKT43GLgPS3n92DQR3DJ7StQM/eQNdlBRViUtHGhzNjnvnUevrDtdbRn hQbLgfu6MSqqIA0T1PZQPOtB3lkPxrcUtIbIxbFMa2Ost8m8F5pJgFHNmQd4OFG4 tuq0R01HjJXvBryskqnyotzk03gpT9QSkJXWWjEXocrnRuoKslG4pbkvyPbK4H7c /kPwA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=a5PYps 7wj2W4hyL6NLQgLsaKEY4rzWMXvPAH9HYHFi4=; b=c/4sxM+4tA+LUehtIG2P6m 65psAA2RfZIyJJp6wwOQs6S9XtcrmFtO3TfbXTg6xwkDvzPah8eAy1+lQx0rUkM+ EKiFtfj6w7hPr3oBpX5dR13WDsD+I4bHVUqjSRySFQYJgti9pT5951aPB3/3/Q4j sIk9ki4sKlS+UT57EpgUeoD8YJbkMub0zDPMGGd6WiDD+qfH4mMvHT0vySRTECSO rTdbwHGXbIgoQ9mwcizZ3SqRBDL7MnRox357ttwCjJZD7POfnYUTk0ynqlJp8Gu9 CeAzexwMzUEo2v/8le+jkm+UHqeDT3qh6KOS6xmEUHNCgfVOjjXFcne9eyMDpvNg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrfedugdejiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfggtggugfgfsehtkedttd dtredunecuhfhrohhmpeffrghnihgvlhcuufhhrghhrghfuceougdrshesuggrnhhivghl rdhshhgrhhgrfhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpedthffgudekhfeltedvge ekgeffffegfeeiteektdefkefgueekgeevkeefgeehfeenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdrshhhrghhrg hfrdhnrghmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 26 Jan 2022 10:30:07 -0500 (EST) Received: by tarpaulin.shahaf.local2 (Postfix, from userid 1000) id 4JkSMd3Kncz4fY; Wed, 26 Jan 2022 15:30:05 +0000 (UTC) Date: Wed, 26 Jan 2022 15:30:05 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Cc: Eric Cook Subject: _files' default descriptions of globbed-files and all-files are identical Message-ID: <20220126153005.GC1732@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.10.1 (2018-07-13) X-Seq: 49716 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: 1 $ cd "$(mktemp -d)" 2 $ touch foo bar 3 $ zsh -f 4 % autoload compinit && compinit 5 % zstyle '*' format '::: %d' 6 % zstyle '*' group-name '' 7 % _f() { _files -g '*(+true)' } 8 % _g() { _files -g '*(+false)' } 9 % compdef _f f 10 % compdef _g g 11 % f 12 ::: file 13 bar foo 14 % g 15 ::: file 16 bar foo 17 % zstyle ':completion:*' file-patterns '%p:globbed-files:globbed\ files *(-/):directories' '*:all-files:other\ files' 18 % f 19 ::: globbed files 20 bar foo 21 % g 22 ::: file 23 bar foo The invocations on lines 11 and 14 generate the same output. Consequently, if a completion function uses «_files -g "*(+foo)"» for some non-trivial value of foo, a user can't immediately tell whether the files they're seeing are those that match the criterion, or the «*:all-files» group. One way to approach this is to set the file-patterns style, as on line 17. That makes the two cases generate different output. Should this setting be the default? I'm not proposing to literally set a zstyle by default, but to change _files so it assumes this value if no style is set; for instance: diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files index f03b4a148..14cfe4e4e 100644 --- a/Completion/Unix/Type/_files +++ b/Completion/Unix/Type/_files @@ -71,11 +71,11 @@ if zstyle -a ":completion:${curcontext}:" file-patterns tmp; then fi done elif zstyle -t ":completion:${curcontext}:" list-dirs-first; then - pats=( " *(-/):directories:directory ${${glob:-*}//:/\\:}(#q^-/):globbed-files" '*:all-files' ) + pats=( " *(-/):directories:directory ${${glob:-*}//:/\\:}(#q^-/):globbed-files:globbed\\ files" "*:all-files:other\\ files" ) else # People prefer to have directories shown on first try as default. # Even if the calling function didn't use -/. - pats=( "${${glob:-*}//:/\\:}:globbed-files *(-/):directories" '*:all-files ' ) + pats=( "${${glob:-*}//:/\\:}:globbed-files:globbed\\ files *(-/):directories:directories" "*:all-files:other\\ files" ) fi tried=() Thoughts? --- I've discussed this on IRC and Eric did not support the change. If I understand correctly (and I'm not sure I do), Eric'd prefer that the completion function would use _path_files instead or that the user would set the file-patterns style on a specific context. Eric, please add/correct this as needed. Cheers, Daniel