While working on a script I encountered an issue with setopt. Since I was setting and
unsetting an option multiple times I placed both in a functions to mostly get rid of the
extra typing. But as some may already guessed, that didn't work.
So looked at man zshall. Nothing jumped out. Google here I come. Eventually
found thiswhere Stéphane Chazelas wrote:
(note that zsh only implements local scope for variables and options, not for functions, aliases...)
This eventually got me to "emulate -L zsh" which is what I had at the top of my script. That led
to "local_options". Found what caused the issue.
To the point/question: Should zshoptions man page have a clear statement at the very
beginning that "options" can have a local "scope"? "Scope" is only mentioned later in in
three options. This on my part is assuming "scope" is the correct word to use here.
FWIW, the "emulate builtin" references the three options (local_optioon, local_patterns and
local_traps) but only two backreference emulate, local_traps does not.
Thanks for listening.
Jim Murphy
Working with Unix/Linux for 40 years, so man pages have a love/hate relationship for me.
Never clear enough or enough GOOD examples in them. That said the zsh man pages
are good, but not perfect or as clear as they could be in all cases. Thanks to all who have
made them as good as they are.