Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

nocorrect documentation and behavior



With zsh 5.9, consider:

cventin% setopt CORRECT_ALL
cventin% zsha && zshb && nocorrect zshc && zshd
zsh: correct 'zsha' to 'zsh' [nyae]? n
zsh: correct 'zshb' to 'zsh' [nyae]? n
zsh: command not found: zsha

while without "nocorrect", the 4 commands are proposed for correction.

The following lines are handled in the same way:

  zsha ; zshb ; nocorrect zshc ; zshd
  zsha ; zshb ; echo $(nocorrect zshc) ; zshd

"nocorrect" is documented under "PRECOMMAND MODIFIERS". So it is
surprising that it can affect more than the corresponding command.

Is this the expected behavior?

Well, at least this is useful to be able to use "nocorrect" on
the "for" words:

  nocorrect : ; for i in word1 word2 ; do echo $i ; done

Given the context "PRECOMMAND MODIFIERS", the documentation is not
explicit:

    nocorrect
        Spelling correction is not done on any of the words. This
        must appear before any other precommand modifier, as it is
        interpreted immediately, before any parsing is done. It has
        no effect in non-interactive shells.

If this is the expected behavior, I suppose that the documentation
should be something like

  Spelling correction is not done on any of the subsequent words
  of the full command line. [...]

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Messages sorted by: Reverse Date, Date, Thread, Author