From mboxrd@z Thu Jan 1 00:00:00 1970 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: (qmail 1486 invoked from network); 27 Apr 2020 10:15:15 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with UTF8ESMTPZ; 27 Apr 2020 10:15:15 -0000 Received: (qmail 8121 invoked by alias); 27 Apr 2020 10:15:10 -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: X-Seq: 45723 Received: (qmail 11489 invoked by uid 1010); 27 Apr 2020 10:15:10 -0000 X-Qmail-Scanner-Diagnostics: from wout1-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25793. spamassassin: 3.4.4. Clear:RC:0(64.147.123.24):SA:0(-2.6/5.0):. Processed in 1.288392 secs); 27 Apr 2020 10:15:10 -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: gggruggvucftvghtrhhoucdtuddrgeduhedrheelgddvgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukffogggtgfesthhqtddtre dtjeenucfhrhhomhepffgrnhhivghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdr shhhrghhrghfrdhnrghmvgeqnecukfhppeejledrudektddrudeftddrudegjeenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghn ihgvlhdrshhhrghhrghfrdhnrghmvg X-ME-Proxy: Date: Mon, 27 Apr 2020 10:14:30 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: zstyle: "more specific" patterns and *-components Message-ID: <20200427101430.447e2a21@tarpaulin.shahaf.local2> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable What would you expect . zstyle ':foo:bar:*' lorem world zstyle ':foo:*:baz:*' lorem hello zstyle -s ':foo:bar:baz:qux' lorem REPLY && print $REPLY . to print? For reference, the documentation specifies: > A pattern is considered to be more specific > than another if it contains more components (substrings separated by > colons) or if the patterns for the components are more specific, where=20 > simple strings are considered to be more specific than patterns and > complex patterns are considered to be more specific than the pattern > `tt(*)'. A `tt(*)' in the pattern will match zero or more characters > in the context; colons are not treated specially in this regard. > If two patterns are equally specific, the tie is broken in favour of > the pattern that was defined first. (This part of the documentation was recently changed in users/24656, by me, but I didn't intend to change its meaning, only to clarify it.) --- Currently, that prints "world", and would print "hello" if the first two lines were reordered. That's because setstypat() gives a weight of=C2=A00 to colon-separated pattern components that consist of a single asterisk and nothing else: the two patterns are considered equally specific, so the first one defined wins. However, going by the documentation I expected ':foo:*:baz:*' to be considered more specific than ':foo:bar:*' (because it contains more components: 'three literal strings and two asterisks' is more than 'three literal strings and one asterisk'), and therefore, 'hello' to be printed regardless of the order of the first two lines. WDYT? Cheers, Daniel P.S. The three literal strings are ("" "foo" "bar") in the first pattern and ("" "foo" "baz") in the second pattern.