From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: nocorrect documentation and behavior
Date: Wed, 13 Mar 2024 20:46:40 -0700 [thread overview]
Message-ID: <CAH+w=7bG+XC=jjKY8Tsw-ToJZTxdOGv8kEeyiAV4_hc9j_E4xA@mail.gmail.com> (raw)
In-Reply-To: <20240313161732.GA3513530@cventin.lip.ens-lyon.fr>
On Wed, Mar 13, 2024 at 9:17 AM Vincent Lefevre <vincent@vinc17.net> wrote:
>
> "nocorrect" is documented under "PRECOMMAND MODIFIERS". So it is
> surprising that it can affect more than the corresponding command.
It's documented there because there was no better place to put it, I
vaguely recall.
> Is this the expected behavior?
It's the implemented behavior, at least. This is an effect of it
being handled with a flag in the global parser state, which does not
reset at subshell or command boundaries. This is hinted at by "with
the exception of nocorrect which is a reserved word ... interpreted
immediately, before any parsing". Conversely, as I think was
discussed not that long ago, spelling correction is applied during
parsing as soon as each full word is seen, just like alias expansion.
> Spelling correction is not done on any of the subsequent words
> of the full command line. [...]
It also says "A simple command may be preceded ..." which is equally
inaccurate in this case, but there are a lot of bits of the doc that
colloquially assume that one interactive command line is the same as
one "simple command".
diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo
index 915b93bc0..b80f9750c 100644
--- a/Doc/Zsh/grammar.yo
+++ b/Doc/Zsh/grammar.yo
@@ -100,14 +100,15 @@ More generally, a list can be seen as a set of
any shell commands
whatsoever, including the complex commands below; this is implied wherever
the word `list' appears in later descriptions. For example, the commands
in a shell function form a special sort of list.
+
texinode(Precommand Modifiers)(Complex Commands)(Simple Commands &
Pipelines)(Shell Grammar)
sect(Precommand Modifiers)
cindex(precommand modifiers)
cindex(modifiers, precommand)
-A simple command may be preceded by a em(precommand modifier),
-which will alter how the command is interpreted. These modifiers are
-shell builtin commands with the exception of tt(nocorrect) which is
-a reserved word.
+With the exception of tt(nocorrect), which is a reserved word that
+affects further parsing when it is found in command position, each
+of the following builtin commands is a em(precommand modifier) which
+may precede a simple command to alter how that command is interpreted.
startitem()
findex(-)
next prev parent reply other threads:[~2024-03-14 3:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-13 16:17 Vincent Lefevre
2024-03-14 3:46 ` Bart Schaefer [this message]
2024-03-15 11:55 ` 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='CAH+w=7bG+XC=jjKY8Tsw-ToJZTxdOGv8kEeyiAV4_hc9j_E4xA@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@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).