zsh-workers
 help / color / mirror / code / Atom feed
* Clarifying man page(s)
@ 2022-03-13 15:14 Jim
  2022-03-14 10:58 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Jim @ 2022-03-13 15:14 UTC (permalink / raw)
  To: devs

[-- Attachment #1: Type: text/plain, Size: 1639 bytes --]

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
<https://unix.stackexchange.com/questions/468693/zsh-put-all-non-global-parameters-to-anonymous-local-inner-function>
this
<https://unix.stackexchange.com/questions/468693/zsh-put-all-non-global-parameters-to-anonymous-local-inner-function>
where 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.

[-- Attachment #2: Type: text/html, Size: 2061 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Clarifying man page(s)
  2022-03-13 15:14 Clarifying man page(s) Jim
@ 2022-03-14 10:58 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2022-03-14 10:58 UTC (permalink / raw)
  To: Jim, zsh workers

On 13 March 2022 at 15:14 Jim <linux.tech.guy@gmail.com> wrote:
> 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.

It's easy to add.

pws

diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index cf46007..443676b 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -41,6 +41,9 @@ will be treated just as `tt(-f)', but the string `tt(-f i)' is an error.
 This is because many systems which implement the `tt(#!)' mechanism for
 calling scripts do not strip trailing whitespace.
 
+It is possible for options to be set within a function scope.  See the
+description of the option tt(LOCAL_OPTIONS) below.
+
 texinode(Description of Options)(Option Aliases)(Specifying Options)(Options)
 sect(Description of Options)
 cindex(options, description)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-14 10:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-13 15:14 Clarifying man page(s) Jim
2022-03-14 10:58 ` Peter Stephenson

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).