From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-users@zsh.org
Subject: [PATCH] zstyle: Correct and expand docs (was: Re: Most minimal configuration challenge)
Date: Fri, 2 Sep 2022 10:39:29 +0000 [thread overview]
Message-ID: <20220902103929.GN5920@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <CAMP44s2NjmLSmrNUBnd_zh4_-NtpUzU0uZFeMq7HMnFuMMVr9w@mail.gmail.com>
I noticed the contradictory claims about equally v. more specific on
lines 55-56 of mod_zutil.yo, and along the way fixed some preëxisting
issues.
Daniel
diff --git a/Doc/Zsh/mod_zutil.yo b/Doc/Zsh/mod_zutil.yo
index 3cf9e5028..ef0ee64a3 100644
--- a/Doc/Zsh/mod_zutil.yo
+++ b/Doc/Zsh/mod_zutil.yo
@@ -17,15 +17,16 @@ item(tt(zstyle -m) var(context) var(style) var(pattern))(
This builtin command is used to define and lookup styles. Styles are
pairs of names and values, where the values consist of any number of
strings. They are stored together with patterns and lookup is done by
-giving a string, called the `em(context)', which is matched against the
-patterns. The definition stored for the most specific pattern that matches
-will be returned.
+giving a string, called the `em(context)', which patterns are matched against.
+The definition stored for that style name the most specific pattern that
+matches the context will be returned.
+COMMENT(See the "Calculate the weight" common in Src/Modules/zutil.c)
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
simple strings are considered to be more specific than patterns and
-complex patterns are considered to be more specific than the pattern
+any pattern other than `tt(*)' is 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
@@ -51,8 +52,19 @@ in order to retrieve your preference into the scalar variable tt($REPLY).
On Sundays tt($REPLY) would be set to `tt(snow)'; in Europe it would be set
to `tt(rain)'; and on Sundays in Europe it would be set to `tt(snow)' again,
because the patterns `tt(:weather:europe:*)' and `tt(:weather:*:Sunday:*)' both
-match the var(context) argument to tt(zstyle -s), are equally specific, and the
-latter is more specific (because it has more colon-separated components).
+match the var(context) argument to tt(zstyle -s) and the
+latter pattern has more colon-separated components, and therefore is more
+specific. A definition such as
+
+example(zstyle ':weather:e*:Sunday:*gib*' preferred-precipitation cloudless-skies)
+
+would be more specific still, since it has the same number of colon-separated
+components but the components are more specific; and the definition
+
+example(zstyle ':weather:europe:Sunday:waxing-gibbous' meteorites)
+
+would be more specific than any other definition that might also match,
+since none of its colon-separated components is a pattern.
em(Usage)
next prev parent reply other threads:[~2022-09-02 10:42 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-27 4:30 Most minimal configuration challenge Felipe Contreras
2022-08-27 16:10 ` Daniel Shahaf
2022-08-27 19:32 ` Vincent Bernat
2022-08-27 20:04 ` Lawrence Velázquez
2022-08-27 23:53 ` Ray Andrews
2022-08-28 7:53 ` zzapper
2022-08-28 10:30 ` Daniel Shahaf
2022-08-28 13:59 ` Ray Andrews
2022-08-28 18:29 ` Daniel Shahaf
2022-08-31 9:28 ` Vincent Lefevre
2022-08-31 14:17 ` Ray Andrews
2022-09-01 21:52 ` Felipe Contreras
2022-09-02 1:41 ` Lawrence Velázquez
2022-09-02 1:26 ` Lawrence Velázquez
2022-09-02 1:49 ` Felipe Contreras
2022-09-02 5:40 ` Lawrence Velázquez
2022-09-02 7:38 ` Felipe Contreras
2022-09-02 10:36 ` Daniel Shahaf
2022-09-02 14:26 ` Ray Andrews
2022-09-04 7:13 ` Daniel Shahaf
2022-09-04 16:30 ` Ray Andrews
2022-09-02 10:39 ` Daniel Shahaf [this message]
2022-09-02 15:05 ` [PATCH] zstyle: Correct and expand docs (was: Re: Most minimal configuration challenge) Bart Schaefer
2022-09-04 6:51 ` Daniel Shahaf
2022-09-02 13:55 ` Most minimal configuration challenge Ray Andrews
2022-09-04 7:21 ` Daniel Shahaf
2022-09-04 16:34 ` Ray Andrews
2022-09-02 13:32 ` Ray Andrews
2022-09-04 7:28 ` Daniel Shahaf
2022-09-02 9:53 ` Daniel Shahaf
2022-09-02 9:26 ` Daniel Shahaf
2022-09-02 14:44 ` Vincent Lefevre
2022-09-04 6:42 ` Daniel Shahaf
2022-09-05 9:47 ` Vincent Lefevre
2022-09-12 8:59 ` Daniel Shahaf
2022-08-28 18:58 ` Bart Schaefer
2022-08-28 19:23 ` Felipe Contreras
2022-08-28 19:35 ` Ray Andrews
2022-08-28 18:57 ` Felipe Contreras
2022-09-02 1:36 ` Vincent Lefevre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220902103929.GN5920@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).