From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 6f4a40e9 for ; Tue, 14 Jan 2020 18:51:57 +0000 (UTC) Received: (qmail 15142 invoked by alias); 14 Jan 2020 18:51:50 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24665 Received: (qmail 14271 invoked by uid 1010); 14 Jan 2020 18:51:50 -0000 X-Qmail-Scanner-Diagnostics: from wout4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25691. spamassassin: 3.4.2. Clear:RC:0(64.147.123.20):SA:0(-2.6/5.0):. Processed in 5.188075 secs); 14 Jan 2020 18:51:50 -0000 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) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrtddugddvgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgfgsehtqh ertderreejnecuhfhrohhmpedfffgrnhhivghlucfuhhgrhhgrfhdfuceougdrshesuggr nhhivghlrdhshhgrhhgrfhdrnhgrmhgvqeenucfrrghrrghmpehmrghilhhfrhhomhepug drshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgvnecuvehluhhsthgvrhfuihiivgep td X-ME-Proxy: X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-754-g09d1619-fmstable-20200113v1 Mime-Version: 1.0 Message-Id: <2119475f-71ea-436e-ab89-5782e29f3341@www.fastmail.com> In-Reply-To: References: <20200113170630.GA8134@tarpaulin.shahaf.local2> <1d1c62f2-7d74-4b6c-a08e-78dfe7378fc6@www.fastmail.com> <1579025111.4404.61.camel@samsung.com> Date: Tue, 14 Jan 2020 18:50:32 +0000 From: "Daniel Shahaf" To: zsh-users@zsh.org Subject: Re: problem with context specification Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Bart Schaefer wrote on Tue, 14 Jan 2020 18:34 +00:00: > On Tue, Jan 14, 2020 at 10:06 AM Peter Stephenson > wrote: > > > > On Tue, 2020-01-14 at 16:45 +0000, Daniel Shahaf wrote: > > > > I assume the stars are for matching every possible value for tha= t segment, > > > No. An asterisk matches zero or more characters, _including colon= s_. > > > > This can certainly be a right pain. >=20 > It's important to remember that the colons are strictly a completion > system convention -- they have nothing to do with the semantics of > zstyle itself, That's not so. A colon is hardcoded into the determination of which pattern is more specific than another. For example, consider this: zstyle ':foo:*' key value zstyle ':foo:bar:*' key value This is two patterns. The second one is more specific than the first because it has more segments. The order of definition of these two patterns will not affect lookup results: % zstyle ':foo:*' key value1=20 % zstyle ':foo:bar:*' key value2=20 % zstyle -s :foo:bar:baz key a=20 % zstyle -d ':foo:*' % zstyle -d ':foo:bar:*' % zstyle ':foo:bar:*' key value2=20 % zstyle ':foo:*' key value1=20 % zstyle -s :foo:bar:baz key b=20 % echo $a $b=20 value2 value2 %=20 Now, change the example to not use colons: zstyle '/lorem/*' key value zstyle '/lorem/ipsum/*' key value This is two patterns that are *equally* specific =E2=80=94 each of them = consists of one colon-separated segment that's neither a literal string nor the pattern =C2=AB*=C2=BB =E2=80=94 so the order of definition does matter: = if you change the order of definitions of these two patterns, lookup results will be different: % zstyle '/lorem/*' key value1=20 % zstyle '/lorem/ipsum/*' key value2=20 % zstyle -s /lorem/ipsum/dolor key a=20 % zstyle -d '/lorem/*' % zstyle -d '/lorem/ipsum/*' % zstyle '/lorem/ipsum/*' key value2=20 % zstyle '/lorem/*' key value1=20 % zstyle -s /lorem/ipsum/dolor key b=20 % echo $a $b=20 value1 value2 %=20 This is documented and tested.